Skip to content

Commit

Permalink
nginx 1.1.11
Browse files Browse the repository at this point in the history
    *) Feature: the "so_keepalive" parameter of the "listen" directive.
       Thanks to Vsevolod Stakhov.

    *) Feature: the "if_not_empty" parameter of the
       "fastcgi/scgi/uwsgi_param" directives.

    *) Feature: the $https variable.

    *) Feature: the "proxy_redirect" directive supports variables in the
       first parameter.

    *) Feature: the "proxy_redirect" directive supports regular expressions.

    *) Bugfix: the $sent_http_cache_control variable might contain a wrong
       value if the "expires" directive was used.
       Thanks to Yichun Zhang.

    *) Bugfix: the "read_ahead" directive might not work combined with
       "try_files" and "open_file_cache".

    *) Bugfix: a segmentation fault might occur in a worker process if small
       time was used in the "inactive" parameter of the "proxy_cache_path"
       directive.

    *) Bugfix: responses from cache might hang.
  • Loading branch information
igorsysoev authored and catap committed Dec 11, 2011
1 parent 2e5946a commit 40601e3
Show file tree
Hide file tree
Showing 28 changed files with 778 additions and 249 deletions.
29 changes: 29 additions & 0 deletions CHANGES
@@ -1,4 +1,33 @@


Changes with nginx 1.1.11 12 Dec 2011

*) Feature: the "so_keepalive" parameter of the "listen" directive.
Thanks to Vsevolod Stakhov.

*) Feature: the "if_not_empty" parameter of the
"fastcgi/scgi/uwsgi_param" directives.

*) Feature: the $https variable.

*) Feature: the "proxy_redirect" directive supports variables in the
first parameter.

*) Feature: the "proxy_redirect" directive supports regular expressions.

*) Bugfix: the $sent_http_cache_control variable might contain a wrong
value if the "expires" directive was used.
Thanks to Yichun Zhang.

*) Bugfix: the "read_ahead" directive might not work combined with
"try_files" and "open_file_cache".

*) Bugfix: a segmentation fault might occur in a worker process if small
time was used in the "inactive" parameter of the "proxy_cache_path"
directive.

*) Bugfix: responses from cache might hang.


Changes with nginx 1.1.10 30 Nov 2011 Changes with nginx 1.1.10 30 Nov 2011


*) Bugfix: a segmentation fault occured in a worker process if AIO was *) Bugfix: a segmentation fault occured in a worker process if AIO was
Expand Down
30 changes: 30 additions & 0 deletions CHANGES.ru
@@ -1,4 +1,34 @@


Изменения в nginx 1.1.11 12.12.2011

*) Добавление: параметр so_keepalive в директиве listen.
Спасибо Всеволоду Стахову.

*) Добавление: параметр if_not_empty в директивах
fastcgi/scgi/uwsgi_param.

*) Добавление: переменная $https.

*) Добавление: директива proxy_redirect поддерживает переменные в первом
параметре.

*) Добавление: директива proxy_redirect поддерживает регулярные
выражения.

*) Исправление: переменная $sent_http_cache_control могла содержать
неверное значение при использовании директивы expires.
Спасибо Yichun Zhang.

*) Исправление: директива read_ahead могла не работать при использовании
совместно с try_files и open_file_cache.

*) Исправление: если в параметре inactive директивы proxy_cache_path
было указано малое время, в рабочем процессе мог произойти
segmentation fault.

*) Исправление: ответы из кэша могли зависать.


Изменения в nginx 1.1.10 30.11.2011 Изменения в nginx 1.1.10 30.11.2011


*) Исправление: при использовании AIO на Linux в рабочем процессе *) Исправление: при использовании AIO на Linux в рабочем процессе
Expand Down
14 changes: 14 additions & 0 deletions auto/unix
Expand Up @@ -328,6 +328,20 @@ ngx_feature_test="setsockopt(0, IPPROTO_TCP, TCP_DEFER_ACCEPT, NULL, 0)"
. auto/feature . auto/feature




ngx_feature="TCP_KEEPIDLE, TCP_KEEPINTVL, TCP_KEEPCNT"
ngx_feature_name="NGX_HAVE_KEEPALIVE_TUNABLE"
ngx_feature_run=no
ngx_feature_incs="#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="setsockopt(0, IPPROTO_TCP, TCP_KEEPIDLE, NULL, 0);
setsockopt(0, IPPROTO_TCP, TCP_KEEPINTVL, NULL, 0);
setsockopt(0, IPPROTO_TCP, TCP_KEEPCNT, NULL, 0)"
. auto/feature


