From e5035397b01ec12f351a6a984f83091b821978cc Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Tue, 30 Aug 2005 10:55:07 +0000 Subject: nginx-0.1.43-RELEASE import *) Feature: the listen(2) backlog in the "listen" directive can be changed using the -HUP signal. *) Feature: the geo2nginx.pl script was added to contrib. *) Change: the FastCGI parameters with the empty values now are passed to a server. *) Bugfix: the segmentation fault occurred or the worker process may got caught in an endless loop if the proxied or FastCGI server sent the "Cache-Control" header line and the "expires" directive was used; in the proxied mode the the bug had appeared in 0.1.29. --- src/core/nginx.c | 6 +++--- src/core/nginx.h | 2 +- src/core/ngx_connection.c | 5 ++++- src/core/ngx_connection.h | 1 + src/core/ngx_cycle.c | 19 ++++++++++++++++--- 5 files changed, 25 insertions(+), 8 deletions(-) (limited to 'src/core') diff --git a/src/core/nginx.c b/src/core/nginx.c index d04d95499..a59e4d6f3 100644 --- a/src/core/nginx.c +++ b/src/core/nginx.c @@ -288,9 +288,9 @@ ngx_add_inherited_sockets(ngx_cycle_t *cycle) s = ngx_atoi(v, p - v); if (s == NGX_ERROR) { ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, - "invalid socket number \"%s\" in " - NGINX_VAR " environment variable, " - "ignoring the rest of the variable", v); + "invalid socket number \"%s\" in " NGINX_VAR + " environment variable, ignoring the rest" + " of the variable", v); break; } diff --git a/src/core/nginx.h b/src/core/nginx.h index 8f0a36513..d58f6086d 100644 --- a/src/core/nginx.h +++ b/src/core/nginx.h @@ -8,7 +8,7 @@ #define _NGINX_H_INCLUDED_ -#define NGINX_VER "nginx/0.1.42" +#define NGINX_VER "nginx/0.1.43" #define NGINX_VAR "NGINX" #define NGX_NEWPID_EXT ".newbin" diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c index b873db2e8..fe75264db 100644 --- a/src/core/ngx_connection.c +++ b/src/core/ngx_connection.c @@ -123,6 +123,8 @@ ngx_set_inherited_sockets(ngx_cycle_t *cycle) ntohs(sin->sin_port)) - ls[i].addr_text.data; + ls[i].backlog = -1; + #if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER) ngx_memzero(&af, sizeof(struct accept_filter_arg)); @@ -467,7 +469,8 @@ ngx_connection_error(ngx_connection_t *c, ngx_err_t err, char *text) return 0; } - if (err == NGX_ECONNRESET + if (err == 0 + || err == NGX_ECONNRESET #if !(NGX_WIN32) || err == NGX_EPIPE #endif diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h index 10a5cd587..6dd191938 100644 --- a/src/core/ngx_connection.h +++ b/src/core/ngx_connection.h @@ -45,6 +45,7 @@ typedef struct { unsigned bound:1; /* already bound */ unsigned inherited:1; /* inherited from previous process */ unsigned nonblocking_accept:1; + unsigned change_backlog:1; unsigned nonblocking:1; unsigned shared:1; /* shared between threads or processes */ unsigned addr_ntop:1; diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c index b67223a69..2c7823557 100644 --- a/src/core/ngx_cycle.c +++ b/src/core/ngx_cycle.c @@ -339,6 +339,10 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle) nls[n].remain = 1; ls[i].remain = 1; + if (ls[n].backlog != nls[i].backlog) { + nls[n].change_backlog = 1; + } + #if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER) /* @@ -405,12 +409,21 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle) failed = 1; } -#if (NGX_HAVE_DEFERRED_ACCEPT) - if (!failed) { ls = cycle->listening.elts; for (i = 0; i < cycle->listening.nelts; i++) { + if (ls[i].change_backlog) { + if (listen(ls[i].fd, ls[i].backlog) == -1) { + ngx_log_error(NGX_LOG_ALERT, log, ngx_socket_errno, + "changing the listen() backlog to %d " + "for %V failed, ignored", + &ls[i].addr_text, ls[i].backlog); + } + } + +#if (NGX_HAVE_DEFERRED_ACCEPT) + #ifdef SO_ACCEPTFILTER if (ls[i].delete_deferred) { if (setsockopt(ls[i].fd, SOL_SOCKET, SO_ACCEPTFILTER, @@ -475,10 +488,10 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle) if (ls[i].add_deferred) { ls[i].deferred_accept = 1; } +#endif #endif } } -#endif } } -- cgit v1.2.3