changeset 80:6ae11d59d10e NGINX_0_1_40

nginx 0.1.40 *) Bugfix: if a client sent too long header line, then the request information did not logged in the error log. *) Bugfix: the "Set-Cookie" header line was not transferred when the "X-Accel-Redirect" was used; bug appeared in 0.1.39. *) Bugfix: the "Content-Disposition" header line was not transferred when the "X-Accel-Redirect" was used. *) Bugfix: the master process did not close the listen socket on the SIGQUIT signal. *) Bugfix: after on-line upgrade on Linux and Solaris the process name became shorter in the "ps" command.
author Igor Sysoev <http://sysoev.ru>
date Fri, 22 Jul 2005 00:00:00 +0400
parents b7cf468d0667
children 4e854e6d1986
files CHANGES CHANGES.ru src/core/nginx.h src/http/ngx_http.h src/http/ngx_http_core_module.c src/http/ngx_http_request.c src/http/ngx_http_upstream.c src/imap/ngx_imap_proxy_module.c src/os/unix/ngx_freebsd_init.c src/os/unix/ngx_linux_init.c src/os/unix/ngx_posix_init.c src/os/unix/ngx_process.h src/os/unix/ngx_process_cycle.c src/os/unix/ngx_setproctitle.c src/os/unix/ngx_solaris_init.c
diffstat 15 files changed, 90 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,21 @@
+
+Changes with nginx 0.1.40                                        22 Jul 2005
+
+    *) Bugfix: if a client sent too long header line, then the request 
+       information did not logged in the error log.
+
+    *) Bugfix: the "Set-Cookie" header line was not transferred when the 
+       "X-Accel-Redirect" was used; bug appeared in 0.1.39.
+
+    *) Bugfix: the "Content-Disposition" header line was not transferred 
+       when the "X-Accel-Redirect" was used.
+
+    *) Bugfix: the master process did not close the listen socket on the 
+       SIGQUIT signal.
+
+    *) Bugfix: after on-line upgrade on Linux and Solaris the process name 
+       became shorter in the "ps" command.
+
 
 Changes with nginx 0.1.39                                        14 Jul 2005
 
--- a/CHANGES.ru
+++ b/CHANGES.ru
@@ -1,3 +1,21 @@
+
+Изменения в nginx 0.1.40                                          22.07.2005
+
+    *) Исправление: если клиент слал очень длинную строку заголовка, то в 
+       логе не помещалась информация, связанная с этим запросом.
+
+    *) Исправление: при использовании "X-Accel-Redirect" не передавалась 
+       строка "Set-Cookie"; ошибка появилась в 0.1.39.
+
+    *) Исправление: при использовании "X-Accel-Redirect" не передавалась 
+       строка "Content-Disposition".
+
+    *) Исправление: по сигналу SIGQUIT основной процесс не закрывал сокеты, 
+       на которых он слушал.
+
+    *) Исправление: после обновления исполняемого файла на лету на Linux и 
+       Solaris название процесса в команде ps становилось короче.
+
 
 Изменения в nginx 0.1.39                                          14.07.2005
 
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VER          "nginx/0.1.39"
+#define NGINX_VER          "nginx/0.1.40"
 
 #define NGINX_VAR          "NGINX"
 #define NGX_NEWPID_EXT     ".newbin"