ngx_feature="accept4()" ngx_feature="accept4()"
ngx_feature_name="NGX_HAVE_ACCEPT4" ngx_feature_name="NGX_HAVE_ACCEPT4"
ngx_feature_run=no ngx_feature_run=no
Expand Down
1 change: 1 addition & 0 deletions conf/fastcgi_params
Expand Up @@ -9,6 +9,7 @@ fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param HTTPS $https if_not_empty;


fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
Expand Down
1 change: 1 addition & 0 deletions conf/scgi_params
Expand Up @@ -8,6 +8,7 @@ scgi_param DOCUMENT_URI $document_uri;
scgi_param DOCUMENT_ROOT $document_root; scgi_param DOCUMENT_ROOT $document_root;
scgi_param SCGI 1; scgi_param SCGI 1;
scgi_param SERVER_PROTOCOL $server_protocol; scgi_param SERVER_PROTOCOL $server_protocol;
scgi_param HTTPS $https if_not_empty;


scgi_param REMOTE_ADDR $remote_addr; scgi_param REMOTE_ADDR $remote_addr;
scgi_param REMOTE_PORT $remote_port; scgi_param REMOTE_PORT $remote_port;
Expand Down
1 change: 1 addition & 0 deletions conf/uwsgi_params
Expand Up @@ -8,6 +8,7 @@ uwsgi_param REQUEST_URI $request_uri;
uwsgi_param PATH_INFO $document_uri; uwsgi_param PATH_INFO $document_uri;
uwsgi_param DOCUMENT_ROOT $document_root; uwsgi_param DOCUMENT_ROOT $document_root;
uwsgi_param SERVER_PROTOCOL $server_protocol; uwsgi_param SERVER_PROTOCOL $server_protocol;
uwsgi_param HTTPS $https if_not_empty;


uwsgi_param REMOTE_ADDR $remote_addr; uwsgi_param REMOTE_ADDR $remote_addr;
uwsgi_param REMOTE_PORT $remote_port; uwsgi_param REMOTE_PORT $remote_port;
Expand Down
4 changes: 2 additions & 2 deletions src/core/nginx.h
Expand Up @@ -8,8 +8,8 @@
#define _NGINX_H_INCLUDED_ #define _NGINX_H_INCLUDED_




#define nginx_version 1001010 #define nginx_version 1001011
#define NGINX_VERSION "1.1.10" #define NGINX_VERSION "1.1.11"
#define NGINX_VER "nginx/" NGINX_VERSION #define NGINX_VER "nginx/" NGINX_VERSION


#define NGINX_VAR "NGINX" #define NGINX_VAR "NGINX"
Expand Down
51 changes: 51 additions & 0 deletions src/core/ngx_connection.c
Expand Up @@ -462,6 +462,7 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle)
void void
ngx_configure_listening_sockets(ngx_cycle_t *cycle) ngx_configure_listening_sockets(ngx_cycle_t *cycle)
{ {
int keepalive;
ngx_uint_t i; ngx_uint_t i;
ngx_listening_t *ls; ngx_listening_t *ls;


Expand Down Expand Up @@ -499,6 +500,56 @@ ngx_configure_listening_sockets(ngx_cycle_t *cycle)
} }
} }


if (ls[i].keepalive) {
keepalive = (ls[i].keepalive == 1) ? 1 : 0;

if (setsockopt(ls[i].fd, SOL_SOCKET, SO_KEEPALIVE,
(const void *) &keepalive, sizeof(int))
== -1)
{
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
"setsockopt(SO_KEEPALIVE, %d) %V failed, ignored",
keepalive, &ls[i].addr_text);
}
}

#if (NGX_HAVE_KEEPALIVE_TUNABLE)

if (ls[i].keepidle) {
if (setsockopt(ls[i].fd, IPPROTO_TCP, TCP_KEEPIDLE,
(const void *) &ls[i].keepidle, sizeof(int))
== -1)
{
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
"setsockopt(TCP_KEEPIDLE, %d) %V failed, ignored",
ls[i].keepidle, &ls[i].addr_text);
}
}

if (ls[i].keepintvl) {
if (setsockopt(ls[i].fd, IPPROTO_TCP, TCP_KEEPINTVL,
(const void *) &ls[i].keepintvl, sizeof(int))
== -1)
{
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
"setsockopt(TCP_KEEPINTVL, %d) %V failed, ignored",
ls[i].keepintvl, &ls[i].addr_text);
}
}

if (ls[i].keepcnt) {
if (setsockopt(ls[i].fd, IPPROTO_TCP, TCP_KEEPCNT,
(const void *) &ls[i].keepcnt, sizeof(int))
== -1)
{
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
"setsockopt(TCP_KEEPCNT, %d) %V failed, ignored",
ls[i].keepcnt, &ls[i].addr_text);
}
}

