[-]
[+]
|
Changed |
nginx-1.9.changes
|
|
[-]
[+]
|
Changed |
nginx-1.9.spec
^
|
|
[-]
[+]
|
Changed |
nginx-1.9.7.tar.bz2/CHANGES
^
|
@@ -1,4 +1,24 @@
+Changes with nginx 1.9.7 17 Nov 2015
+
+ *) Feature: the "nohostname" parameter of logging to syslog.
+
+ *) Feature: the "proxy_cache_convert_head" directive.
+
+ *) Feature: the $realip_remote_addr in the ngx_http_realip_module.
+
+ *) Bugfix: the "expires" directive might not work when using variables.
+
+ *) Bugfix: a segmentation fault might occur in a worker process when
+ using HTTP/2; the bug had appeared in 1.9.6.
+
+ *) Bugfix: if nginx was built with the ngx_http_v2_module it was
+ possible to use the HTTP/2 protocol even if the "http2" parameter of
+ the "listen" directive was not specified.
+
+ *) Bugfix: in the ngx_http_v2_module.
+
+
Changes with nginx 1.9.6 27 Oct 2015
*) Bugfix: a segmentation fault might occur in a worker process when
|
[-]
[+]
|
Changed |
nginx-1.9.7.tar.bz2/CHANGES.ru
^
|
@@ -1,4 +1,26 @@
+Изменения в nginx 1.9.7 17.11.2015
+
+ *) Добавление: параметр nohostname логгирования в syslog.
+
+ *) Добавление: директива proxy_cache_convert_head.
+
+ *) Добавление: переменная $realip_remote_addr в модуле
+ ngx_http_realip_module.
+
+ *) Исправление: директива expires могла не срабатывать при использовании
+ переменных.
+
+ *) Исправление: при использовании HTTP/2 в рабочем процессе мог
+ произойти segmentation fault; ошибка появилась в 1.9.6.
+
+ *) Исправление: если nginx был собран с модулем ngx_http_v2_module,
+ протокол HTTP/2 мог быть использован клиентом, даже если не был
+ указан параметр http2 директивы listen.
+
+ *) Исправление: в модуле ngx_http_v2_module.
+
+
Изменения в nginx 1.9.6 27.10.2015
*) Исправление: при использовании HTTP/2 в рабочем процессе мог
|
[-]
[+]
|
Changed |
nginx-1.9.7.tar.bz2/src/core/nginx.h
^
|
@@ -9,8 +9,8 @@
#define _NGINX_H_INCLUDED_
-#define nginx_version 1009006
-#define NGINX_VERSION "1.9.6"
+#define nginx_version 1009007
+#define NGINX_VERSION "1.9.7"
#define NGINX_VER "nginx/" NGINX_VERSION
#ifdef NGX_BUILD
|
[-]
[+]
|
Changed |
nginx-1.9.7.tar.bz2/src/core/ngx_parse.c
^
|
@@ -188,7 +188,7 @@
break;
case 'm':
- if (*p == 's') {
+ if (p < last && *p == 's') {
if (is_sec || step >= st_msec) {
return NGX_ERROR;
}
|
[-]
[+]
|
Changed |
nginx-1.9.7.tar.bz2/src/core/ngx_syslog.c
^
|
@@ -194,6 +194,9 @@
peer->tag.data = p + 4;
peer->tag.len = len - 4;
+ } else if (len == 10 && ngx_strncmp(p, "nohostname", 10) == 0) {
+ peer->nohostname = 1;
+
} else {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"unknown syslog parameter \"%s\"", p);
@@ -220,6 +223,11 @@
pri = peer->facility * 8 + peer->severity;
+ if (peer->nohostname) {
+ return ngx_sprintf(buf, "<%ui>%V %V: ", pri, &ngx_cached_syslog_time,
+ &peer->tag);
+ }
+
return ngx_sprintf(buf, "<%ui>%V %V %V: ", pri, &ngx_cached_syslog_time,
&ngx_cycle->hostname, &peer->tag);
}
|
[-]
[+]
|
Changed |
nginx-1.9.7.tar.bz2/src/core/ngx_syslog.h
^
|
@@ -16,7 +16,8 @@
ngx_addr_t server;
ngx_connection_t conn;
- ngx_uint_t busy; /* unsigned busy:1; */
+ unsigned busy:1;
+ unsigned nohostname:1;
} ngx_syslog_peer_t;
|
[-]
[+]
|
Changed |
nginx-1.9.7.tar.bz2/src/http/modules/ngx_http_proxy_module.c
^
|
@@ -533,6 +533,13 @@
offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_revalidate),
NULL },
+ { ngx_string("proxy_cache_convert_head"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
+ ngx_conf_set_flag_slot,
+ NGX_HTTP_LOC_CONF_OFFSET,
+ offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_convert_head),
+ NULL },
+
#endif
{ ngx_string("proxy_temp_path"),
@@ -2845,6 +2852,7 @@
conf->upstream.cache_lock_timeout = NGX_CONF_UNSET_MSEC;
conf->upstream.cache_lock_age = NGX_CONF_UNSET_MSEC;
conf->upstream.cache_revalidate = NGX_CONF_UNSET;
+ conf->upstream.cache_convert_head = NGX_CONF_UNSET;
#endif
conf->upstream.hide_headers = NGX_CONF_UNSET_PTR;
@@ -3143,6 +3151,9 @@
ngx_conf_merge_value(conf->upstream.cache_revalidate,
prev->upstream.cache_revalidate, 0);
+ ngx_conf_merge_value(conf->upstream.cache_convert_head,
+ prev->upstream.cache_convert_head, 1);
+
#endif
ngx_conf_merge_str_value(conf->method, prev->method, "");
|
[-]
[+]
|
Changed |
nginx-1.9.7.tar.bz2/src/http/modules/ngx_http_realip_module.c
^
|
@@ -43,9 +43,14 @@
static void *ngx_http_realip_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_realip_merge_loc_conf(ngx_conf_t *cf,
void *parent, void *child);
+static ngx_int_t ngx_http_realip_add_variables(ngx_conf_t *cf);
static ngx_int_t ngx_http_realip_init(ngx_conf_t *cf);
+static ngx_int_t ngx_http_realip_remote_addr_variable(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
+
+
static ngx_command_t ngx_http_realip_commands[] = {
{ ngx_string("set_real_ip_from"),
@@ -75,7 +80,7 @@
static ngx_http_module_t ngx_http_realip_module_ctx = {
- NULL, /* preconfiguration */
+ ngx_http_realip_add_variables, /* preconfiguration */
ngx_http_realip_init, /* postconfiguration */
NULL, /* create main configuration */
@@ -105,6 +110,15 @@
};
+static ngx_http_variable_t ngx_http_realip_vars[] = {
+
+ { ngx_string("realip_remote_addr"), NULL,
+ ngx_http_realip_remote_addr_variable, 0, 0, 0 },
+
+ { ngx_null_string, NULL, NULL, 0, 0, 0 }
+};
+
+
static ngx_int_t
ngx_http_realip_handler(ngx_http_request_t *r)
{
@@ -417,6 +431,25 @@
static ngx_int_t
+ngx_http_realip_add_variables(ngx_conf_t *cf)
+{
+ ngx_http_variable_t *var, *v;
+
+ for (v = ngx_http_realip_vars; v->name.len; v++) {
+ var = ngx_http_add_variable(cf, &v->name, v->flags);
+ if (var == NULL) {
+ return NGX_ERROR;
+ }
+
+ var->get_handler = v->get_handler;
+ var->data = v->data;
+ }
+
+ return NGX_OK;
+}
+
+
+static ngx_int_t
ngx_http_realip_init(ngx_conf_t *cf)
{
ngx_http_handler_pt *h;
@@ -440,3 +473,40 @@
return NGX_OK;
}
+
+
+static ngx_int_t
+ngx_http_realip_remote_addr_variable(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data)
+{
+ ngx_str_t *addr_text;
+ ngx_pool_cleanup_t *cln;
+ ngx_http_realip_ctx_t *ctx;
+
+ ctx = ngx_http_get_module_ctx(r, ngx_http_realip_module);
+
+ if (ctx == NULL && (r->internal || r->filter_finalize)) {
+
+ /*
+ * if module context was reset, the original address
+ * can still be found in the cleanup handler
+ */
+
+ for (cln = r->pool->cleanup; cln; cln = cln->next) {
+ if (cln->handler == ngx_http_realip_cleanup) {
+ ctx = cln->data;
+ break;
+ }
+ }
+ }
+
+ addr_text = ctx ? &ctx->addr_text : &r->connection->addr_text;
+
+ v->len = addr_text->len;
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
+ v->data = addr_text->data;
+
+ return NGX_OK;
+}
|
[-]
[+]
|
Changed |
nginx-1.9.7.tar.bz2/src/http/ngx_http_request.c
^
|
@@ -768,25 +768,31 @@
&& (defined TLSEXT_TYPE_application_layer_protocol_negotiation \
|| defined TLSEXT_TYPE_next_proto_neg))
{
- unsigned int len;
- const unsigned char *data;
+ unsigned int len;
+ const unsigned char *data;
+ ngx_http_connection_t *hc;
+
+ hc = c->data;
+
+ if (hc->addr_conf->http2) {
#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
- SSL_get0_alpn_selected(c->ssl->connection, &data, &len);
+ SSL_get0_alpn_selected(c->ssl->connection, &data, &len);
#ifdef TLSEXT_TYPE_next_proto_neg
- if (len == 0) {
- SSL_get0_next_proto_negotiated(c->ssl->connection, &data, &len);
- }
+ if (len == 0) {
+ SSL_get0_next_proto_negotiated(c->ssl->connection, &data, &len);
+ }
#endif
#else /* TLSEXT_TYPE_next_proto_neg */
- SSL_get0_next_proto_negotiated(c->ssl->connection, &data, &len);
+ SSL_get0_next_proto_negotiated(c->ssl->connection, &data, &len);
#endif
- if (len == 2 && data[0] == 'h' && data[1] == '2') {
- ngx_http_v2_init(c->read);
- return;
+ if (len == 2 && data[0] == 'h' && data[1] == '2') {
+ ngx_http_v2_init(c->read);
+ return;
+ }
}
}
#endif
|
[-]
[+]
|
Changed |
nginx-1.9.7.tar.bz2/src/http/ngx_http_upstream.c
^
|
@@ -764,7 +764,7 @@
return rc;
}
- if (r->method & NGX_HTTP_HEAD) {
+ if ((r->method & NGX_HTTP_HEAD) && u->conf->cache_convert_head) {
u->method = ngx_http_core_get_method;
}
|
[-]
[+]
|
Changed |
nginx-1.9.7.tar.bz2/src/http/ngx_http_upstream.h
^
|
@@ -193,6 +193,7 @@
ngx_msec_t cache_lock_age;
ngx_flag_t cache_revalidate;
+ ngx_flag_t cache_convert_head;
ngx_array_t *cache_valid;
ngx_array_t *cache_bypass;
|
[-]
[+]
|
Changed |
nginx-1.9.7.tar.bz2/src/http/v2/ngx_http_v2.c
^
|
@@ -870,8 +870,6 @@
return ngx_http_v2_state_skip_padded(h2c, pos, end);
}
- stream->in_closed = h2c->state.flags & NGX_HTTP_V2_END_STREAM_FLAG;
-
h2c->state.stream = stream;
return ngx_http_v2_state_read_data(h2c, pos, end);
@@ -899,6 +897,8 @@
}
if (stream->skip_data) {
+ stream->in_closed = h2c->state.flags & NGX_HTTP_V2_END_STREAM_FLAG;
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
"skipping http2 DATA frame, reason: %d",
stream->skip_data);
@@ -988,7 +988,9 @@
ngx_http_v2_state_read_data);
}
- if (stream->in_closed) {
+ if (h2c->state.flags & NGX_HTTP_V2_END_STREAM_FLAG) {
+ stream->in_closed = 1;
+
if (r->headers_in.content_length_n < 0) {
r->headers_in.content_length_n = rb->rest;
@@ -1204,10 +1206,9 @@
ngx_http_v2_state_header_block(ngx_http_v2_connection_t *h2c, u_char *pos,
u_char *end)
{
- u_char ch;
- ngx_int_t value;
- ngx_uint_t indexed, size_update, prefix;
- ngx_http_v2_srv_conf_t *h2scf;
+ u_char ch;
+ ngx_int_t value;
+ ngx_uint_t indexed, size_update, prefix;
if (end - pos < 1) {
return ngx_http_v2_state_save(h2c, pos, end,
@@ -1288,20 +1289,11 @@
return ngx_http_v2_state_header_complete(h2c, pos, end);
}
- h2scf = ngx_http_get_module_srv_conf(h2c->http_connection->conf_ctx,
- ngx_http_v2_module);
-
- h2c->state.field_limit = h2scf->max_field_size;
-
if (value == 0) {
h2c->state.parse_name = 1;
- } else {
- if (ngx_http_v2_get_indexed_header(h2c, value, 1) != NGX_OK) {
- return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_COMP_ERROR);
- }
-
- h2c->state.field_limit -= h2c->state.header.name.len;
+ } else if (ngx_http_v2_get_indexed_header(h2c, value, 1) != NGX_OK) {
+ return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_COMP_ERROR);
}
h2c->state.parse_value = 1;
@@ -1314,9 +1306,10 @@
ngx_http_v2_state_field_len(ngx_http_v2_connection_t *h2c, u_char *pos,
u_char *end)
{
- size_t alloc;
- ngx_int_t len;
- ngx_uint_t huff;
+ size_t alloc;
+ ngx_int_t len;
+ ngx_uint_t huff;
+ ngx_http_v2_srv_conf_t *h2scf;
if (!(h2c->state.flags & NGX_HTTP_V2_END_HEADERS_FLAG)
&& h2c->state.length < NGX_HTTP_V2_INT_OCTETS)
@@ -1363,14 +1356,16 @@
"http2 hpack %s string length: %i",
huff ? "encoded" : "raw", len);
- if ((size_t) len > h2c->state.field_limit) {
+ h2scf = ngx_http_get_module_srv_conf(h2c->http_connection->conf_ctx,
+ ngx_http_v2_module);
+
+ if ((size_t) len > h2scf->max_field_size) {
ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0,
"client exceeded http2_max_field_size limit");
return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_ENHANCE_YOUR_CALM);
}
- h2c->state.field_limit -= len;
h2c->state.field_rest = len;
if (h2c->state.stream == NULL && !h2c->state.index) {
@@ -1664,7 +1659,7 @@
h->key.len = header->name.len;
h->key.data = header->name.data;
- /* TODO Optimization: precalculate hash and hadnler for indexed headers. */
+ /* TODO Optimization: precalculate hash and handler for indexed headers. */
h->hash = ngx_hash_key(h->key.data, h->key.len);
h->value.len = header->value.len;
@@ -1818,7 +1813,7 @@
if (depend == h2c->state.sid) {
ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0,
"client sent PRIORITY frame for stream %ui "
- "with incorrect dependancy", h2c->state.sid);
+ "with incorrect dependency", h2c->state.sid);
node = ngx_http_v2_get_node_by_id(h2c, h2c->state.sid, 0);
@@ -2954,6 +2949,8 @@
return NGX_ERROR;
}
+ r->invalid_header = 0;
+
cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
for (i = (header->name.data[0] == ':'); i != header->name.len; i++) {
|
[-]
[+]
|
Changed |
nginx-1.9.7.tar.bz2/src/http/v2/ngx_http_v2.h
^
|
@@ -80,7 +80,6 @@
unsigned index:1;
ngx_http_v2_header_t header;
size_t header_limit;
- size_t field_limit;
u_char field_state;
u_char *field_start;
u_char *field_end;
@@ -179,7 +178,7 @@
size_t recv_window;
ngx_http_v2_out_frame_t *free_frames;
- ngx_chain_t *free_data_headers;
+ ngx_chain_t *free_frame_headers;
ngx_chain_t *free_bufs;
ngx_queue_t queue;
|
[-]
[+]
|
Changed |
nginx-1.9.7.tar.bz2/src/http/v2/ngx_http_v2_filter_module.c
^
|
@@ -624,6 +624,8 @@
*b->last++ = flags;
b->last = ngx_http_v2_write_sid(b->last, stream->node->id);
+ b->tag = (ngx_buf_tag_t) &ngx_http_v2_module;
+
cl = ngx_alloc_chain_link(r->pool);
if (cl == NULL) {
return NULL;
@@ -929,7 +931,7 @@
stream->node->id, frame, len, (ngx_uint_t) flags);
cl = ngx_chain_get_free_buf(stream->request->pool,
- &stream->free_data_headers);
+ &stream->free_frame_headers);
if (cl == NULL) {
return NULL;
}
@@ -946,7 +948,7 @@
buf->end = buf->start + NGX_HTTP_V2_FRAME_HEADER_SIZE;
buf->last = buf->end;
- buf->tag = (ngx_buf_tag_t) &ngx_http_v2_filter_get_data_frame;
+ buf->tag = (ngx_buf_tag_t) &ngx_http_v2_module;
buf->memory = 1;
}
@@ -1054,23 +1056,45 @@
ngx_http_v2_headers_frame_handler(ngx_http_v2_connection_t *h2c,
ngx_http_v2_out_frame_t *frame)
{
- ngx_buf_t *buf;
+ ngx_chain_t *cl, *ln;
ngx_http_v2_stream_t *stream;
- buf = frame->first->buf;
+ stream = frame->stream;
+ cl = frame->first;
- if (buf->pos != buf->last) {
- return NGX_AGAIN;
- }
+ for ( ;; ) {
+ if (cl->buf->pos != cl->buf->last) {
+ frame->first = cl;
- stream = frame->stream;
+ ngx_log_debug2(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
+ "http2:%ui HEADERS frame %p was sent partially",
+ stream->node->id, frame);
+
+ return NGX_AGAIN;
+ }
+
+ ln = cl->next;
+
+ if (cl->buf->tag == (ngx_buf_tag_t) &ngx_http_v2_module) {
+ cl->next = stream->free_frame_headers;
+ stream->free_frame_headers = cl;
+
+ } else {
+ cl->next = stream->free_bufs;
+ stream->free_bufs = cl;
+ }
+
+ if (cl == frame->last) {
+ break;
+ }
+
+ cl = ln;
+ }
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
"http2:%ui HEADERS frame %p was sent",
stream->node->id, frame);
- ngx_free_chain(stream->request->pool, frame->first);
-
ngx_http_v2_handle_frame(stream, frame);
ngx_http_v2_handle_stream(h2c, stream);
@@ -1091,7 +1115,7 @@
cl = frame->first;
- if (cl->buf->tag == (ngx_buf_tag_t) &ngx_http_v2_filter_get_data_frame) {
+ if (cl->buf->tag == (ngx_buf_tag_t) &ngx_http_v2_module) {
if (cl->buf->pos != cl->buf->last) {
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
@@ -1103,8 +1127,8 @@
ln = cl->next;
- cl->next = stream->free_data_headers;
- stream->free_data_headers = cl;
+ cl->next = stream->free_frame_headers;
+ stream->free_frame_headers = cl;
if (cl == frame->last) {
goto done;
|