diff options
author | nginx <nginx@nginx.org> | 2013-04-16 14:10:50 +0000 |
---|---|---|
committer | Jon Kolb <jon@b0g.us> | 2013-04-16 14:10:50 +0000 |
commit | 73a0d767d316125bc5b39609918d42521e14afdb (patch) | |
tree | 9aad5c43b487ca9086be58ee5aac1ae310705b94 | |
parent | 7f60909fba9adc5409a2103e276b034590fbec74 (diff) | |
download | nginx-1.3.tar.gz |
*) Bugfix: a segmentation fault might occur in a worker process if
subrequests were used; the bug had appeared in 1.3.9.
*) Bugfix: the "tcp_nodelay" directive caused an error if a WebSocket
connection was proxied into a unix domain socket.
*) Bugfix: the $upstream_response_length variable has an incorrect value
"0" if buffering was not used.
Thanks to Piotr Sikora.
*) Bugfix: in the eventport and /dev/poll methods.
-rw-r--r-- | CHANGES | 15 | ||||
-rw-r--r-- | CHANGES.ru | 15 | ||||
-rw-r--r-- | auto/lib/perl/conf | 4 | ||||
-rw-r--r-- | auto/lib/perl/make | 37 | ||||
-rw-r--r-- | src/core/nginx.h | 4 | ||||
-rw-r--r-- | src/event/modules/ngx_devpoll_module.c | 8 | ||||
-rw-r--r-- | src/event/modules/ngx_eventport_module.c | 2 | ||||
-rw-r--r-- | src/event/ngx_event_connect.c | 2 | ||||
-rw-r--r-- | src/http/modules/ngx_http_limit_req_module.c | 2 | ||||
-rw-r--r-- | src/http/modules/ngx_http_upstream_ip_hash_module.c | 5 | ||||
-rw-r--r-- | src/http/modules/ngx_http_upstream_least_conn_module.c | 5 | ||||
-rw-r--r-- | src/http/modules/perl/Makefile.PL | 6 | ||||
-rw-r--r-- | src/http/modules/perl/nginx.pm | 2 | ||||
-rw-r--r-- | src/http/ngx_http_core_module.c | 2 | ||||
-rw-r--r-- | src/http/ngx_http_request_body.c | 2 | ||||
-rw-r--r-- | src/http/ngx_http_upstream.c | 60 |
16 files changed, 112 insertions, 59 deletions
@@ -1,4 +1,19 @@ +Changes with nginx 1.3.16 16 Apr 2013 + + *) Bugfix: a segmentation fault might occur in a worker process if + subrequests were used; the bug had appeared in 1.3.9. + + *) Bugfix: the "tcp_nodelay" directive caused an error if a WebSocket + connection was proxied into a unix domain socket. + + *) Bugfix: the $upstream_response_length variable has an incorrect value + "0" if buffering was not used. + Thanks to Piotr Sikora. + + *) Bugfix: in the eventport and /dev/poll methods. + + Changes with nginx 1.3.15 26 Mar 2013 *) Change: opening and closing a connection without sending any data in diff --git a/CHANGES.ru b/CHANGES.ru index c241a055c..62125c847 100644 --- a/CHANGES.ru +++ b/CHANGES.ru @@ -1,4 +1,19 @@ +Изменения в nginx 1.3.16 16.04.2013 + + *) Исправление: в рабочем процессе мог произойти segmentation fault, + если использовались подзапросы; ошибка появилась в 1.3.9. + + *) Исправление: директива tcp_nodelay вызывала ошибку при проксировании + WebSocket-соединений в unix domain сокет. + + *) Исправление: переменная $upstream_response_length возвращала значение + "0", если не использовалась буферизация. + Спасибо Piotr Sikora. + + *) Исправление: в методах обработки соединений eventport и /dev/poll. + + Изменения в nginx 1.3.15 26.03.2013 *) Изменение: открытие и закрытие соединения без отправки в нём diff --git a/auto/lib/perl/conf b/auto/lib/perl/conf index 5ce6c91e6..2fbaa76b7 100644 --- a/auto/lib/perl/conf +++ b/auto/lib/perl/conf @@ -40,6 +40,8 @@ if test -n "$NGX_PERL_VER"; then ngx_perl_ldopts=`$NGX_PERL -MExtUtils::Embed -e ldopts` + ngx_perl_dlext=`$NGX_PERL -MConfig -e 'print $Config{dlext}'` + if $NGX_PERL -V:usemultiplicity | grep define > /dev/null; then have=NGX_HAVE_PERL_MULTIPLICITY . auto/have echo " + perl interpreter multiplicity found" @@ -51,7 +53,7 @@ if test -n "$NGX_PERL_VER"; then fi CORE_LINK="$CORE_LINK $ngx_perl_ldopts" - LINK_DEPS="$LINK_DEPS $NGX_OBJS/src/http/modules/perl/blib/arch/auto/nginx/nginx.so" + LINK_DEPS="$LINK_DEPS $NGX_OBJS/src/http/modules/perl/blib/arch/auto/nginx/nginx.$ngx_perl_dlext" if test -n "$NGX_PERL_MODULES"; then have=NGX_PERL_MODULES value="(u_char *) \"$NGX_PERL_MODULES\"" diff --git a/auto/lib/perl/make b/auto/lib/perl/make index b40352abf..9c5e826e8 100644 --- a/auto/lib/perl/make +++ b/auto/lib/perl/make @@ -3,33 +3,38 @@ # Copyright (C) Nginx, Inc. +v=`grep 'define NGINX_VERSION' src/core/nginx.h | sed -e 's/^.*"\(.*\)".*/\1/'` + + cat << END >> $NGX_MAKEFILE -$NGX_OBJS/src/http/modules/perl/blib/arch/auto/nginx/nginx.so: \ - \$(CORE_DEPS) \$(HTTP_DEPS) \ - src/http/modules/perl/nginx.pm \ - src/http/modules/perl/nginx.xs \ - src/http/modules/perl/ngx_http_perl_module.h \ +$NGX_OBJS/src/http/modules/perl/blib/arch/auto/nginx/nginx.$ngx_perl_dlext: \\ + \$(CORE_DEPS) \$(HTTP_DEPS) \\ + src/http/modules/perl/ngx_http_perl_module.h \\ $NGX_OBJS/src/http/modules/perl/Makefile - cp src/http/modules/perl/nginx.* $NGX_OBJS/src/http/modules/perl/ - cd $NGX_OBJS/src/http/modules/perl && \$(MAKE) rm -rf $NGX_OBJS/install_perl -$NGX_OBJS/src/http/modules/perl/Makefile: \ - src/http/modules/perl/Makefile.PL \ - src/http/modules/perl/nginx.pm - cp -p src/http/modules/perl/nginx.* $NGX_OBJS/src/http/modules/perl/ +$NGX_OBJS/src/http/modules/perl/Makefile: \\ + src/core/nginx.h \\ + src/http/modules/perl/Makefile.PL \\ + src/http/modules/perl/nginx.pm \\ + src/http/modules/perl/nginx.xs \\ + src/http/modules/perl/typemap + sed "s/%%VERSION%%/$v/" src/http/modules/perl/nginx.pm > \\ + $NGX_OBJS/src/http/modules/perl/nginx.pm + cp -p src/http/modules/perl/nginx.xs $NGX_OBJS/src/http/modules/perl/ cp -p src/http/modules/perl/typemap $NGX_OBJS/src/http/modules/perl/ cp -p src/http/modules/perl/Makefile.PL $NGX_OBJS/src/http/modules/perl/ - cd $NGX_OBJS/src/http/modules/perl \ - && NGX_PM_CFLAGS="\$(NGX_PM_CFLAGS) -g $NGX_CC_OPT" \ - NGX_INCS="$CORE_INCS $NGX_OBJS $HTTP_INCS" \ - $NGX_PERL Makefile.PL \ - LIB=$NGX_PERL_MODULES \ + cd $NGX_OBJS/src/http/modules/perl \\ + && NGX_PM_CFLAGS="\$(NGX_PM_CFLAGS) -g $NGX_CC_OPT" \\ + NGX_INCS="\$(CORE_INCS) \$(HTTP_INCS)" \\ + NGX_DEPS="\$(CORE_DEPS) \$(HTTP_DEPS)" \\ + $NGX_PERL Makefile.PL \\ + LIB=$NGX_PERL_MODULES \\ INSTALLSITEMAN3DIR=$NGX_PERL_MODULES_MAN END diff --git a/src/core/nginx.h b/src/core/nginx.h index 7599a6898..d6b53c876 100644 --- a/src/core/nginx.h +++ b/src/core/nginx.h @@ -9,8 +9,8 @@ #define _NGINX_H_INCLUDED_ -#define nginx_version 1003015 -#define NGINX_VERSION "1.3.15" +#define nginx_version 1003016 +#define NGINX_VERSION "1.3.16" #define NGINX_VER "nginx/" NGINX_VERSION #define NGINX_VAR "NGINX" diff --git a/src/event/modules/ngx_devpoll_module.c b/src/event/modules/ngx_devpoll_module.c index d09b5bc07..6fdd00233 100644 --- a/src/event/modules/ngx_devpoll_module.c +++ b/src/event/modules/ngx_devpoll_module.c @@ -343,7 +343,7 @@ ngx_devpoll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, ngx_fd_t fd; ngx_err_t err; ngx_int_t i; - ngx_uint_t level; + ngx_uint_t level, instance; ngx_event_t *rev, *wev, **queue; ngx_connection_t *c; struct pollfd pfd; @@ -510,7 +510,13 @@ ngx_devpoll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, ngx_locked_post_event(rev, queue); } else { + instance = rev->instance; + rev->handler(rev); + + if (c->fd == -1 || rev->instance != instance) { + continue; + } } } diff --git a/src/event/modules/ngx_eventport_module.c b/src/event/modules/ngx_eventport_module.c index d6dcb0bed..5f9cf4e35 100644 --- a/src/event/modules/ngx_eventport_module.c +++ b/src/event/modules/ngx_eventport_module.c @@ -551,7 +551,7 @@ ngx_eventport_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, } else { rev->handler(rev); - if (ev->closed) { + if (ev->closed || ev->instance != instance) { continue; } } diff --git a/src/event/ngx_event_connect.c b/src/event/ngx_event_connect.c index 978f39b42..e6ae6564e 100644 --- a/src/event/ngx_event_connect.c +++ b/src/event/ngx_event_connect.c @@ -84,7 +84,7 @@ ngx_event_connect_peer(ngx_peer_connection_t *pc) c->log_error = pc->log_error; - if (pc->sockaddr->sa_family != AF_INET) { + if (pc->sockaddr->sa_family == AF_UNIX) { c->tcp_nopush = NGX_TCP_NOPUSH_DISABLED; c->tcp_nodelay = NGX_TCP_NODELAY_DISABLED; diff --git a/src/http/modules/ngx_http_limit_req_module.c b/src/http/modules/ngx_http_limit_req_module.c index 934292e7f..90434c956 100644 --- a/src/http/modules/ngx_http_limit_req_module.c +++ b/src/http/modules/ngx_http_limit_req_module.c @@ -795,7 +795,7 @@ ngx_http_limit_req_zone(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) } rate = ngx_atoi(value[i].data + 5, len - 5); - if (rate <= NGX_ERROR) { + if (rate <= 0) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid rate \"%V\"", &value[i]); return NGX_CONF_ERROR; diff --git a/src/http/modules/ngx_http_upstream_ip_hash_module.c b/src/http/modules/ngx_http_upstream_ip_hash_module.c index 89ccc2b85..29c74fd54 100644 --- a/src/http/modules/ngx_http_upstream_ip_hash_module.c +++ b/src/http/modules/ngx_http_upstream_ip_hash_module.c @@ -252,6 +252,11 @@ ngx_http_upstream_ip_hash(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) uscf = ngx_http_conf_get_module_srv_conf(cf, ngx_http_upstream_module); + if (uscf->peer.init_upstream) { + ngx_conf_log_error(NGX_LOG_WARN, cf, 0, + "load balancing method redefined"); + } + uscf->peer.init_upstream = ngx_http_upstream_init_ip_hash; uscf->flags = NGX_HTTP_UPSTREAM_CREATE diff --git a/src/http/modules/ngx_http_upstream_least_conn_module.c b/src/http/modules/ngx_http_upstream_least_conn_module.c index 6066ed2bb..87c4d8d61 100644 --- a/src/http/modules/ngx_http_upstream_least_conn_module.c +++ b/src/http/modules/ngx_http_upstream_least_conn_module.c @@ -387,6 +387,11 @@ ngx_http_upstream_least_conn(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) uscf = ngx_http_conf_get_module_srv_conf(cf, ngx_http_upstream_module); + if (uscf->peer.init_upstream) { + ngx_conf_log_error(NGX_LOG_WARN, cf, 0, + "load balancing method redefined"); + } + uscf->peer.init_upstream = ngx_http_upstream_init_least_conn; uscf->flags = NGX_HTTP_UPSTREAM_CREATE diff --git a/src/http/modules/perl/Makefile.PL b/src/http/modules/perl/Makefile.PL index 78a1e516b..ff8b2c634 100644 --- a/src/http/modules/perl/Makefile.PL +++ b/src/http/modules/perl/Makefile.PL @@ -21,8 +21,10 @@ WriteMakefile( } (split /\s+/, $ENV{NGX_INCS})), depend => { - 'nginx.c' => - "../../../../../src/http/modules/perl/ngx_http_perl_module.h" + 'nginx.c' => join(" ", map { + "../../../../../$_" + } (split(/\s+/, $ENV{NGX_DEPS}), + "src/http/modules/perl/ngx_http_perl_module.h")) }, PM => { diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm index 435199d3a..e3f736110 100644 --- a/src/http/modules/perl/nginx.pm +++ b/src/http/modules/perl/nginx.pm @@ -50,7 +50,7 @@ our @EXPORT = qw( HTTP_INSUFFICIENT_STORAGE ); -our $VERSION = '1.3.15'; +our $VERSION = '%%VERSION%%'; require XSLoader; XSLoader::load('nginx', $VERSION); diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index 80cf2d6b9..25d3dc97d 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -3256,7 +3256,7 @@ ngx_http_core_regex_location(ngx_conf_t *cf, ngx_http_core_loc_conf_t *clcf, #if (NGX_HAVE_CASELESS_FILESYSTEM) rc.options = NGX_REGEX_CASELESS; #else - rc.options = caseless; + rc.options = caseless ? NGX_REGEX_CASELESS : 0; #endif clcf->regex = ngx_http_regex_compile(cf, &rc); diff --git a/src/http/ngx_http_request_body.c b/src/http/ngx_http_request_body.c index 4e7b30257..2c612311d 100644 --- a/src/http/ngx_http_request_body.c +++ b/src/http/ngx_http_request_body.c @@ -49,7 +49,7 @@ ngx_http_read_client_request_body(ngx_http_request_t *r, } #endif - if (r->request_body || r->discard_body) { + if (r != r->main || r->request_body || r->discard_body) { post_handler(r); return NGX_OK; } diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index 61996cb60..45e2eb7b9 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -2413,32 +2413,39 @@ ngx_http_upstream_upgrade(ngx_http_request_t *r, ngx_http_upstream_t *u) r->read_event_handler = ngx_http_upstream_upgraded_read_downstream; r->write_event_handler = ngx_http_upstream_upgraded_write_downstream; - if (clcf->tcp_nodelay && c->tcp_nodelay == NGX_TCP_NODELAY_UNSET) { - ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "tcp_nodelay"); - + if (clcf->tcp_nodelay) { tcp_nodelay = 1; - if (setsockopt(c->fd, IPPROTO_TCP, TCP_NODELAY, - (const void *) &tcp_nodelay, sizeof(int)) == -1) - { - ngx_connection_error(c, ngx_socket_errno, - "setsockopt(TCP_NODELAY) failed"); - ngx_http_upstream_finalize_request(r, u, 0); - return; - } + if (c->tcp_nodelay == NGX_TCP_NODELAY_UNSET) { + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "tcp_nodelay"); - c->tcp_nodelay = NGX_TCP_NODELAY_SET; + if (setsockopt(c->fd, IPPROTO_TCP, TCP_NODELAY, + (const void *) &tcp_nodelay, sizeof(int)) == -1) + { + ngx_connection_error(c, ngx_socket_errno, + "setsockopt(TCP_NODELAY) failed"); + ngx_http_upstream_finalize_request(r, u, 0); + return; + } - if (setsockopt(u->peer.connection->fd, IPPROTO_TCP, TCP_NODELAY, - (const void *) &tcp_nodelay, sizeof(int)) == -1) - { - ngx_connection_error(u->peer.connection, ngx_socket_errno, - "setsockopt(TCP_NODELAY) failed"); - ngx_http_upstream_finalize_request(r, u, 0); - return; + c->tcp_nodelay = NGX_TCP_NODELAY_SET; } - u->peer.connection->tcp_nodelay = NGX_TCP_NODELAY_SET; + if (u->peer.connection->tcp_nodelay == NGX_TCP_NODELAY_UNSET) { + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, u->peer.connection->log, 0, + "tcp_nodelay"); + + if (setsockopt(u->peer.connection->fd, IPPROTO_TCP, TCP_NODELAY, + (const void *) &tcp_nodelay, sizeof(int)) == -1) + { + ngx_connection_error(u->peer.connection, ngx_socket_errno, + "setsockopt(TCP_NODELAY) failed"); + ngx_http_upstream_finalize_request(r, u, 0); + return; + } + + u->peer.connection->tcp_nodelay = NGX_TCP_NODELAY_SET; + } } if (ngx_http_send_special(r, NGX_HTTP_FLUSH) == NGX_ERROR) { @@ -3269,19 +3276,10 @@ ngx_http_upstream_cleanup(void *data) { ngx_http_request_t *r = data; - ngx_http_upstream_t *u; - ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "cleanup http upstream request: \"%V\"", &r->uri); - u = r->upstream; - - if (u->resolved && u->resolved->ctx) { - ngx_resolve_name_done(u->resolved->ctx); - u->resolved->ctx = NULL; - } - - ngx_http_upstream_finalize_request(r, u, NGX_DONE); + ngx_http_upstream_finalize_request(r, r->upstream, NGX_DONE); } @@ -3309,7 +3307,7 @@ ngx_http_upstream_finalize_request(ngx_http_request_t *r, u->state->response_sec = tp->sec - u->state->response_sec; u->state->response_msec = tp->msec - u->state->response_msec; - if (u->pipe) { + if (u->pipe && u->pipe->read_length) { u->state->response_length = u->pipe->read_length; } } |