#endif

#if (NGX_HAVE_SETFIB) #if (NGX_HAVE_SETFIB)
if (ls[i].setfib != -1) { if (ls[i].setfib != -1) {
if (setsockopt(ls[i].fd, SOL_SOCKET, SO_SETFIB, if (setsockopt(ls[i].fd, SOL_SOCKET, SO_SETFIB,
Expand Down
6 changes: 6 additions & 0 deletions src/core/ngx_connection.h
Expand Up @@ -27,6 +27,11 @@ struct ngx_listening_s {
int backlog; int backlog;
int rcvbuf; int rcvbuf;
int sndbuf; int sndbuf;
#if (NGX_HAVE_KEEPALIVE_TUNABLE)
int keepidle;
int keepintvl;
int keepcnt;
#endif


/* handler of accepted connection */ /* handler of accepted connection */
ngx_connection_handler_pt handler; ngx_connection_handler_pt handler;
Expand Down Expand Up @@ -60,6 +65,7 @@ struct ngx_listening_s {
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY) #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
unsigned ipv6only:2; unsigned ipv6only:2;
#endif #endif
unsigned keepalive:2;


#if (NGX_HAVE_DEFERRED_ACCEPT) #if (NGX_HAVE_DEFERRED_ACCEPT)
unsigned deferred_accept:1; unsigned deferred_accept:1;
Expand Down
17 changes: 0 additions & 17 deletions src/core/ngx_regex.c
Expand Up @@ -136,23 +136,6 @@ ngx_regex_compile(ngx_regex_compile_t *rc)
} }




ngx_int_t
ngx_regex_capture_count(ngx_regex_t *re)
{
int rc, n;

n = 0;

rc = pcre_fullinfo(re, NULL, PCRE_INFO_CAPTURECOUNT, &n);

if (rc < 0) {
return (ngx_int_t) rc;
}

return (ngx_int_t) n;
}


ngx_int_t ngx_int_t
ngx_regex_exec_array(ngx_array_t *a, ngx_str_t *s, ngx_log_t *log) ngx_regex_exec_array(ngx_array_t *a, ngx_str_t *s, ngx_log_t *log)
{ {
Expand Down
51 changes: 44 additions & 7 deletions src/http/modules/ngx_http_fastcgi_module.c
Expand Up @@ -411,8 +411,8 @@ static ngx_command_t ngx_http_fastcgi_commands[] = {
&ngx_http_fastcgi_next_upstream_masks }, &ngx_http_fastcgi_next_upstream_masks },


{ ngx_string("fastcgi_param"), { ngx_string("fastcgi_param"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2, NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE23,
ngx_conf_set_keyval_slot, ngx_http_upstream_param_set_slot,
NGX_HTTP_LOC_CONF_OFFSET, NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_fastcgi_loc_conf_t, params_source), offsetof(ngx_http_fastcgi_loc_conf_t, params_source),
NULL }, NULL },
Expand Down Expand Up @@ -708,7 +708,7 @@ ngx_http_fastcgi_create_request(ngx_http_request_t *r)
u_char ch, *pos, *lowcase_key; u_char ch, *pos, *lowcase_key;
size_t size, len, key_len, val_len, padding, size_t size, len, key_len, val_len, padding,
allocated; allocated;
ngx_uint_t i, n, next, hash, header_params; ngx_uint_t i, n, next, hash, skip_empty, header_params;
ngx_buf_t *b; ngx_buf_t *b;
ngx_chain_t *cl, *body; ngx_chain_t *cl, *body;
ngx_list_part_t *part; ngx_list_part_t *part;
Expand Down Expand Up @@ -739,11 +739,18 @@ ngx_http_fastcgi_create_request(ngx_http_request_t *r)
lcode = *(ngx_http_script_len_code_pt *) le.ip; lcode = *(ngx_http_script_len_code_pt *) le.ip;
key_len = lcode(&le); key_len = lcode(&le);


lcode = *(ngx_http_script_len_code_pt *) le.ip;
skip_empty = lcode(&le);

for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode(&le)) { for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode(&le)) {
lcode = *(ngx_http_script_len_code_pt *) le.ip; lcode = *(ngx_http_script_len_code_pt *) le.ip;
} }
le.ip += sizeof(uintptr_t); le.ip += sizeof(uintptr_t);


if (skip_empty && val_len == 0) {
continue;
}

len += 1 + key_len + ((val_len > 127) ? 4 : 1) + val_len; len += 1 + key_len + ((val_len > 127) ? 4 : 1) + val_len;
} }
} }
Expand Down Expand Up @@ -893,11 +900,28 @@ ngx_http_fastcgi_create_request(ngx_http_request_t *r)
lcode = *(ngx_http_script_len_code_pt *) le.ip; lcode = *(ngx_http_script_len_code_pt *) le.ip;
key_len = (u_char) lcode(&le); key_len = (u_char) lcode(&le);