--- a/src/http/ngx_http.h
+++ b/src/http/ngx_http.h
@@ -74,8 +74,6 @@ void ngx_http_empty_handler(ngx_event_t 
 void ngx_http_request_empty_handler(ngx_http_request_t *r);
 
 ngx_int_t ngx_http_send_last(ngx_http_request_t *r);
-void ngx_http_close_request(ngx_http_request_t *r, ngx_int_t error);
-void ngx_http_close_connection(ngx_connection_t *c);
 u_char * ngx_http_log_error_info(ngx_http_request_t *r, u_char *buf,
     size_t len);
 
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -886,18 +886,6 @@ ngx_http_output_filter(ngx_http_request_
 
 
 ngx_int_t
-ngx_http_redirect(ngx_http_request_t *r, int redirect)
-{
-    /* STUB */
-
-    /* log request */
-
-    ngx_http_close_request(r, 0);
-    return NGX_OK;
-}
-
-
-ngx_int_t
 ngx_http_set_exten(ngx_http_request_t *r)
 {
     ngx_int_t  i;
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -43,6 +43,8 @@ static void ngx_http_set_keepalive(ngx_h
 static void ngx_http_keepalive_handler(ngx_event_t *ev);
 static void ngx_http_set_lingering_close(ngx_http_request_t *r);
 static void ngx_http_lingering_close_handler(ngx_event_t *ev);
+static void ngx_http_close_request(ngx_http_request_t *r, ngx_int_t error);
+static void ngx_http_close_connection(ngx_connection_t *c);
 
 static u_char *ngx_http_log_error(ngx_log_t *log, u_char *buf, size_t len);
 static u_char *ngx_http_log_error_handler(ngx_http_request_t *r, u_char *buf,
@@ -756,6 +758,14 @@ ngx_http_process_request_headers(ngx_eve
                 if (rv == NGX_DECLINED) {
                     header.len = r->header_in->end - r->header_name_start;
                     header.data = r->header_name_start;
+
+                    if (header.len > NGX_MAX_ERROR_STR - 300) {
+                        header.len = NGX_MAX_ERROR_STR - 300;
+                        header.data[header.len++] = '.';
+                        header.data[header.len++] = '.';
+                        header.data[header.len++] = '.';
+                    }
+
                     ngx_log_error(NGX_LOG_INFO, c->log, 0,
                                   "client sent too long header line: \"%V\"",
                                   &header);
@@ -2340,8 +2350,7 @@ ngx_http_close_request(ngx_http_request_
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, log, 0, "http close request");
 
     if (r->pool == NULL) {
-        ngx_log_error(NGX_LOG_ALERT, log, 0,
-                      "http request already closed");
+        ngx_log_error(NGX_LOG_ALERT, log, 0, "http request already closed");
         return;
     }
 
@@ -2389,8 +2398,8 @@ ngx_http_close_request(ngx_http_request_
 
 #if (NGX_HTTP_SSL)
 
-void
-ngx_ssl_close_handler(ngx_event_t *ev)
+static void
+ngx_http_ssl_close_handler(ngx_event_t *ev)
 {
     ngx_connection_t  *c;
 
@@ -2408,7 +2417,7 @@ ngx_ssl_close_handler(ngx_event_t *ev)
 #endif
 
 
-void
+static void
 ngx_http_close_connection(ngx_connection_t *c)
 {
     ngx_pool_t  *pool;
@@ -2420,8 +2429,8 @@ ngx_http_close_connection(ngx_connection
 
     if (c->ssl) {
         if (ngx_ssl_shutdown(c) == NGX_AGAIN) {
-            c->read->handler = ngx_ssl_close_handler;
-            c->write->handler = ngx_ssl_close_handler;
+            c->read->handler = ngx_http_ssl_close_handler;
+            c->write->handler = ngx_http_ssl_close_handler;
             return;
         }
     }
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -118,7 +118,11 @@ ngx_http_upstream_header_t  ngx_http_ups
 
     { ngx_string("Set-Cookie"),
                  ngx_http_upstream_ignore_header_line, 0,
-                 ngx_http_upstream_copy_header_line, 0, 0 },
+                 ngx_http_upstream_copy_header_line, 0, 1 },
+
+    { ngx_string("Content-Disposition"),
+                 ngx_http_upstream_ignore_header_line, 0,
+                 ngx_http_upstream_copy_header_line, 0, 1 },
 
     { ngx_string("Cache-Control"),
                  ngx_http_upstream_process_multi_header_lines,
@@ -221,14 +225,13 @@ ngx_http_upstream_init(ngx_http_request_
     }
 
     r->read_event_handler = ngx_http_upstream_rd_check_broken_connection;
+    r->write_event_handler = ngx_http_upstream_wr_check_broken_connection;
     
     if (ngx_event_flags & NGX_USE_CLEAR_EVENT) {
-    
-        r->write_event_handler = ngx_http_upstream_wr_check_broken_connection;
 
         if (!c->write->active) {
-            if (ngx_add_event(c->write, NGX_WRITE_EVENT,
-                                                NGX_CLEAR_EVENT) == NGX_ERROR)
+            if (ngx_add_event(c->write, NGX_WRITE_EVENT, NGX_CLEAR_EVENT)
+                == NGX_ERROR)
             {
                 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
                 return;
--- a/src/imap/ngx_imap_proxy_module.c
+++ b/src/imap/ngx_imap_proxy_module.c
@@ -264,6 +264,8 @@ ngx_imap_proxy_imap_handler(ngx_event_t 
         s->connection->write->handler = ngx_imap_proxy_handler;
         rev->handler = ngx_imap_proxy_handler;
         c->write->handler = ngx_imap_proxy_handler;
+
+        ngx_del_timer(c->read);
     }
 }
 
@@ -384,6 +386,8 @@ ngx_imap_proxy_pop3_handler(ngx_event_t 
         s->connection->write->handler = ngx_imap_proxy_handler;
         rev->handler = ngx_imap_proxy_handler;
         c->write->handler = ngx_imap_proxy_handler;
+
+        ngx_del_timer(c->read);
     }
 }
 
--- a/src/os/unix/ngx_freebsd_init.c
+++ b/src/os/unix/ngx_freebsd_init.c
@@ -232,22 +232,22 @@ void ngx_os_status(ngx_log_t *log)
 {
     ngx_uint_t  i;
 
-    ngx_log_error(NGX_LOG_INFO, log, 0, "OS: %s %s",
+    ngx_log_error(NGX_LOG_NOTICE, log, 0, "OS: %s %s",
                   ngx_freebsd_kern_ostype, ngx_freebsd_kern_osrelease);
 
 #ifdef __DragonFly_version
-    ngx_log_error(NGX_LOG_INFO, log, 0,
+    ngx_log_error(NGX_LOG_NOTICE, log, 0,
                   "kern.osreldate: %d, built on %d",
                   ngx_freebsd_kern_osreldate, __DragonFly_version);
 #else
-    ngx_log_error(NGX_LOG_INFO, log, 0,
+    ngx_log_error(NGX_LOG_NOTICE, log, 0,
                   "kern.osreldate: %d, built on %d",
                   ngx_freebsd_kern_osreldate, __FreeBSD_version);
 #endif
 
     for (i = 0; sysctls[i].name; i++) {
         if (sysctls[i].exists) {
-            ngx_log_error(NGX_LOG_INFO, log, 0, "%s: %d",
+            ngx_log_error(NGX_LOG_NOTICE, log, 0, "%s: %d",
                           sysctls[i].name, *sysctls[i].value);
         }
     }
--- a/src/os/unix/ngx_linux_init.c
+++ b/src/os/unix/ngx_linux_init.c
@@ -81,10 +81,10 @@ ngx_os_init(ngx_log_t *log)
 void
 ngx_os_status(ngx_log_t *log)
 {
-    ngx_log_error(NGX_LOG_INFO, log, 0, "OS: %s %s",
+    ngx_log_error(NGX_LOG_NOTICE, log, 0, "OS: %s %s",
                   ngx_linux_kern_ostype, ngx_linux_kern_osrelease);
 
-    ngx_log_error(NGX_LOG_INFO, log, 0, "sysctl(KERN_RTSIGMAX): %d",
+    ngx_log_error(NGX_LOG_NOTICE, log, 0, "sysctl(KERN_RTSIGMAX): %d",
                   ngx_linux_rtsig_max);
 
 
--- a/src/os/unix/ngx_posix_init.c
+++ b/src/os/unix/ngx_posix_init.c
@@ -6,7 +6,6 @@
 
 #include <ngx_config.h>
 #include <ngx_core.h>
-#include <ngx_setproctitle.h>
 
 
 ngx_int_t   ngx_ncpu;
@@ -137,7 +136,7 @@ ngx_int_t ngx_posix_init(ngx_log_t *log)
 
 void ngx_posix_status(ngx_log_t *log)
 {
-    ngx_log_error(NGX_LOG_INFO, log, 0,
+    ngx_log_error(NGX_LOG_NOTICE, log, 0,
                   "getrlimit(RLIMIT_NOFILE): %r:%r",
                   rlmt.rlim_cur, rlmt.rlim_max);
 }
--- a/src/os/unix/ngx_process.h
+++ b/src/os/unix/ngx_process.h
@@ -8,6 +8,9 @@
 #define _NGX_PROCESS_H_INCLUDED_
 
 
+#include <ngx_setproctitle.h>
+
+
 typedef pid_t       ngx_pid_t;
 
 typedef void (*ngx_spawn_proc_pt) (ngx_cycle_t *cycle, void *data);
--- a/src/os/unix/ngx_process_cycle.c
+++ b/src/os/unix/ngx_process_cycle.c
@@ -7,7 +7,6 @@
 #include <ngx_config.h>
 #include <ngx_core.h>
 #include <ngx_event.h>
-#include <ngx_setproctitle.h>
 #include <ngx_channel.h>
 
 
@@ -69,11 +68,13 @@ ngx_master_process_cycle(ngx_cycle_t *cy
     u_char            *p;
     size_t             size;
     ngx_int_t          i;
+    ngx_uint_t         n;
     sigset_t           set;
     struct timeval     tv;
     struct itimerval   itv;
     ngx_uint_t         live;
     ngx_msec_t         delay;
+    ngx_listening_t   *ls;
     ngx_core_conf_t   *ccf;
 
     sigemptyset(&set);
@@ -179,6 +180,17 @@ ngx_master_process_cycle(ngx_cycle_t *cy
         if (ngx_quit) {
             ngx_signal_worker_processes(cycle,
                                         ngx_signal_value(NGX_SHUTDOWN_SIGNAL));
+
+            ls = cycle->listening.elts;
+            for (n = 0; n < cycle->listening.nelts; n++) {
+                if (ngx_close_socket(ls[n].fd) == -1) {
+                    ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_socket_errno,
+                                  ngx_close_socket_n " %V failed",
+                                  &ls[n].addr_text);
+                }
+            }
+            cycle->listening.nelts = 0;
+
             continue;
         }
 
--- a/src/os/unix/ngx_setproctitle.c
+++ b/src/os/unix/ngx_setproctitle.c
@@ -6,7 +6,6 @@
 
 #include <ngx_config.h>
 #include <ngx_core.h>
-#include <ngx_setproctitle.h>
 
 
 #if (NGX_SETPROCTITLE_USES_ENV)
--- a/src/os/unix/ngx_solaris_init.c
+++ b/src/os/unix/ngx_solaris_init.c
@@ -61,10 +61,10 @@ ngx_int_t ngx_os_init(ngx_log_t *log)
 void ngx_os_status(ngx_log_t *log)
 {
 
-    ngx_log_error(NGX_LOG_INFO, log, 0, "OS: %s %s",
+    ngx_log_error(NGX_LOG_NOTICE, log, 0, "OS: %s %s",
                   ngx_solaris_sysname, ngx_solaris_release);
 
-    ngx_log_error(NGX_LOG_INFO, log, 0, "version: %s",
+    ngx_log_error(NGX_LOG_NOTICE, log, 0, "version: %s",
                   ngx_solaris_version);
 
     ngx_posix_status(log);