nginx-0.1.40-RELEASE import

    *) 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; the bug had 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.
diff --git a/src/os/unix/ngx_freebsd_init.c b/src/os/unix/ngx_freebsd_init.c
index 7defb46..ab002ae 100644
--- a/src/os/unix/ngx_freebsd_init.c
+++ b/src/os/unix/ngx_freebsd_init.c
@@ -232,22 +232,22 @@
 {
     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);
         }
     }
diff --git a/src/os/unix/ngx_linux_init.c b/src/os/unix/ngx_linux_init.c
index 6cb2449..56d9f15 100644
--- a/src/os/unix/ngx_linux_init.c
+++ b/src/os/unix/ngx_linux_init.c
@@ -81,10 +81,10 @@
 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);
 
 
diff --git a/src/os/unix/ngx_posix_init.c b/src/os/unix/ngx_posix_init.c
index a66560a..d0de5d5 100644
--- 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 @@
 
 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);
 }
diff --git a/src/os/unix/ngx_process.h b/src/os/unix/ngx_process.h
index b85c528..25bfa96 100644
--- 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);
diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c
index d3c92a1..9d05694 100644
--- 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 @@
     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 @@
         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;
         }
 
diff --git a/src/os/unix/ngx_setproctitle.c b/src/os/unix/ngx_setproctitle.c
index 8ae643d..b814610 100644
--- 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)
diff --git a/src/os/unix/ngx_solaris_init.c b/src/os/unix/ngx_solaris_init.c
index 9080eb2..163adaa 100644
--- a/src/os/unix/ngx_solaris_init.c
+++ b/src/os/unix/ngx_solaris_init.c
@@ -61,10 +61,10 @@
 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);