lcode = *(ngx_http_script_len_code_pt *) le.ip;
skip_empty = lcode(&le);

for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode(&le)) { for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode(&le)) {
lcode = *(ngx_http_script_len_code_pt *) le.ip; lcode = *(ngx_http_script_len_code_pt *) le.ip;
} }
le.ip += sizeof(uintptr_t); le.ip += sizeof(uintptr_t);


if (skip_empty && val_len == 0) {
e.skip = 1;

while (*(uintptr_t *) e.ip) {
code = *(ngx_http_script_code_pt *) e.ip;
code((ngx_http_script_engine_t *) &e);
}
e.ip += sizeof(uintptr_t);

e.skip = 0;

continue;
}

*e.pos++ = (u_char) key_len; *e.pos++ = (u_char) key_len;


if (val_len > 127) { if (val_len > 127) {
Expand Down Expand Up @@ -2370,9 +2394,9 @@ ngx_http_fastcgi_merge_params(ngx_conf_t *cf,
#if (NGX_HTTP_CACHE) #if (NGX_HTTP_CACHE)
ngx_array_t params_merged; ngx_array_t params_merged;
#endif #endif
ngx_keyval_t *src;
ngx_hash_key_t *hk; ngx_hash_key_t *hk;
ngx_hash_init_t hash; ngx_hash_init_t hash;
ngx_http_upstream_param_t *src;
ngx_http_script_compile_t sc; ngx_http_script_compile_t sc;
ngx_http_script_copy_code_t *copy; ngx_http_script_copy_code_t *copy;


Expand Down Expand Up @@ -2433,9 +2457,11 @@ ngx_http_fastcgi_merge_params(ngx_conf_t *cf,
#if (NGX_HTTP_CACHE) #if (NGX_HTTP_CACHE)


if (conf->upstream.cache) { if (conf->upstream.cache) {
ngx_keyval_t *h, *s; ngx_keyval_t *h;
ngx_http_upstream_param_t *s;


if (ngx_array_init(&params_merged, cf->temp_pool, 4, sizeof(ngx_keyval_t)) if (ngx_array_init(&params_merged, cf->temp_pool, 4,
sizeof(ngx_http_upstream_param_t))
!= NGX_OK) != NGX_OK)
{ {
return NGX_ERROR; return NGX_ERROR;
Expand Down Expand Up @@ -2469,7 +2495,9 @@ ngx_http_fastcgi_merge_params(ngx_conf_t *cf,
return NGX_ERROR; return NGX_ERROR;
} }


*s = *h; s->key = h->key;
s->value = h->value;
s->skip_empty = 0;


next: next:


Expand Down Expand Up @@ -2511,6 +2539,15 @@ ngx_http_fastcgi_merge_params(ngx_conf_t *cf,
copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code; copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
copy->len = src[i].key.len; copy->len = src[i].key.len;


copy = ngx_array_push_n(conf->params_len,
sizeof(ngx_http_script_copy_code_t));
if (copy == NULL) {
return NGX_ERROR;
}

copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
copy->len = src[i].skip_empty;



size = (sizeof(ngx_http_script_copy_code_t) size = (sizeof(ngx_http_script_copy_code_t)
+ src[i].key.len + sizeof(uintptr_t) - 1) + src[i].key.len + sizeof(uintptr_t) - 1)
Expand Down
8 changes: 7 additions & 1 deletion src/http/modules/ngx_http_log_module.c
Expand Up @@ -971,7 +971,7 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)


if (buf == NGX_ERROR) { if (buf == NGX_ERROR) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"invalid parameter \"%V\"", &value[3]); "invalid buffer value \"%V\"", &name);
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }


Expand Down Expand Up @@ -1004,6 +1004,12 @@ ngx_http_log_set_format(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ngx_uint_t i; ngx_uint_t i;
ngx_http_log_fmt_t *fmt; ngx_http_log_fmt_t *fmt;


if (cf->cmd_type != NGX_HTTP_MAIN_CONF) {
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
"the \"log_format\" directive may be used "
"only on \"http\" level");
}

value = cf->args->elts; value = cf->args->elts;


fmt = lmcf->formats.elts; fmt = lmcf->formats.elts;
Expand Down

0 comments on commit 40601e3

Please sign in to comment.