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 /src/http | |
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.
Diffstat (limited to 'src/http')
-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 |
8 files changed, 47 insertions, 37 deletions
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; } } |