changeset 376:d13234035cad NGINX_0_6_32

nginx 0.6.32 *) Change: the "none" parameter in the "ssl_session_cache" directive; now this is default parameter. Thanks to Rob Mueller. *) Change: now the 0x00-0x1F, '"' and '\' characters are escaped as \xXX in an access_log. Thanks to Maxim Dounin. *) Change: now nginx allows several "Host" request header line. *) Feature: the "modified" flag in the "expires" directive. *) Feature: the $uid_got and $uid_set variables may be used at any request processing stage. *) Feature: the $hostname variable. Thanks to Andrei Nigmatulin. *) Feature: DESTDIR support. Thanks to Todd A. Fisher and Andras Voroskoi. *) Bugfix: if sub_filter and SSI were used together, then responses might were transferred incorrectly. *) Bugfix: large SSI inclusions might be truncated. *) Bugfix: the "proxy_pass" directive did not work with the HTTPS protocol; the bug had appeared in 0.6.9. *) Bugfix: worker processes might not catch reconfiguration and log rotation signals. *) Bugfix: nginx could not be built on latest Fedora 9 Linux. Thanks to Roxis. *) Bugfix: a segmentation fault might occur in worker process on Linux, if keepalive was enabled.
author Igor Sysoev <http://sysoev.ru>
date Mon, 07 Jul 2008 00:00:00 +0400
parents 52f3c9c7eff0
children 15c4ba3bc2fa
files CHANGES CHANGES.ru auto/install auto/lib/conf auto/lib/md5/conf auto/lib/pcre/conf auto/lib/sha1/conf auto/summary src/core/nginx.c src/core/nginx.h src/core/ngx_config.h src/core/ngx_connection.c src/core/ngx_cycle.c src/core/ngx_cycle.h src/core/ngx_open_file_cache.c src/core/ngx_resolver.c src/core/ngx_string.h src/event/modules/ngx_kqueue_module.c src/event/ngx_event.c src/event/ngx_event_openssl.c src/event/ngx_event_openssl.h src/event/ngx_event_pipe.c src/http/modules/ngx_http_dav_module.c src/http/modules/ngx_http_headers_filter_module.c src/http/modules/ngx_http_log_module.c src/http/modules/ngx_http_proxy_module.c src/http/modules/ngx_http_ssi_filter_module.c src/http/modules/ngx_http_ssl_module.c src/http/modules/ngx_http_sub_filter_module.c src/http/modules/ngx_http_userid_filter_module.c src/http/modules/perl/nginx.pm src/http/ngx_http_core_module.c src/http/ngx_http_core_module.h src/http/ngx_http_header_filter_module.c src/http/ngx_http_postpone_filter_module.c src/http/ngx_http_request.c src/http/ngx_http_request.h src/http/ngx_http_special_response.c src/http/ngx_http_variables.c src/http/ngx_http_variables.h src/mail/ngx_mail_core_module.c src/mail/ngx_mail_ssl_module.c src/os/unix/ngx_linux_config.h src/os/unix/ngx_posix_config.h src/os/unix/ngx_process_cycle.c
diffstat 45 files changed, 1084 insertions(+), 761 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES	Mon May 12 00:00:00 2008 +0400
+++ b/CHANGES	Mon Jul 07 00:00:00 2008 +0400
@@ -1,8 +1,49 @@
 
+Changes with nginx 0.6.32                                        07 Jul 2008
+
+    *) Change: the "none" parameter in the "ssl_session_cache" directive; 
+       now this is default parameter.
+       Thanks to Rob Mueller.
+
+    *) Change: now the 0x00-0x1F, '"' and '\' characters are escaped as 
+       \xXX in an access_log.
+       Thanks to Maxim Dounin.
+
+    *) Change: now nginx allows several "Host" request header line.
+
+    *) Feature: the "modified" flag in the "expires" directive.
+
+    *) Feature: the $uid_got and $uid_set variables may be used at any 
+       request processing stage.
+
+    *) Feature: the $hostname variable.
+       Thanks to Andrei Nigmatulin.
+
+    *) Feature: DESTDIR support.
+       Thanks to Todd A. Fisher and Andras Voroskoi.
+
+    *) Bugfix: if sub_filter and SSI were used together, then responses 
+       might were transferred incorrectly.
+
+    *) Bugfix: large SSI inclusions might be truncated.
+
+    *) Bugfix: the "proxy_pass" directive did not work with the HTTPS 
+       protocol; the bug had appeared in 0.6.9.
+
+    *) Bugfix: worker processes might not catch reconfiguration and log 
+       rotation signals.
+
+    *) Bugfix: nginx could not be built on latest Fedora 9 Linux.
+       Thanks to Roxis.
+
+    *) Bugfix: a segmentation fault might occur in worker process on Linux, 
+       if keepalive was enabled.
+
+
 Changes with nginx 0.6.31                                        12 May 2008
 
     *) Bugfix: nginx did not process FastCGI response if header was at the 
-       end of FastCGI record; bug appeared in 0.6.2.
+       end of FastCGI record; the bug had appeared in 0.6.2.
        Thanks to Sergey Serov.
 
     *) Bugfix: a segmentation fault might occur in worker process if a file 
@@ -28,7 +69,8 @@
 
     *) Bugfix: now nginx always opens files in binary mode under Cygwin.
 
-    *) Bugfix: nginx could not be built on OpenBSD; bug appeared in 0.6.15.
+    *) Bugfix: nginx could not be built on OpenBSD; the bug had appeared in 
+       0.6.15.
 
 
 Changes with nginx 0.6.29                                        18 Mar 2008
@@ -36,12 +78,13 @@
     *) Feature: the ngx_google_perftools_module.
 
     *) Bugfix: the ngx_http_perl_module could not be built on 64-bit 
-       platforms; bug appeared in 0.6.27.
+       platforms; the bug had appeared in 0.6.27.
 
 
 Changes with nginx 0.6.28                                        13 Mar 2008
 
-    *) Bugfix: the rtsig method could not be built; bug appeared in 0.6.27.
+    *) Bugfix: the rtsig method could not be built; the bug had appeared in 
+       0.6.27.
 
 
 Changes with nginx 0.6.27                                        12 Mar 2008
@@ -113,10 +156,10 @@
        Thanks to Ben Maurer.
 
     *) Bugfix: nginx issued the bogus error message "SSL_shutdown() failed 
-       (SSL: )"; bug appeared in 0.6.23.
+       (SSL: )"; the bug had appeared in 0.6.23.
 
     *) Bugfix: in HTTPS mode requests might fail with the "bad write retry" 
-       error; bug appeared in 0.6.23.
+       error; the bug had appeared in 0.6.23.
 
 
 Changes with nginx 0.6.25                                        08 Jan 2008
@@ -138,19 +181,19 @@
     *) Bugfix: the COPY and MOVE methods did not work with single files.
 
     *) Bugfix: the ngx_http_gzip_static_module did not allow the 
-       ngx_http_dav_module to work; bug appeared in 0.6.23.
+       ngx_http_dav_module to work; the bug had appeared in 0.6.23.
 
     *) Bugfix: socket leak in HTTPS mode if deferred accept was used.
        Thanks to Ben Maurer.
 
-    *) Bugfix: nginx could not be built without PCRE library; bug appeared 
-       in 0.6.23.
+    *) Bugfix: nginx could not be built without PCRE library; the bug had 
+       appeared in 0.6.23.
 
 
 Changes with nginx 0.6.24                                        27 Dec 2007
 
     *) Bugfix: a segmentation fault might occur in worker process if HTTPS 
-       was used; bug appeared in 0.6.23.
+       was used; the bug had appeared in 0.6.23.
 
 
 Changes with nginx 0.6.23                                        27 Dec 2007
@@ -190,7 +233,7 @@
        Thanks to Oleg Motienko.
 
     *) Bugfix: in HTTPS mode requests might fail with the "bad write retry" 
-       error; bug appeared in 0.5.13.
+       error; the bug had appeared in 0.5.13.
 
 
 Changes with nginx 0.6.22                                        19 Dec 2007
@@ -200,7 +243,7 @@
 
     *) Bugfix: if nginx was built with ngx_http_perl_module, the perl 
        before 5.8.6 was used, and perl supported threads, then during 
-       reconfiguration the master process aborted; bug appeared in 
+       reconfiguration the master process aborted; the bug had appeared in 
        0.5.9.
        Thanks to Boris Zhmurov.
 
@@ -216,14 +259,14 @@
        Thanks to Olexander Shtepa.
 
     *) Bugfix: the last address was missed in the $upstream_addr variable; 
-       bug appeared in 0.6.18.
+       the bug had appeared in 0.6.18.
 
     *) Bugfix: the "fastcgi_catch_stderr" directive did return error code; 
        now it returns 502 code, that can be rerouted to a next server using 
        the "fastcgi_next_upstream invalid_header" directive.
 
     *) Bugfix: a segmentation fault occurred in master process if the 
-       "fastcgi_catch_stderr" directive was used; bug appeared in 
+       "fastcgi_catch_stderr" directive was used; the bug had appeared in 
        0.6.10.
        Thanks to Manlio Perillo.
 
@@ -235,8 +278,8 @@
        resolver
 
     *) Bugfix: a segmentation fault might occur in worker process if a 
-       "proxy_pass" directive with URI-part was used; bug appeared in 
-       0.6.19.
+       "proxy_pass" directive with URI-part was used; the bug had appeared 
+       in 0.6.19.
 
     *) Bugfix: if resolver was used on platform that does not support 
        kqueue, then nginx issued an alert "name is out of response".
@@ -254,8 +297,8 @@
 Changes with nginx 0.6.20                                        28 Nov 2007
 
     *) Bugfix: a segmentation fault might occur in worker process if a 
-       "proxy_pass" directive with URI-part was used; bug appeared in 
-       0.6.19.
+       "proxy_pass" directive with URI-part was used; the bug had appeared 
+       in 0.6.19.
 
 
 Changes with nginx 0.6.19                                        27 Nov 2007
@@ -288,7 +331,7 @@
        Thanks to Alexander V. Inyukhin.
 
     *) Bugfix: URL double escaping in a redirect of the "msie_refresh" 
-       directive; bug appeared in 0.6.4.
+       directive; the bug had appeared in 0.6.4.
 
     *) Bugfix: the "autoindex" directive did not work with the "alias /" 
        directive.
@@ -309,7 +352,7 @@
        Thanks to Ilya Novikov.
 
     *) Bugfix: if the "?" character was in a "error_page" directive, then 
-       it was escaped in a proxied request; bug appeared in 0.6.11.
+       it was escaped in a proxied request; the bug had appeared in 0.6.11.
 
     *) Bugfix: compatibility with mget.
 
@@ -337,11 +380,11 @@
 
     *) Bugfix: if request with request body was redirected using the 
        "error_page" directive, then nginx tried to read the request body 
-       again; bug appeared in 0.6.7.
+       again; the bug had appeared in 0.6.7.
 
     *) Bugfix: a segmentation fault occurred in worker process if no 
        server_name was explicitly defined for server processing request; 
-       bug appeared in 0.6.7.
+       the bug had appeared in 0.6.7.
 
 
 Changes with nginx 0.6.14                                        15 Oct 2007
@@ -354,7 +397,7 @@
        "limit_except" block.
 
     *) Bugfix: if all upstream servers were failed, then all servers had 
-       got weight the was equal one until servers became alive; bug 
+       got weight the was equal one until servers became alive; the bug had 
        appeared in 0.6.6.
 
     *) Bugfix: a segmentation fault occurred in worker process if 
@@ -373,8 +416,8 @@
        memcached was used.
 
     *) Bugfix: nginx supported low case only "close" and "keep-alive" 
-       values in the "Connection" request header line; bug appeared in 
-       0.6.11.
+       values in the "Connection" request header line; the bug had appeared 
+       in 0.6.11.
 
     *) Bugfix: sub_filter did not work with empty substitution.
 
@@ -398,7 +441,8 @@
     *) Feature: the "smtp_greeting_delay" and "smtp_client_buffer" 
        directives of the ngx_mail_smtp_module.
 
-    *) Bugfix: the trailing wildcards did not work; bug appeared in 0.6.9.
+    *) Bugfix: the trailing wildcards did not work; the bug had appeared in 
+       0.6.9.
 
     *) Bugfix: nginx could not start on Solaris if the shared PCRE library 
        located in non-standard place was used.
@@ -421,7 +465,8 @@
        lines.
 
     *) Bugfix: if the "max_fails" was set for upstream server, then after 
-       first failure server weight was always one; bug appeared in 0.6.6.
+       first failure server weight was always one; the bug had appeared in 
+       0.6.6.
 
 
 Changes with nginx 0.6.10                                        03 Sep 2007
@@ -429,7 +474,7 @@
     *) Feature: the "open_file_cache", "open_file_cache_retest", and 
        "open_file_cache_errors" directives.
 
-    *) Bugfix: socket leak; bug appeared in 0.6.7.
+    *) Bugfix: socket leak; the bug had appeared in 0.6.7.
 
     *) Bugfix: a charset set by the "charset" directive was not appended to 
        the "Content-Type" header set by $r->send_http_header().
@@ -441,7 +486,7 @@
 Changes with nginx 0.6.9                                         28 Aug 2007
 
     *) Bugfix: a worker process may got caught in an endless loop, if the 
-       HTTPS protocol was used; bug appeared in 0.6.7.
+       HTTPS protocol was used; the bug had appeared in 0.6.7.
 
     *) Bugfix: if server listened on two addresses or ports and trailing 
        wildcard was used, then nginx did not run.
@@ -449,7 +494,8 @@
     *) Bugfix: the "ip_hash" directive might incorrectly mark servers as 
        down.
 
-    *) Bugfix: nginx could not be built on amd64; bug appeared in 0.6.8.
+    *) Bugfix: nginx could not be built on amd64; the bug had appeared in 
+       0.6.8.
 
 
 Changes with nginx 0.6.8                                         20 Aug 2007
@@ -464,8 +510,8 @@
     *) Change: now nginx escapes "%" in $memcached_key variable.
 
     *) Bugfix: nginx used path relative to configuration prefix for 
-       non-absolute configuration file path specified in the "-c" key; bug 
-       appeared in 0.6.6.
+       non-absolute configuration file path specified in the "-c" key; the 
+       bug had appeared in 0.6.6.
 
     *) Bugfix: nginx did not work on FreeBSD/sparc64.
 
@@ -507,8 +553,8 @@
        Thanks to Jiang Hong.
 
     *) Bugfix: a worker process may got caught in an endless loop, if a 
-       "server" inside "upstream" block was marked as "down"; bug appeared 
-       in 0.6.6.
+       "server" inside "upstream" block was marked as "down"; the bug had 
+       appeared in 0.6.6.
 
     *) Bugfix: now Solaris sendfilev() is not used to transfer the client 
        request body to FastCGI-server via the unix domain socket.
@@ -533,7 +579,7 @@
        for HTTP and HTTPS, then nginx used only one port - 80 or 443.
 
     *) Bugfix: fix building on Solaris/amd64 by Sun Studio 11 and early 
-       versions; bug appeared in 0.6.4.
+       versions; the bug had appeared in 0.6.4.
 
 
 Changes with nginx 0.6.5                                         23 Jul 2007
@@ -594,8 +640,8 @@
        eventport method was used.
 
     *) Bugfix: the "proxy_ignore_client_abort" and 
-       "fastcgi_ignore_client_abort" directives did not work; bug appeared 
-       in 0.5.13.
+       "fastcgi_ignore_client_abort" directives did not work; the bug had 
+       appeared in 0.5.13.
 
 
 Changes with nginx 0.6.2                                         09 Jul 2007
@@ -627,7 +673,8 @@
 Changes with nginx 0.5.25                                        11 Jun 2007
 
     *) Bugfix: nginx could not be built with the 
-       --without-http_rewrite_module parameter; bug appeared in 0.5.24.
+       --without-http_rewrite_module parameter; the bug had appeared in 
+       0.5.24.
 
 
 Changes with nginx 0.5.24                                        06 Jun 2007
@@ -636,7 +683,7 @@
        was made using HTTP/0.9.
 
     *) Bugfix: a part of response body might be passed uncompressed if gzip 
-       was used; bug appeared in 0.5.23.
+       was used; the bug had appeared in 0.5.23.
 
 
 Changes with nginx 0.5.23                                        04 Jun 2007
@@ -659,8 +706,8 @@
 
 Changes with nginx 0.5.22                                        29 May 2007
 
-    *) Bugfix: a big request body might not be passed to backend; bug 
-       appeared in 0.5.21.
+    *) Bugfix: a big request body might not be passed to backend; the bug 
+       had appeared in 0.5.21.
 
 
 Changes with nginx 0.5.21                                        28 May 2007
@@ -733,11 +780,12 @@
 
     *) Bugfix: a segmentation fault occurred in master process after first 
        reconfiguration and receiving any signal if nginx was built with 
-       ngx_http_perl_module and perl did not support multiplicity; bug 
-       appeared in 0.5.9.
+       ngx_http_perl_module and perl did not support multiplicity; the bug 
+       had appeared in 0.5.9.
 
     *) Bugfix: if perl did not support multiplicity, then after 
-       reconfiguration perl code did not work; bug appeared in 0.3.38.
+       reconfiguration perl code did not work; the bug had appeared in 
+       0.3.38.
 
 
 Changes with nginx 0.5.17                                        02 Apr 2007
@@ -764,14 +812,14 @@
 
     *) Bugfix: a segmentation fault might occur in worker process if a 
        charset was set in the "Content-Type" header line and the line has 
-       trailing ";"; bug appeared in 0.3.50.
+       trailing ";"; the bug had appeared in 0.3.50.
 
     *) Bugfix: the "[alert] zero size buf" error when FastCGI server was 
        used and a request body written in a temporary file was multiple of 
        32K.
 
     *) Bugfix: nginx could not be built on Solaris without the --with-debug 
-       option; bug appeared in 0.5.15.
+       option; the bug had appeared in 0.5.15.
 
 
 Changes with nginx 0.5.15                                        19 Mar 2007
@@ -827,17 +875,17 @@
        send timeout only.
 
     *) Bugfix: nginx could not be built on platforms different from i386, 
-       amd64, sparc and ppc; bug appeared in 0.5.8.
+       amd64, sparc, and ppc; the bug had appeared in 0.5.8.
 
 
 Changes with nginx 0.5.12                                        12 Feb 2007
 
     *) Bugfix: nginx could not be built on platforms different from i386, 
-       amd64, sparc и ppc; bug appeared in 0.5.8.
+       amd64, sparc, and ppc; the bug had appeared in 0.5.8.
 
     *) Bugfix: a segmentation fault might occur in worker process if the 
-       temporarily files were used while working with FastCGI server; bug 
-       appeared in 0.5.8.
+       temporarily files were used while working with FastCGI server; the 
+       bug had appeared in 0.5.8.
 
     *) Bugfix: a segmentation fault might occur in worker process if the 
        $fastcgi_script_name variable was logged.
@@ -851,7 +899,7 @@
        Thanks to Chris McGrath.
 
     *) Bugfix: the response was incorrect if several ranges were requested; 
-       bug appeared in 0.5.6.
+       the bug had appeared in 0.5.6.
 
     *) Bugfix: the "create_full_put_path" directive could not create the 
        intermediate directories if no "dav_access" directive was set.
@@ -867,10 +915,10 @@
 Changes with nginx 0.5.10                                        26 Jan 2007
 
     *) Bugfix: while online executable file upgrade the new master process 
-       did not inherit the listening sockets; bug appeared in 0.5.9.
+       did not inherit the listening sockets; the bug had appeared in 0.5.9.
 
     *) Bugfix: a segmentation fault might occur in worker process if nginx 
-       was built with -O2 optimization; bug appeared in 0.5.1.
+       was built with -O2 optimization; the bug had appeared in 0.5.1.
 
 
 Changes with nginx 0.5.9                                         25 Jan 2007
@@ -906,7 +954,7 @@
 
     *) Bugfix: if the "proxy_buffering off" directive was used and a client 
        connection was non-active, then the connection was closed after send 
-       timeout; bug appeared in 0.4.7.
+       timeout; the bug had appeared in 0.4.7.
 
     *) Bugfix: if the "epoll" method was used and a client closed a 
        connection prematurely, then nginx closed the connection after a 
@@ -987,7 +1035,7 @@
        directive, then nginx might report about configuration error.
 
     *) Bugfix: a segmentation fault might occur if the $host variable was 
-       used; bug appeared in 0.4.14.
+       used; the bug had appeared in 0.4.14.
 
 
 Changes with nginx 0.5.3                                         13 Dec 2006
@@ -1004,8 +1052,8 @@
 Changes with nginx 0.5.2                                         11 Dec 2006
 
     *) Bugfix: if the "proxy_pass" directive used the name of the 
-       "upstream" block, then nginx tried to resolve the name; bug appeared 
-       in 0.5.1.
+       "upstream" block, then nginx tried to resolve the name; the bug had 
+       appeared in 0.5.1.
 
 
 Changes with nginx 0.5.1                                         11 Dec 2006
@@ -1013,19 +1061,20 @@
     *) Bugfix: the "post_action" directive might not run after a 
        unsuccessful completion of a request.
 
-    *) Workaround: for Eudora for Mac; bug appeared in 0.4.11.
+    *) Workaround: for Eudora for Mac; the bug had appeared in 0.4.11.
        Thanks to Bron Gondwana.
 
     *) Bugfix: if the "upstream" name was used in the "fastcgi_pass", then 
-       the message "no port in upstream" was issued; bug appeared in 0.5.0.
+       the message "no port in upstream" was issued; the bug had appeared 
+       in 0.5.0.
 
     *) Bugfix: if the "proxy_pass" and "fastcgi_pass" directives used the 
        same servers but different ports, then these directives uses the 
-       first described port; bug appeared in 0.5.0.
+       first described port; the bug had appeared in 0.5.0.
 
     *) Bugfix: if the "proxy_pass" and "fastcgi_pass" directives used the 
        unix domain sockets, then these directives used first described 
-       socket; bug appeared in 0.5.0.
+       socket; the bug had appeared in 0.5.0.
 
     *) Bugfix: ngx_http_auth_basic_module ignored the user if it was in the 
        last line in the password file and there was no the carriage return, 
@@ -1054,8 +1103,8 @@
     *) Feature: the WAIT status in the "Auth-Status" header line of the 
        IMAP/POP3 proxy authentication server response.
 
-    *) Bugfix: nginx could not be built on 64-bit platforms; bug appeared 
-       in 0.4.14.
+    *) Bugfix: nginx could not be built on 64-bit platforms; the bug had 
+       appeared in 0.4.14.
 
 
 Changes with nginx 0.4.14                                        27 Nov 2006
@@ -1066,7 +1115,7 @@
        Linux, and NetBSD.
 
     *) Bugfix: ngx_http_perl_module did not work with perl built with the 
-       threads support; bug appeared in 0.3.38.
+       threads support; the bug had appeared in 0.3.38.
 
     *) Bugfix: ngx_http_perl_module did not work if perl was called 
        recursively.
@@ -1101,7 +1150,7 @@
        the deferred accept() were used.
 
     *) Bugfix: a charset could not be set for ngx_http_autoindex_module 
-       responses; bug appeared in 0.3.50.
+       responses; the bug had appeared in 0.3.50.
 
     *) Bugfix: the "[alert] zero size buf" error when FastCGI server was 
        used;
@@ -1109,8 +1158,8 @@
     *) Bugfix: the --group= configuration parameter was ignored.
        Thanks to Thomas Moschny.
 
-    *) Bugfix: the 50th subrequest in SSI response did not work; bug 
-       appeared in 0.3.50.
+    *) Bugfix: the 50th subrequest in SSI response did not work; the bug 
+       had appeared in 0.3.50.
 
 
 Changes with nginx 0.4.12                                        31 Oct 2006
@@ -1131,7 +1180,7 @@
        method.
 
     *) Bugfix: if the APOP was enabled in the POP3 proxy, then the 
-       USER/PASS commands might not work; bug appeared in 0.4.10.
+       USER/PASS commands might not work; the bug had appeared in 0.4.10.
 
 
 Changes with nginx 0.4.10                                        23 Oct 2006
@@ -1146,10 +1195,10 @@
        variable was used in the "map" directive.
 
     *) Bugfix: the ngx_http_flv_module did not support the byte ranges for 
-       full responses; bug appeared in 0.4.7.
-
-    *) Bugfix: nginx could not be built on Debian amd64; bug appeared in 
-       0.4.9.
+       full responses; the bug had appeared in 0.4.7.
+
+    *) Bugfix: nginx could not be built on Debian amd64; the bug had 
+       appeared in 0.4.9.
 
 
 Changes with nginx 0.4.9                                         13 Oct 2006
@@ -1202,14 +1251,14 @@
        $r->headers_out("Content-Length", ...) method.
 
     *) Bugfix: after redirecting error by an "error_page" directive any 
-       ngx_http_rewrite_module directive returned this error code; bug 
-       appeared in 0.4.4.
+       ngx_http_rewrite_module directive returned this error code; the bug 
+       had appeared in 0.4.4.
 
 
 Changes with nginx 0.4.5                                         02 Oct 2006
 
-    *) Bugfix: nginx could not be built on Linux and Solaris; bug appeared 
-       in 0.4.4.
+    *) Bugfix: nginx could not be built on Linux and Solaris; the bug had 
+       appeared in 0.4.4.
 
 
 Changes with nginx 0.4.4                                         02 Oct 2006
@@ -1244,7 +1293,7 @@
        error to the proxied server using a "proxy_pass" directive.
 
     *) Bugfix: a segmentation fault occurred if an unix domain socket was 
-       used in a "proxy_pass" directive; bug appeared in 0.3.47.
+       used in a "proxy_pass" directive; the bug had appeared in 0.3.47.
 
     *) Bugfix: SSI did work with memcached and nonbuffered responses.
 
@@ -1253,8 +1302,8 @@
 
 Changes with nginx 0.4.2                                         14 Sep 2006
 
-    *) Bugfix: the O_NOATIME flag support on Linux was canceled; bug 
-       appeared in 0.4.1.
+    *) Bugfix: the O_NOATIME flag support on Linux was canceled; the bug 
+       had appeared in 0.4.1.
 
 
 Changes with nginx 0.4.1                                         14 Sep 2006
@@ -1288,7 +1337,7 @@
 
     *) Bugfix: a segmentation fault occurred if there was an "index" 
        directive with variables and the first index name was without 
-       variables; bug appeared in 0.1.29.
+       variables; the bug had appeared in 0.1.29.
 
 
 Changes with nginx 0.3.61                                        28 Aug 2006
@@ -1306,7 +1355,7 @@
 Changes with nginx 0.3.60                                        18 Aug 2006
 
     *) Bugfix: a worker process may got caught in an endless loop while an 
-       error redirection; bug appeared in 0.3.59.
+       error redirection; the bug had appeared in 0.3.59.
 
 
 Changes with nginx 0.3.59                                        16 Aug 2006
@@ -1318,7 +1367,7 @@
 
     *) Bugfix: the "error_page" directive did not changes the 
        "Content-Type" header line after the "X-Accel-Redirect" was used; 
-       bug appeared in 0.3.58.
+       the bug had appeared in 0.3.58.
 
 
 Changes with nginx 0.3.58                                        14 Aug 2006
@@ -1386,8 +1435,8 @@
        upstream.
 
     *) Bugfix: on some condition while reconfiguration character codes 
-       inside the "charset_map" may be treated invalid; bug appeared in 
-       0.3.50.
+       inside the "charset_map" may be treated invalid; the bug had 
+       appeared in 0.3.50.
 
 
 Changes with nginx 0.3.54                                        11 Jul 2006
@@ -1406,8 +1455,8 @@
     *) Bugfix: the $upstream_response_time variable had the time of the 
        first request to a backend only.
 
-    *) Bugfix: nginx could not be built on amd64 platform; bug appeared in 
-       0.3.53.
+    *) Bugfix: nginx could not be built on amd64 platform; the bug had 
+       appeared in 0.3.53.
 
 
 Changes with nginx 0.3.53                                        07 Jul 2006
@@ -1440,10 +1489,10 @@
        return the 405 error.
 
     *) Bugfix: the worker process may got caught in an endless loop if the 
-       limit rate was used; bug appeared in 0.3.37.
+       limit rate was used; the bug had appeared in 0.3.37.
 
     *) Bugfix: ngx_http_charset_module logged "unknown charset" alert, even 
-       if the recoding was not needed; bug appeared in 0.3.50.
+       if the recoding was not needed; the bug had appeared in 0.3.50.
 
     *) Bugfix: if a code response of the PUT request was 409, then a 
        temporary file was not removed.
@@ -1452,7 +1501,7 @@
 Changes with nginx 0.3.51                                        30 Jun 2006
 
     *) Bugfix: the "<" symbols might disappeared some conditions in the 
-       SSI; bug appeared in 0.3.50.
+       SSI; the bug had appeared in 0.3.50.
 
 
 Changes with nginx 0.3.50                                        28 Jun 2006
@@ -1497,10 +1546,11 @@
 
     *) Bugfix: the internal redirect always transform client's HTTP method 
        to GET, now the transformation is made for the "X-Accel-Redirect" 
-       redirects only and if the method is not HEAD; bug appeared in 0.3.42.
+       redirects only and if the method is not HEAD; the bug had appeared 
+       in 0.3.42.
 
     *) Bugfix: the ngx_http_perl_module could not be built, if the perl was 
-       built with the threads support; bug appeared in 0.3.46.
+       built with the threads support; the bug had appeared in 0.3.46.
 
 
 Changes with nginx 0.3.47                                        23 May 2006
@@ -1537,7 +1587,8 @@
     *) Change: the &deg; symbol codes were changed in koi-win conversion 
        table.
 
-    *) Feature: the euro и N symbols were added to koi-win conversion table.
+    *) Feature: the euro and N symbols were added to koi-win conversion 
+       table.
 
     *) Bugfix: if nginx distributed the requests among several backends and 
        some backend failed, then requests intended for this backend was 
@@ -1614,9 +1665,9 @@
 
     *) Bugfix: the active connection counter increased on the exceeding of 
        the connection limit specified by the "worker_connections" 
-       directive; bug appeared in 0.2.0.
-
-    *) Bugfix: the limit rate might not work on some condition; bug 
+       directive; the bug had appeared in 0.2.0.
+
+    *) Bugfix: the limit rate might not work on some condition; the bug had 
        appeared in 0.3.38.
 
 
@@ -1690,7 +1741,7 @@
 Changes with nginx 0.3.35                                        22 Mar 2006
 
     *) Bugfix: the accept-filter and the TCP_DEFER_ACCEPT option were set 
-       for first "listen" directive only; bug appeared in 0.3.31.
+       for first "listen" directive only; the bug had appeared in 0.3.31.
 
     *) Bugfix: in the "proxy_pass" directive without the URI part in a 
        subrequest.
@@ -1715,7 +1766,7 @@
 Changes with nginx 0.3.32                                        11 Mar 2006
 
     *) Bugfix: the debug logging on startup and reconfiguration time was 
-       removed; bug appeared in 0.3.31.
+       removed; the bug had appeared in 0.3.31.
 
 
 Changes with nginx 0.3.31                                        10 Mar 2006
@@ -1733,7 +1784,8 @@
 
     *) Bugfix: if there were several "listen" directives listening one 
        various addresses inside one server, then server names like 
-       "*.domain.tld" worked for first address only; bug appeared in 0.3.18.
+       "*.domain.tld" worked for first address only; the bug had appeared 
+       in 0.3.18.
 
     *) Bugfix: if the HTTPS protocol was used in the "proxy_pass" directive 
        and the request body was in temporarily file then the request was 
@@ -1751,7 +1803,7 @@
        ngx_http_ssi_filter_module.
 
     *) Bugfix: nginx could not be built on i386 platform, if the PIC was 
-       used; bug appeared in 0.3.27.
+       used; the bug had appeared in 0.3.27.
 
 
 Changes with nginx 0.3.29                                        20 Feb 2006
@@ -1827,8 +1879,8 @@
 Changes with nginx 0.3.25                                        01 Feb 2006
 
     *) Bugfix: the segmentation fault was occurred on start or while 
-       reconfiguration if there was invalid configuration; bug appeared in 
-       0.3.24.
+       reconfiguration if there was invalid configuration; the bug had 
+       appeared in 0.3.24.
 
 
 Changes with nginx 0.3.24                                        01 Feb 2006
@@ -1844,8 +1896,8 @@
        location.
 
     *) Bugfix: on 64-bit platforms segmentation fault may occurred on start 
-       if the many names were used in the "server_name" directives; bug 
-       appeared in 0.3.18.
+       if the many names were used in the "server_name" directives; the bug 
+       had appeared in 0.3.18.
 
 
 Changes with nginx 0.3.23                                        24 Jan 2006
@@ -1868,8 +1920,8 @@
        canceled.
 
     *) Bugfix: segmentation fault was occurred if the "none" or "blocked" 
-       values was specified in the "valid_referers" directive; bug appeared 
-       in 0.3.18.
+       values was specified in the "valid_referers" directive; the bug had 
+       appeared in 0.3.18.
 
 
 Changes with nginx 0.3.21                                        16 Jan 2006
@@ -1920,10 +1972,10 @@
        ngx_http_map_module.
 
     *) Bugfix: segmentation fault was occurred if configuration file did 
-       not exist; bug appeared in 0.3.12.
+       not exist; the bug had appeared in 0.3.12.
 
     *) Bugfix: on 64-bit platforms segmentation fault may occurred on 
-       start; bug appeared in 0.3.16.
+       start; the bug had appeared in 0.3.16.
 
 
 Changes with nginx 0.3.17                                        18 Dec 2005
@@ -1934,8 +1986,8 @@
     *) Feature: the "map" directive supports domain names in the 
        ".domain.tld" form.
 
-    *) Bugfix: the timeouts were not used in SSL handshake; bug appeared in 
-       0.2.4.
+    *) Bugfix: the timeouts were not used in SSL handshake; the bug had 
+       appeared in 0.2.4.
 
     *) Bugfix: in the HTTPS protocol in the "proxy_pass" directive.
 
@@ -1961,11 +2013,11 @@
     *) Bugfix: the "config timefmt" SSI command set incorrect time format.
 
     *) Bugfix: nginx did not close connection to IMAP/POP3 backend for the 
-       SSL connections; bug appeared in 0.3.13.
+       SSL connections; the bug had appeared in 0.3.13.
        Thanks to Rob Mueller.
 
-    *) Bugfix: segmentation fault may occurred in at SSL shutdown; bug 
-       appeared in 0.3.13.
+    *) Bugfix: segmentation fault may occurred in at SSL shutdown; the bug 
+       had appeared in 0.3.13.
 
 
 Changes with nginx 0.3.15                                        07 Dec 2005
@@ -1981,8 +2033,8 @@
 
 Changes with nginx 0.3.14                                        05 Dec 2005
 
-    *) Bugfix: in the 304 response the body was transferred; bug appeared 
-       in 0.3.13.
+    *) Bugfix: in the 304 response the body was transferred; the bug had 
+       appeared in 0.3.13.
 
 
 Changes with nginx 0.3.13                                        05 Dec 2005
@@ -1998,7 +2050,7 @@
        request body to FastCGI-server via the unix domain socket.
 
     *) Bugfix: the "auth_basic" directive did not disable the 
-       authorization; bug appeared in 0.3.11.
+       authorization; the bug had appeared in 0.3.11.
 
 
 Changes with nginx 0.3.12                                        26 Nov 2005
@@ -2019,7 +2071,7 @@
     *) Feature: the "proxy_buffering" directive.
 
     *) Bugfix: the changes in accept mutex handling when the "rtsig" method 
-       was used; bug appeared in 0.3.0.
+       was used; the bug had appeared in 0.3.0.
 
     *) Bugfix: if the client sent the "Transfer-Encoding: chunked" header 
        line, then nginx returns the 411 error.
@@ -2030,7 +2082,7 @@
 
     *) Bugfix: if the "combined" format was explicitly specified in the 
        "access_log" directive, then the empty lines was written to the log; 
-       bug appeared in 0.3.8.
+       the bug had appeared in 0.3.8.
 
     *) Bugfix: nginx did not run on the sparc platform under any OS except 
        Solaris.
@@ -2042,7 +2094,7 @@
 Changes with nginx 0.3.11                                        15 Nov 2005
 
     *) Bugfix: nginx did not pass the client request headers and body while 
-       proxying; bug appeared in 0.3.10.
+       proxying; the bug had appeared in 0.3.10.
 
 
 Changes with nginx 0.3.10                                        15 Nov 2005
@@ -2081,7 +2133,7 @@
 Changes with nginx 0.3.9                                         10 Nov 2005
 
     *) Bugfix: nginx considered URI as unsafe if two any symbols was 
-       between two slashes; bug appeared in 0.3.8.
+       between two slashes; the bug had appeared in 0.3.8.
 
 
 Changes with nginx 0.3.8                                         09 Nov 2005
@@ -2121,8 +2173,8 @@
 
     *) Bugfix: if the request URI was changes by the "rewrite" directive 
        and the request was proxied in location given by regular expression, 
-       then the incorrect request was transferred to backend; bug appeared 
-       in 0.2.6.
+       then the incorrect request was transferred to backend; the bug had 
+       appeared in 0.2.6.
 
     *) Bugfix: the "expires" directive did not remove the previous 
        "Expires" header.
@@ -2143,7 +2195,7 @@
     *) Feature: the "access_log" supports the "buffer=" parameter.
 
     *) Bugfix: nginx could not be built on platforms different from i386, 
-       amd64, sparc и ppc; bug appeared in 0.3.2.
+       amd64, sparc, and ppc; the bug had appeared in 0.3.2.
 
 
 Changes with nginx 0.3.6                                         24 Oct 2005
@@ -2154,7 +2206,8 @@
     *) Feature: the "log_format" supports the variables in the $name form.
 
     *) Bugfix: if at least in one server was no the "listen" directive, 
-       then nginx did not listen on the 80 port; bug appeared in 0.3.3.
+       then nginx did not listen on the 80 port; the bug had appeared in 
+       0.3.3.
 
     *) Bugfix: if the URI part is omitted in "proxy_pass" directive, the 
        the 80 port was always used.
@@ -2163,10 +2216,10 @@
 Changes with nginx 0.3.5                                         21 Oct 2005
 
     *) Bugfix: the segmentation fault may occurred if the IMAP/POP3 login 
-       was changed by authorization server; bug appeared in 0.2.2.
+       was changed by authorization server; the bug had appeared in 0.2.2.
 
     *) Bugfix: the accept mutex did not work and all connections were 
-       handled by one process; bug appeared in 0.3.3.
+       handled by one process; the bug had appeared in 0.3.3.
 
     *) Bugfix: the timeout did not work if the "rtsig" method and the 
        "timer_resolution" directive were used.
@@ -2174,8 +2227,8 @@
 
 Changes with nginx 0.3.4                                         19 Oct 2005
 
-    *) Bugfix: nginx could not be built on Linux 2.4+ and MacOS X; bug 
-       appeared in 0.3.3.
+    *) Bugfix: nginx could not be built on Linux 2.4+ and MacOS X; the bug 
+       had appeared in 0.3.3.
 
 
 Changes with nginx 0.3.3                                         19 Oct 2005
@@ -2196,7 +2249,7 @@
        the CLOSED state.
 
     *) Bugfix: the mime type may be incorrectly set to default value for 
-       index file with variable in the name; bug appeared in 0.3.0.
+       index file with variable in the name; the bug had appeared in 0.3.0.
 
     *) Feature: the "timer_resolution" directive.
 
@@ -2228,7 +2281,8 @@
 Changes with nginx 0.3.1                                         10 Oct 2005
 
     *) Bugfix: the segmentation fault occurred when the signal queue 
-       overflowed if the "rtsig" method was used; bug appeared in 0.2.0.
+       overflowed if the "rtsig" method was used; the bug had appeared in 
+       0.2.0.
 
     *) Change: correct handling of the "\\", "\"", "\'", and "\$" pairs in 
        SSI.
@@ -2262,7 +2316,7 @@
     *) Bugfix: if the "set" directive set the ngx_http_geo_module variable 
        in some configuration part, the this variable was not available in 
        other configuration parts and the "using uninitialized variable" 
-       error was occurred; bug appeared in 0.2.2.
+       error was occurred; the bug had appeared in 0.2.2.
 
 
 Changes with nginx 0.2.5                                         04 Oct 2005
@@ -2284,17 +2338,17 @@
     *) Feature: the ngx_http_ssi_module supports "$var=text", "$var!=text", 
        "$var=/text/", and "$var!=/text/" expressions in the "if" command.
 
-    *) Bugfix: in proxying location without trailing slash; bug appeared in 
-       0.1.44.
+    *) Bugfix: in proxying location without trailing slash; the bug had 
+       appeared in 0.1.44.
 
     *) Bugfix: the segmentation fault may occurred if the "rtsig" method 
-       was used; bug appeared in 0.2.0.
+       was used; the bug had appeared in 0.2.0.
 
 
 Changes with nginx 0.2.3                                         30 Sep 2005
 
     *) Bugfix: nginx could not be built without the --with-debug option; 
-       bug appeared in 0.2.2.
+       the bug had appeared in 0.2.2.
 
 
 Changes with nginx 0.2.2                                         30 Sep 2005
@@ -2323,8 +2377,8 @@
 Changes with nginx 0.2.1                                         23 Sep 2005
 
     *) Bugfix: if all backend using in load-balancing failed after one 
-       error, then nginx may got caught in an endless loop; bug appeared in 
-       0.2.0.
+       error, then nginx may got caught in an endless loop; the bug had 
+       appeared in 0.2.0.
 
 
 Changes with nginx 0.2.0                                         23 Sep 2005
@@ -2402,7 +2456,7 @@
     *) 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 bug appeared in 0.1.29.
+       used; in the proxied mode the the bug had appeared in 0.1.29.
 
 
 Changes with nginx 0.1.42                                        23 Aug 2005
@@ -2412,7 +2466,7 @@
        occurred in the ngx_http_proxy_module.
 
     *) Bugfix: the "limit_rate" directive did not work inside the "if" 
-       block; bug appeared in 0.1.38.
+       block; the bug had appeared in 0.1.38.
 
 
 Changes with nginx 0.1.41                                        25 Jul 2005
@@ -2427,7 +2481,7 @@
        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.
+       "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.
@@ -2449,8 +2503,8 @@
        transferred while the 401 response code redirecting.
 
     *) Bugfix: the ngx_http_proxy_module and ngx_http_fastcgi_module may 
-       close a connection before anything was transferred to a client; bug 
-       appeared in 0.1.38.
+       close a connection before anything was transferred to a client; the 
+       bug had appeared in 0.1.38.
 
     *) Workaround: the Linux glibc crypt_r() initialization bug.
 
@@ -2459,17 +2513,17 @@
 
     *) Bugfix: if the backend response had the "Location" header line and 
        nginx should not rewrite this line, then the 500 code response body 
-       was transferred; bug appeared in 0.1.29.
+       was transferred; the bug had appeared in 0.1.29.
 
     *) Bugfix: some directives of the ngx_http_proxy_module and 
        ngx_http_fastcgi_module were not inherited from the server to the 
-       location level; bug appeared in 0.1.29.
+       location level; the bug had appeared in 0.1.29.
 
     *) Bugfix: the ngx_http_ssl_module did not support the certificate 
        chain.
 
     *) Bugfix: the ngx_http_autoindex_module did not show correctly the 
-       long file names; bug appeared in 0.1.38.
+       long file names; the bug had appeared in 0.1.38.
 
     *) Bugfixes in IMAP/POP3 proxy in interaction with a backend at the 
        login state.
@@ -2497,8 +2551,8 @@
        than one remote subrequest.
 
     *) Bugfix: nginx treated the backend response as invalid if the status 
-       line in the header was transferred in two packets; bug appeared in 
-       0.1.29.
+       line in the header was transferred in two packets; the bug had 
+       appeared in 0.1.29.
 
     *) Feature: the "ssi_types" directive.
 
@@ -2552,7 +2606,7 @@
     *) Feature: the "port_in_redirect" directive.
 
     *) Bugfix: the segmentation fault was occurred if the backend response 
-       header was in several packets; bug appeared in 0.1.29.
+       header was in several packets; the bug had appeared in 0.1.29.
 
     *) Bugfix: if more than 10 servers were configured or some server did 
        not use the "listen" directive, then the segmentation fault was 
@@ -2562,7 +2616,8 @@
        bigger than the temporary file.
 
     *) Bugfix: nginx returned the 400 response on requests like 
-       "GET http://www.domain.com/uri HTTP/1.0"; bug appeared in 0.1.28.
+       "GET http://www.domain.com/uri HTTP/1.0"; the bug had appeared in 
+       0.1.28.
 
 
 Changes with nginx 0.1.34                                        26 May 2005
@@ -2582,7 +2637,7 @@
 Changes with nginx 0.1.33                                        23 May 2005
 
     *) Bugfix: nginx could not be built with the --without-pcre parameter; 
-       bug appeared in 0.1.29.
+       the bug had appeared in 0.1.29.
 
     *) Bugfix: 3, 4, 7, and 8 the "proxy_set_header" directives in one 
        level cause the bus fault on start up.
@@ -2596,7 +2651,7 @@
 Changes with nginx 0.1.32                                        19 May 2005
 
     *) Bugfix: the arguments were omitted in the redirects, issued by the 
-       "rewrite" directive; bug appeared in 0.1.29.
+       "rewrite" directive; the bug had appeared in 0.1.29.
 
     *) Feature: the "if" directive supports the captures in regular 
        expressions.
@@ -2617,7 +2672,7 @@
     *) Bugfix: errors while using SSI and gzipping.
 
     *) Bugfix: the redirect with the 301 code was transferred without 
-       response body; bug appeared in 0.1.30.
+       response body; the bug had appeared in 0.1.30.
 
 
 Changes with nginx 0.1.30                                        14 May 2005
@@ -2629,7 +2684,8 @@
 
     *) Bugfix: if the length of the response part received at once from 
        proxied or FastCGI server was equal to 500, then nginx returns the 
-       500 response code; in proxy mode the bug appeared in 0.1.29 only.
+       500 response code; in proxy mode the the bug had appeared in 0.1.29 
+       only.
 
     *) Bugfix: nginx did not consider the directives with 8 or 9 parameters 
        as invalid.
@@ -2708,7 +2764,7 @@
        returned the 408 response.
 
     *) Bugfix: the segmentation fault was occurred if the backend sent an 
-       invalid line in response header; bug appeared in 0.1.26.
+       invalid line in response header; the bug had appeared in 0.1.26.
 
     *) Bugfix: the segmentation fault may occurred in FastCGI fault 
        tolerance configuration.
@@ -2828,7 +2884,7 @@
        server name of the "server_name" directive.
 
     *) Bugfix: nginx could not be built on platforms different from i386, 
-       amd64, sparc и ppc; bug appeared in 0.1.22.
+       amd64, sparc, and ppc; the bug had appeared in 0.1.22.
 
     *) Bugfix: the ngx_http_autoindex_module now shows the information not 
        about the symlink, but about file or directory it points to.
@@ -2843,7 +2899,7 @@
        connections statistics if the proxying or FastCGI server were used.
 
     *) Bugfix: the installation paths were incorrectly quoted on Linux and 
-       Solaris; bug appeared in 0.1.21.
+       Solaris; the bug had appeared in 0.1.21.
 
 
 Changes with nginx 0.1.21                                        22 Feb 2005
@@ -2928,7 +2984,8 @@
        static page, then the segmentation fault occurred.
 
     *) Bugfix: if in a proxied "Location" header was a relative URL, then a 
-       host name and a slash were added to them; bug appeared in 0.1.14.
+       host name and a slash were added to them; the bug had appeared in 
+       0.1.14.
 
     *) Bugfix: the system error message was not logged on Linux.
 
@@ -2953,7 +3010,7 @@
     *) Feature: the rewrite directive supports the arguments rewriting.
 
     *) Bugfix: the response code 400 was returned for the POST request with 
-       the "Content-Length: 0" header; bug appeared in 0.1.14.
+       the "Content-Length: 0" header; the bug had appeared in 0.1.14.
 
 
 Changes with nginx 0.1.15                                        19 Jan 2005
@@ -2974,8 +3031,8 @@
        to use the regular expressions in locations.
 
     *) Bugfix: the directive "proxy_preserve_host  on" adds port 80 to the 
-       "Host" headers, if upstream listen on port 80; bug appeared in 
-       0.1.14.
+       "Host" headers, if upstream listen on port 80; the bug had appeared 
+       in 0.1.14.
 
     *) Bugfix: the same paths in autoconfiguration parameters 
        --http-client-body-temp-path=PATH and --http-proxy-temp-path=PATH, 
@@ -3001,7 +3058,8 @@
        fastcgi_max_temp_file_size, fastcgi_temp_file_write_size, 
        fastcgi_next_upstream, and fastcgi_x_powered_by.
 
-    *) Bugfix: the "[alert] zero size buf" error; bug appeared in 0.1.3.
+    *) Bugfix: the "[alert] zero size buf" error; the bug had appeared in 
+       0.1.3.
 
     *) Change: the URI must be specified after the host name in the 
        proxy_pass directive.
@@ -3086,7 +3144,7 @@
 
     *) Bugfix: if the request without arguments contains "//", "/./", 
        "/../" or "%XX" then the lost character in the request line was 
-       lost; bug appeared in 0.1.9.
+       lost; the bug had appeared in 0.1.9.
 
     *) Bugfix: the fix in 0.1.9 for the files bigger than 2G on Linux did 
        not work.
@@ -3104,7 +3162,8 @@
        does not support sendfile64().
 
     *) Bugfix: while the build configuration on Linux the 
-       --with-poll_module parameter was required; bug appeared in 0.1.8.
+       --with-poll_module parameter was required; the bug had appeared in 
+       0.1.8.
 
 
 Changes with nginx 0.1.8                                         20 Nov 2004
@@ -3120,7 +3179,7 @@
 Changes with nginx 0.1.7                                         12 Nov 2004
 
     *) Bugfix: on FreeBSD the segmentation fault may occur if the size of 
-       the transferred file was changed; bug appeared in 0.1.5.
+       the transferred file was changed; the bug had appeared in 0.1.5.
 
 
 Changes with nginx 0.1.6                                         11 Nov 2004
@@ -3179,13 +3238,13 @@
     *) Bugfix: the portability improvements.
 
     *) Bugfix: if configuration file was set in command line, the 
-       reconfiguration was impossible; bug appeared in 0.1.1.
+       reconfiguration was impossible; the bug had appeared in 0.1.1.
 
     *) Bugfix: proxy module may get caught in an endless loop when sendfile 
        is not used.
 
     *) Bugfix: with sendfile the response was not recoded according to the 
-       charset module directives; bug appeared in 0.1.1.
+       charset module directives; the bug had appeared in 0.1.1.
 
     *) Bugfix: very seldom bug in the kqueue processing.
 
--- a/CHANGES.ru	Mon May 12 00:00:00 2008 +0400
+++ b/CHANGES.ru	Mon Jul 07 00:00:00 2008 +0400
@@ -1,4 +1,46 @@
 
+Изменения в nginx 0.6.32                                          07.07.2008
+
+    *) Изменение: параметр "none" в директиве ssl_session_cache; теперь 
+       этот параметр используется по умолчанию.
+       Спасибо Rob Mueller.
+
+    *) Изменение: теперь символы 0x00-0x1F, '"' и '\' в access_log 
+       записываются в виде \xXX.
+       Спасибо Максиму Дунину.
+
+    *) Изменение: теперь nginx разрешает несколько строк "Host" в заголовке 
+       запроса.
+
+    *) Добавление: директива expires поддерживает флаг modified.
+
+    *) Добавление: переменные $uid_got и $uid_set можно использовать на 
+       любой стадии обработки запроса.
+
+    *) Добавление: переменная $hostname.
+       Спасибо Андрею Нигматулину.
+
+    *) Добавление: поддержка DESTDIR.
+       Спасибо Todd A. Fisher и Andras Voroskoi.
+
+    *) Исправление: при совместном использовании sub_filter и SSI ответы 
+       могли передаваться неверно.
+
+    *) Исправление: большие включения в SSI могли передавались не полностью.
+
+    *) Исправление: директива proxy_pass не работала с протоколом HTTPS; 
+       ошибка появилась в 0.6.9.
+
+    *) Исправление: рабочие процессы могли не реагировать на сигналы 
+       переконфигурации и ротации логов.
+
+    *) Исправление: nginx не собирался на последних Fedora 9 Linux.
+       Спасибо Roxis.
+
+    *) Исправление: при использовании keepalive на Linux в рабочем процессе 
+       мог произойти segmentation fault.
+
+
 Изменения в nginx 0.6.31                                          12.05.2008
 
     *) Исправление: nginx не обрабатывал ответ FastCGI-сервера, если строка 
--- a/auto/install	Mon May 12 00:00:00 2008 +0400
+++ b/auto/install	Mon Jul 07 00:00:00 2008 +0400
@@ -17,47 +17,53 @@
 
 cat << END                                                    >> $NGX_MAKEFILE
 
-install:	$NGX_OBJS${ngx_dirsep}nginx${ngx_binext}	\
+install:	$NGX_OBJS${ngx_dirsep}nginx${ngx_binext} \
 		$NGX_INSTALL_PERL_MODULES
-	test -d '$NGX_PREFIX' || mkdir -p '$NGX_PREFIX'
+	test -d '\$(DESTDIR)$NGX_PREFIX' || mkdir -p '\$(DESTDIR)$NGX_PREFIX'
 
-	test -d '`dirname "$NGX_SBIN_PATH"`' \
-		|| mkdir -p '`dirname "$NGX_SBIN_PATH"`'
-	test ! -f '$NGX_SBIN_PATH' || mv '$NGX_SBIN_PATH' '$NGX_SBIN_PATH.old'
-	cp $NGX_OBJS/nginx '$NGX_SBIN_PATH'
+	test -d '\$(DESTDIR)`dirname "$NGX_SBIN_PATH"`' \
+		|| mkdir -p '\$(DESTDIR)`dirname "$NGX_SBIN_PATH"`'
+	test ! -f '\$(DESTDIR)$NGX_SBIN_PATH' \
+		|| mv '\$(DESTDIR)$NGX_SBIN_PATH' \
+			'\$(DESTDIR)$NGX_SBIN_PATH.old'
+	cp $NGX_OBJS/nginx '\$(DESTDIR)$NGX_SBIN_PATH'
 
-	test -d '$NGX_CONF_PREFIX' || mkdir -p '$NGX_CONF_PREFIX'
+	test -d '\$(DESTDIR)$NGX_CONF_PREFIX' \
+		|| mkdir -p '\$(DESTDIR)$NGX_CONF_PREFIX'
 
-	cp conf/koi-win '$NGX_CONF_PREFIX'
-	cp conf/koi-utf '$NGX_CONF_PREFIX'
-	cp conf/win-utf '$NGX_CONF_PREFIX'
+	cp conf/koi-win '\$(DESTDIR)$NGX_CONF_PREFIX'
+	cp conf/koi-utf '\$(DESTDIR)$NGX_CONF_PREFIX'
+	cp conf/win-utf '\$(DESTDIR)$NGX_CONF_PREFIX'
 
-	test -f '$NGX_CONF_PREFIX/mime.types' \
-		|| cp conf/mime.types '$NGX_CONF_PREFIX'
-	cp conf/mime.types '$NGX_CONF_PREFIX/mime.types.default'
+	test -f '\$(DESTDIR)$NGX_CONF_PREFIX/mime.types' \
+		|| cp conf/mime.types '\$(DESTDIR)$NGX_CONF_PREFIX'
+	cp conf/mime.types '\$(DESTDIR)$NGX_CONF_PREFIX/mime.types.default'
 
-	test -f '$NGX_CONF_PREFIX/fastcgi_params' \
-		|| cp conf/fastcgi_params '$NGX_CONF_PREFIX'
-	cp conf/fastcgi_params '$NGX_CONF_PREFIX/fastcgi_params.default'
+	test -f '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi_params' \
+		|| cp conf/fastcgi_params '\$(DESTDIR)$NGX_CONF_PREFIX'
+	cp conf/fastcgi_params \
+		'\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi_params.default'
 
-	test -f '$NGX_CONF_PATH' || cp conf/nginx.conf '$NGX_CONF_PREFIX'
-	cp conf/nginx.conf '$NGX_CONF_PREFIX/nginx.conf.default'
+	test -f '\$(DESTDIR)$NGX_CONF_PATH' \
+		|| cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PREFIX'
+	cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PREFIX/nginx.conf.default'
 
-	test -d '`dirname "$NGX_PID_PATH"`' \
-		|| mkdir -p '`dirname "$NGX_PID_PATH"`'
+	test -d '\$(DESTDIR)`dirname "$NGX_PID_PATH"`' \
+		|| mkdir -p '\$(DESTDIR)`dirname "$NGX_PID_PATH"`'
 
-	test -d '`dirname "$NGX_HTTP_LOG_PATH"`' || \
-		mkdir -p '`dirname "$NGX_HTTP_LOG_PATH"`'
+	test -d '\$(DESTDIR)`dirname "$NGX_HTTP_LOG_PATH"`' || \
+		mkdir -p '\$(DESTDIR)`dirname "$NGX_HTTP_LOG_PATH"`'
 
-	test -d '$NGX_PREFIX/html' || cp -r html '$NGX_PREFIX'
+	test -d '\$(DESTDIR)$NGX_PREFIX/html' \
+		|| cp -r html '\$(DESTDIR)$NGX_PREFIX'
 END
 
 
-if test -n "$NGX_ERROR_LOG_PATH"; then
+if test -n "\$(DESTDIR)$NGX_ERROR_LOG_PATH"; then
     cat << END                                                >> $NGX_MAKEFILE
 
-	test -d '`dirname "$NGX_ERROR_LOG_PATH"`' || \
-		mkdir -p '`dirname "$NGX_ERROR_LOG_PATH"`'
+	test -d '\$(DESTDIR)`dirname "$NGX_ERROR_LOG_PATH"`' || \
+		mkdir -p '\$(DESTDIR)`dirname "$NGX_ERROR_LOG_PATH"`'
 END
 
 fi
--- a/auto/lib/conf	Mon May 12 00:00:00 2008 +0400
+++ b/auto/lib/conf	Mon Jul 07 00:00:00 2008 +0400
@@ -16,6 +16,7 @@
         have=NGX_HAVE_OPENSSL_MD5_H . auto/have
         have=NGX_OPENSSL_MD5 . auto/have
         MD5=YES
+        MD5_LIB=OpenSSL
 
     else
         . auto/lib/md5/conf
@@ -28,6 +29,7 @@
     if [ $OPENSSL != NONE -a $OPENSSL != NO ]; then
         have=NGX_HAVE_OPENSSL_SHA1_H . auto/have
         SHA1=YES
+        SHA1_LIB=OpenSSL
 
     else
         . auto/lib/sha1/conf
--- a/auto/lib/md5/conf	Mon May 12 00:00:00 2008 +0400
+++ b/auto/lib/md5/conf	Mon Jul 07 00:00:00 2008 +0400
@@ -45,6 +45,7 @@
 else
 
     if [ "$NGX_PLATFORM" != win32 ]; then
+
         MD5=NO
 
         # Solaris 8/9
@@ -58,55 +59,43 @@
         ngx_feature_test="MD5_CTX md5; MD5Init(&md5)"
         . auto/feature
 
-        if [ $ngx_found = yes ]; then
-            CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
-            MD5=YES
-            MD5_LIB=md5
-            ngx_found=no
+        ngx_md5_lib="system md5"
 
-        else
+        if [ $ngx_found = no ]; then
+
             # FreeBSD
 
             ngx_feature="rsaref md library"
-            ngx_feature_name=
-            ngx_feature_run=no
-            ngx_feature_incs="#include <md5.h>"
-            ngx_feature_path=
             ngx_feature_libs="-lmd"
-            ngx_feature_test="MD5_CTX md5; MD5Init(&md5)"
             . auto/feature
+
+            ngx_md5_lib="system md"
         fi
 
+        if [ $ngx_found = no ]; then
+
+            # OpenSSL crypto library
+
+            ngx_feature="OpenSSL md5 crypto library"
+            ngx_feature_name="NGX_OPENSSL_MD5"
+            ngx_feature_incs="#include <openssl/md5.h>"
+            ngx_feature_libs="-lcrypto"
+            ngx_feature_test="MD5_CTX md5; MD5_Init(&md5)"
+            . auto/feature
+
+            ngx_md5_lib="system crypto"
+
+            if [ $ngx_found = yes ]; then
+                have=NGX_HAVE_OPENSSL_MD5_H . auto/have
+            fi
+        fi
 
         if [ $ngx_found = yes ]; then
             CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
             MD5=YES
-            MD5_LIB=md
-            ngx_found=no
-
-        else
-            if [ $MD5 = NO ]; then
-
-                # OpenSSL crypto library
-
-                ngx_feature="OpenSSL md5 crypto library"
-                ngx_feature_name="NGX_OPENSSL_MD5"
-                ngx_feature_run=no
-                ngx_feature_incs="#include <openssl/md5.h>"
-                ngx_feature_path=
-                ngx_feature_libs="-lcrypto"
-                ngx_feature_test="MD5_CTX md5; MD5_Init(&md5)"
-                . auto/feature
-            fi
+            MD5_LIB=$ngx_md5_lib
         fi
 
-
-        if [ $ngx_found = yes ]; then
-            have=NGX_HAVE_OPENSSL_MD5_H . auto/have
-            CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
-            MD5=YES
-            MD5_LIB=crypto
-        fi
     fi
 
 fi
--- a/auto/lib/pcre/conf	Mon May 12 00:00:00 2008 +0400
+++ b/auto/lib/pcre/conf	Mon Jul 07 00:00:00 2008 +0400
@@ -84,6 +84,7 @@
 else
 
     if [ "$NGX_PLATFORM" != win32 ]; then
+
         PCRE=NO
 
         ngx_feature="PCRE library"
@@ -95,20 +96,11 @@
         ngx_feature_test="pcre *re; re = pcre_compile(NULL, 0, NULL, 0, NULL)"
         . auto/feature
 
-        if [ $ngx_found = yes ]; then
-            CORE_DEPS="$CORE_DEPS $REGEX_DEPS"
-            CORE_SRCS="$CORE_SRCS $REGEX_SRCS"
-            CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
-            PCRE=YES
-            ngx_found=no
+        if [ $ngx_found = no ]; then
 
-        else
             # FreeBSD port
 
             ngx_feature="PCRE library in /usr/local/"
-            ngx_feature_name="NGX_PCRE"
-            ngx_feature_run=no
-            ngx_feature_incs="#include <pcre.h>"
             ngx_feature_path="/usr/local/include"
 
             if [ $NGX_RPATH = YES ]; then
@@ -117,8 +109,49 @@
                 ngx_feature_libs="-L/usr/local/lib -lpcre"
             fi
 
-            ngx_feature_test="pcre *re;
-                              re = pcre_compile(NULL, 0, NULL, 0, NULL)"
+            . auto/feature
+        fi
+
+        if [ $ngx_found = no ]; then
+
+            # Linux package
+
+            ngx_feature="PCRE library in /usr/include/pcre/"
+            ngx_feature_path="/usr/include/pcre"
+            ngx_feature_libs="-lpcre"
+
+            . auto/feature
+        fi
+
+        if [ $ngx_found = no ]; then
+
+            # NetBSD port
+
+            ngx_feature="PCRE library in /usr/pkg/"
+            ngx_feature_path="/usr/pkg/include"
+
+            if [ $NGX_RPATH = YES ]; then
+                ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lpcre"
+            else
+                ngx_feature_libs="-L/usr/pkg/lib -lpcre"
+            fi
+
+            . auto/feature
+        fi
+
+        if [ $ngx_found = no ]; then
+
+            # MacPorts
+
+            ngx_feature="PCRE library in /opt/local/"
+            ngx_feature_path="/opt/local/include"
+
+            if [ $NGX_RPATH = YES ]; then
+                ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lpcre"
+            else
+                ngx_feature_libs="-L/opt/local/lib -lpcre"
+            fi
+
             . auto/feature
         fi
 
@@ -128,94 +161,6 @@
             CORE_INCS="$CORE_INCS $ngx_feature_path"
             CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
             PCRE=YES
-            ngx_found=no
-
-        else
-            # Linux package
-
-            if [ $PCRE = NO ]; then
-
-                ngx_feature="PCRE library in /usr/include/pcre/"
-                ngx_feature_name="NGX_PCRE"
-                ngx_feature_run=no
-                ngx_feature_incs="#include <pcre.h>"
-                ngx_feature_path="/usr/include/pcre"
-                ngx_feature_libs="-lpcre"
-                ngx_feature_test="pcre *re;
-                                  re = pcre_compile(NULL, 0, NULL, 0, NULL)"
-                . auto/feature
-            fi
-        fi
-
-        if [ $ngx_found = yes ]; then
-            CORE_DEPS="$CORE_DEPS $REGEX_DEPS"
-            CORE_SRCS="$CORE_SRCS $REGEX_SRCS"
-            CORE_INCS="$CORE_INCS $ngx_feature_path"
-            CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
-            PCRE=YES
-            ngx_found=no
-
-        else
-            # NetBSD port
-
-            if [ $PCRE = NO ]; then
-
-                ngx_feature="PCRE library in /usr/pkg/"
-                ngx_feature_name="NGX_PCRE"
-                ngx_feature_run=no
-                ngx_feature_incs="#include <pcre.h>"
-                ngx_feature_path="/usr/pkg/include"
-
-                if [ $NGX_RPATH = YES ]; then
-                    ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lpcre"
-                else
-                    ngx_feature_libs="-L/usr/pkg/lib -lpcre"
-                fi
-
-                ngx_feature_test="pcre *re;
-                                  re = pcre_compile(NULL, 0, NULL, 0, NULL)"
-                . auto/feature
-            fi
-        fi
-
-        if [ $ngx_found = yes ]; then
-            CORE_DEPS="$CORE_DEPS $REGEX_DEPS"
-            CORE_SRCS="$CORE_SRCS $REGEX_SRCS"
-            CORE_INCS="$CORE_INCS $ngx_feature_path"
-            CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
-            PCRE=YES
-            ngx_found=no
-
-        else
-            # MacPorts
-
-            if [ $PCRE = NO ]; then
-
-                ngx_feature="PCRE library in /opt/local/"
-                ngx_feature_name="NGX_PCRE"
-                ngx_feature_run=no
-                ngx_feature_incs="#include <pcre.h>"
-                ngx_feature_path="/opt/local/include"
-
-                if [ $NGX_RPATH = YES ]; then
-                    ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lpcre"
-                else
-                    ngx_feature_libs="-L/opt/local/lib -lpcre"
-                fi
-
-                ngx_feature_test="pcre *re;
-                                  re = pcre_compile(NULL, 0, NULL, 0, NULL)"
-                . auto/feature
-            fi
-        fi
-
-        if [ $ngx_found = yes ]; then
-            CORE_DEPS="$CORE_DEPS $REGEX_DEPS"
-            CORE_SRCS="$CORE_SRCS $REGEX_SRCS"
-            CORE_INCS="$CORE_INCS $ngx_feature_path"
-            CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
-            PCRE=YES
-            ngx_found=no
         fi
 
     fi
--- a/auto/lib/sha1/conf	Mon May 12 00:00:00 2008 +0400
+++ b/auto/lib/sha1/conf	Mon Jul 07 00:00:00 2008 +0400
@@ -35,6 +35,7 @@
 else
 
     if [ "$NGX_PLATFORM" != win32 ]; then
+
         SHA1=NO
 
         # FreeBSD
@@ -48,35 +49,28 @@
         ngx_feature_test="SHA_CTX sha1; SHA1_Init(&sha1)"
         . auto/feature
 
+        ngx_sha1_lib="system md"
+
+        if [ $ngx_found = no ]; then
+
+            # OpenSSL crypto library
+
+            ngx_feature="OpenSSL sha1 crypto library"
+            ngx_feature_incs="#include <openssl/sha.h>"
+            ngx_feature_libs="-lcrypto"
+            . auto/feature
+
+            ngx_sha1_lib="system crypto"
+
+            if [ $ngx_found = yes ]; then
+                have=NGX_HAVE_OPENSSL_SHA1_H . auto/have
+            fi
+        fi
 
         if [ $ngx_found = yes ]; then
             CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
             SHA1=YES
-            SHA1_LIB=md
-            ngx_found=no
-
-        else
-            if [ $SHA1 = NO ]; then
-
-                # OpenSSL crypto library
-
-                ngx_feature="OpenSSL sha1 crypto library"
-                ngx_feature_name=
-                ngx_feature_run=no
-                ngx_feature_incs="#include <openssl/sha.h>"
-                ngx_feature_path=
-                ngx_feature_libs="-lcrypto"
-                ngx_feature_test="SHA_CTX sha1; SHA1_Init(&sha1)"
-                . auto/feature
-            fi
-        fi
-
-
-        if [ $ngx_found = yes ]; then
-            have=NGX_HAVE_OPENSSL_SHA1_H . auto/have
-            CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
-            SHA1=YES
-            SHA1_LIB=crypto
+            SHA1_LIB=$ngx_sha1_lib
         fi
     fi
 
--- a/auto/summary	Mon May 12 00:00:00 2008 +0400
+++ b/auto/summary	Mon Jul 07 00:00:00 2008 +0400
@@ -51,26 +51,14 @@
 esac
 
 case $MD5 in
-    YES)
-        case $OPENSSL in
-            NONE|NO)  echo "  + md5: using system $MD5_LIB library" ;;
-            *)        echo "  + md5: using OpenSSL library" ;;
-        esac
-        ;;
-
+    YES)   echo "  + md5: using $MD5_LIB library" ;;
     NONE)  echo "  + md5 library is not used" ;;
     NO)    echo "  + md5 library is not found" ;;
     *)     echo "  + using md5 library: $MD5" ;;
 esac
 
 case $SHA1 in
-    YES)
-        case $OPENSSL in
-            NONE|NO)  echo "  + sha1: using system $SHA1_LIB library" ;;
-            *)        echo "  + sha1: using OpenSSL library" ;;
-        esac
-        ;;
-
+    YES)   echo "  + sha1: using $SHA1_LIB library" ;;
     NONE)  echo "  + sha1 library is not used" ;;
     NO)    echo "  + sha1 library is not found" ;;
     *)     echo "  + using sha1 library: $SHA1" ;;
--- a/src/core/nginx.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/core/nginx.c	Mon Jul 07 00:00:00 2008 +0400
@@ -1078,7 +1078,7 @@
             ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
                           "invalid character \"%c\" in \"worker_cpu_affinity\"",
                           ch);
-            return NGX_CONF_ERROR ;
+            return NGX_CONF_ERROR;
         }
     }
 
--- a/src/core/nginx.h	Mon May 12 00:00:00 2008 +0400
+++ b/src/core/nginx.h	Mon Jul 07 00:00:00 2008 +0400
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VERSION      "0.6.31"
+#define NGINX_VERSION      "0.6.32"
 #define NGINX_VER          "nginx/" NGINX_VERSION
 
 #define NGINX_VAR          "NGINX"
--- a/src/core/ngx_config.h	Mon May 12 00:00:00 2008 +0400
+++ b/src/core/ngx_config.h	Mon Jul 07 00:00:00 2008 +0400
@@ -116,10 +116,11 @@
 #define INET_ADDRSTRLEN  16
 #endif
 
-#define NGX_MAXHOSTNAMELEN 64
-/*
-#define NGX_MAXHOSTNAMELEN MAXHOSTNAMELEN
-*/
+#ifdef MAXHOSTNAMELEN
+#define NGX_MAXHOSTNAMELEN  MAXHOSTNAMELEN
+#else
+#define NGX_MAXHOSTNAMELEN  256
+#endif
 
 
 #if ((__GNU__ == 2) && (__GNUC_MINOR__ < 8))
--- a/src/core/ngx_connection.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/core/ngx_connection.c	Mon Jul 07 00:00:00 2008 +0400
@@ -229,7 +229,7 @@
 
     /* TODO: configurable try number */
 
-    for (tries = 5 ; tries; tries--) {
+    for (tries = 5; tries; tries--) {
         failed = 0;
 
         /* for each listening socket */
--- a/src/core/ngx_cycle.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/core/ngx_cycle.c	Mon Jul 07 00:00:00 2008 +0400
@@ -57,6 +57,7 @@
     ngx_listening_t     *ls, *nls;
     ngx_core_conf_t     *ccf, *old_ccf;
     ngx_core_module_t   *module;
+    char                 hostname[NGX_MAXHOSTNAMELEN];
 
     log = old_cycle->log;
 
@@ -170,6 +171,26 @@
     }
 
 
+    if (gethostname(hostname, NGX_MAXHOSTNAMELEN) == -1) {
+        ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "gethostname() failed");
+        ngx_destroy_pool(pool);
+        return NULL;
+    }
+
+    /* on Linux gethostname() silently truncates name that does not fit */
+
+    hostname[NGX_MAXHOSTNAMELEN - 1] = '\0';
+    cycle->hostname.len = ngx_strlen(hostname);
+
+    cycle->hostname.data = ngx_palloc(pool, cycle->hostname.len);
+    if (cycle->hostname.data == NULL) {
+        ngx_destroy_pool(pool);
+        return NULL;
+    }
+
+    ngx_memcpy(cycle->hostname.data, hostname, cycle->hostname.len);
+
+
     for (i = 0; ngx_modules[i]; i++) {
         if (ngx_modules[i]->type != NGX_CORE_MODULE) {
             continue;
--- a/src/core/ngx_cycle.h	Mon May 12 00:00:00 2008 +0400
+++ b/src/core/ngx_cycle.h	Mon Jul 07 00:00:00 2008 +0400
@@ -62,6 +62,7 @@
     ngx_str_t                 conf_file;
     ngx_str_t                 root;
     ngx_str_t                 lock_file;
+    ngx_str_t                 hostname;
 };
 
 
--- a/src/core/ngx_open_file_cache.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/core/ngx_open_file_cache.c	Mon Jul 07 00:00:00 2008 +0400
@@ -413,13 +413,13 @@
 
         if (file->count == 0) {
 
-	    if (file->fd != NGX_INVALID_FILE) {
-		if (ngx_close_file(file->fd) == NGX_FILE_ERROR) {
-		    ngx_log_error(NGX_LOG_ALERT, pool->log, ngx_errno,
-				  ngx_close_file_n " \"%s\" failed",
+            if (file->fd != NGX_INVALID_FILE) {
+                if (ngx_close_file(file->fd) == NGX_FILE_ERROR) {
+                    ngx_log_error(NGX_LOG_ALERT, pool->log, ngx_errno,
+                                  ngx_close_file_n " \"%s\" failed",
                                   file->name);
-		}
-	    }
+                }
+            }
 
             ngx_free(file->name);
             ngx_free(file);
--- a/src/core/ngx_resolver.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/core/ngx_resolver.c	Mon Jul 07 00:00:00 2008 +0400
@@ -202,7 +202,7 @@
         ngx_queue_remove(&rn->queue);
 
         for (ctx = rn->waiting; ctx; ctx = next) {
-            next = ctx->next; 
+            next = ctx->next;
 
             if (ctx->event) {
                 ngx_resolver_free(r, ctx->event);
--- a/src/core/ngx_string.h	Mon May 12 00:00:00 2008 +0400
+++ b/src/core/ngx_string.h	Mon Jul 07 00:00:00 2008 +0400
@@ -25,11 +25,12 @@
 
 
 typedef struct {
-    unsigned    len:29;
+    unsigned    len:28;
 
     unsigned    valid:1;
     unsigned    no_cacheable:1;
     unsigned    not_found:1;
+    unsigned    escape:1;
 
     u_char     *data;
 } ngx_variable_value_t;
--- a/src/event/modules/ngx_kqueue_module.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/event/modules/ngx_kqueue_module.c	Mon Jul 07 00:00:00 2008 +0400
@@ -446,7 +446,7 @@
     || __FreeBSD_version >= 500018
                                  |NOTE_REVOKE
 #endif
-                                       ;
+                      ;
         kev->data = 0;
 
     } else {
--- a/src/event/ngx_event.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/event/ngx_event.c	Mon Jul 07 00:00:00 2008 +0400
@@ -942,7 +942,7 @@
     ngx_str_t  *value;
 
     if (ecf->connections != NGX_CONF_UNSET_UINT) {
-        return "is duplicate" ;
+        return "is duplicate";
     }
 
     if (ngx_strcmp(cmd->name.data, "connections") == 0) {
@@ -977,7 +977,7 @@
     ngx_event_module_t   *module;
 
     if (ecf->use != NGX_CONF_UNSET_UINT) {
-        return "is duplicate" ;
+        return "is duplicate";
     }
 
     value = cf->args->elts;
--- a/src/event/ngx_event_openssl.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/event/ngx_event_openssl.c	Mon Jul 07 00:00:00 2008 +0400
@@ -590,6 +590,11 @@
         }
 
         if (bytes) {
+
+            if (n == 0 || n == NGX_ERROR) {
+                c->read->ready = 1;
+            }
+
             return bytes;
         }
 
@@ -1267,6 +1272,29 @@
         return NGX_OK;
     }
 
+    if (builtin_session_cache == NGX_SSL_NONE_SCACHE) {
+
+        /*
+         * If the server explicitly says that it does not support
+         * session reuse (see SSL_SESS_CACHE_OFF above), then
+         * Outlook Express fails to upload a sent email to
+         * the Sent Items folder on the IMAP server via a separate IMAP
+         * connection in the background. Therefore we have a special
+         * mode (SSL_SESS_CACHE_SERVER|SSL_SESS_CACHE_NO_INTERNAL_STORE)
+         * where the server pretends that it supports session reuse,
+         * but it does not actually store any session.
+         */
+
+        SSL_CTX_set_session_cache_mode(ssl->ctx,
+                                       SSL_SESS_CACHE_SERVER
+                                       |SSL_SESS_CACHE_NO_AUTO_CLEAR
+                                       |SSL_SESS_CACHE_NO_INTERNAL_STORE);
+
+        SSL_CTX_sess_set_cache_size(ssl->ctx, 1);
+
+        return NGX_OK;
+    }
+
     cache_mode = SSL_SESS_CACHE_SERVER;
 
     if (shm_zone && builtin_session_cache == NGX_SSL_NO_BUILTIN_SCACHE) {
--- a/src/event/ngx_event_openssl.h	Mon May 12 00:00:00 2008 +0400
+++ b/src/event/ngx_event_openssl.h	Mon Jul 07 00:00:00 2008 +0400
@@ -51,9 +51,10 @@
 } ngx_ssl_connection_t;
 
 
-#define NGX_SSL_DFLT_BUILTIN_SCACHE  -2
-#define NGX_SSL_NO_BUILTIN_SCACHE    -3
-#define NGX_SSL_NO_SCACHE            -4
+#define NGX_SSL_NO_SCACHE            -2
+#define NGX_SSL_NONE_SCACHE          -3
+#define NGX_SSL_NO_BUILTIN_SCACHE    -4
+#define NGX_SSL_DFLT_BUILTIN_SCACHE  -5
 
 
 #define NGX_SSL_MAX_SESSION_SIZE  4096
--- a/src/event/ngx_event_pipe.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/event/ngx_event_pipe.c	Mon Jul 07 00:00:00 2008 +0400
@@ -880,7 +880,7 @@
 
     ll = free;
 
-    for (cl = *free ; cl; cl = cl->next) {
+    for (cl = *free; cl; cl = cl->next) {
         if (cl->buf == s) {
             *ll = cl->next;
             break;
--- a/src/http/modules/ngx_http_dav_module.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/http/modules/ngx_http_dav_module.c	Mon Jul 07 00:00:00 2008 +0400
@@ -512,7 +512,7 @@
 static ngx_int_t
 ngx_http_dav_copy_move_handler(ngx_http_request_t *r)
 {
-    u_char                   *p, *desthost, *last, ch;
+    u_char                   *p, *host, *last, ch;
     size_t                    len, root;
     ngx_err_t                 err;
     ngx_int_t                 rc, depth;
@@ -520,7 +520,7 @@
     ngx_str_t                 path, uri;
     ngx_tree_ctx_t            tree;
     ngx_file_info_t           fi;
-    ngx_table_elt_t          *host, *dest, *over;
+    ngx_table_elt_t          *dest, *over;
     ngx_http_dav_copy_ctx_t   copy;
     ngx_http_dav_loc_conf_t  *dlcf;
 
@@ -536,9 +536,9 @@
         return NGX_HTTP_BAD_REQUEST;
     }
 
-    host = r->headers_in.host;
+    len = r->headers_in.server.len;
 
-    if (host == NULL) {
+    if (len == 0) {
         ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
                       "client sent no \"Host\" header");
         return NGX_HTTP_BAD_REQUEST;
@@ -553,7 +553,7 @@
             goto invalid_destination;
         }
 
-        desthost = dest->value.data + sizeof("https://") - 1;
+        host = dest->value.data + sizeof("https://") - 1;
 
     } else
 #endif
@@ -564,12 +564,10 @@
             goto invalid_destination;
         }
 
-        desthost = dest->value.data + sizeof("http://") - 1;
+        host = dest->value.data + sizeof("http://") - 1;
     }
 
-    len = r->headers_in.host_name_len;
-
-    if (ngx_strncmp(desthost, host->value.data, len) != 0) {
+    if (ngx_strncmp(host, r->headers_in.server.data, len) != 0) {
         ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
                       "\"Destination\" URI \"%V\" is handled by "
                       "different repository than the source URI",
@@ -579,7 +577,7 @@
 
     last = dest->value.data + dest->value.len;
 
-    for (p = desthost + len; p < last; p++) {
+    for (p = host + len; p < last; p++) {
         if (*p == '/') {
             goto destination_done;
         }
--- a/src/http/modules/ngx_http_headers_filter_module.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/http/modules/ngx_http_headers_filter_module.c	Mon Jul 07 00:00:00 2008 +0400
@@ -31,18 +31,20 @@
 };
 
 
+#define NGX_HTTP_EXPIRES_OFF       0
+#define NGX_HTTP_EXPIRES_EPOCH     1
+#define NGX_HTTP_EXPIRES_MAX       2
+#define NGX_HTTP_EXPIRES_ACCESS    3
+#define NGX_HTTP_EXPIRES_MODIFIED  4
+
+
 typedef struct {
-    time_t                   expires;
+    ngx_uint_t               expires;
+    time_t                   expires_time;
     ngx_array_t             *headers;
 } ngx_http_headers_conf_t;
 
 
-#define NGX_HTTP_EXPIRES_UNSET   -2147483647
-#define NGX_HTTP_EXPIRES_OFF     -2147483646
-#define NGX_HTTP_EXPIRES_EPOCH   -2147483645
-#define NGX_HTTP_EXPIRES_MAX     -2147483644
-
-
 static ngx_int_t ngx_http_set_expires(ngx_http_request_t *r,
     ngx_http_headers_conf_t *conf);
 static ngx_int_t ngx_http_add_cache_control(ngx_http_request_t *r,
@@ -76,7 +78,7 @@
 
     { ngx_string("expires"),
       NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
-                        |NGX_CONF_TAKE1,
+                        |NGX_CONF_TAKE12,
       ngx_http_headers_expires,
       NGX_HTTP_LOC_CONF_OFFSET,
       0,
@@ -185,6 +187,7 @@
 ngx_http_set_expires(ngx_http_request_t *r, ngx_http_headers_conf_t *conf)
 {
     size_t            len;
+    time_t            since;
     ngx_uint_t        i;
     ngx_table_elt_t  *expires, *cc, **ccp;
 
@@ -266,7 +269,7 @@
         return NGX_ERROR;
     }
 
-    if (conf->expires == 0) {
+    if (conf->expires_time == 0) {
         ngx_memcpy(expires->value.data, ngx_cached_http_time.data,
                    ngx_cached_http_time.len + 1);
 
@@ -276,9 +279,18 @@
         return NGX_OK;
     }
 
-    ngx_http_time(expires->value.data, ngx_time() + conf->expires);
+    if (conf->expires == NGX_HTTP_EXPIRES_ACCESS
+        || r->headers_out.last_modified_time == -1)
+    {
+        since = ngx_time();
 
-    if (conf->expires < 0) {
+    } else {
+        since = r->headers_out.last_modified_time;
+    }
+
+    ngx_http_time(expires->value.data, since + conf->expires_time);
+
+    if (conf->expires_time < 0) {
         cc->value.len = sizeof("no-cache") - 1;
         cc->value.data = (u_char *) "no-cache";
 
@@ -291,7 +303,8 @@
         return NGX_ERROR;
     }
 
-    cc->value.len = ngx_sprintf(cc->value.data, "max-age=%T", conf->expires)
+    cc->value.len = ngx_sprintf(cc->value.data, "max-age=%T",
+                                since + conf->expires_time - ngx_time())
                     - cc->value.data;
 
     return NGX_OK;
@@ -413,9 +426,10 @@
      * set by ngx_pcalloc():
      *
      *     conf->headers = NULL;
+     *     conf->expires_time = 0;
      */
 
-    conf->expires = NGX_HTTP_EXPIRES_UNSET;
+    conf->expires = NGX_CONF_UNSET_UINT;
 
     return conf;
 }
@@ -427,9 +441,13 @@
     ngx_http_headers_conf_t *prev = parent;
     ngx_http_headers_conf_t *conf = child;
 
-    if (conf->expires == NGX_HTTP_EXPIRES_UNSET) {
-        conf->expires = (prev->expires == NGX_HTTP_EXPIRES_UNSET) ?
-                            NGX_HTTP_EXPIRES_OFF : prev->expires;
+    if (conf->expires == NGX_CONF_UNSET_UINT) {
+        conf->expires = prev->expires;
+        conf->expires_time = prev->expires_time;
+
+        if (conf->expires == NGX_CONF_UNSET_UINT) {
+            conf->expires = NGX_HTTP_EXPIRES_OFF;
+        }
     }
 
     if (conf->headers == NULL) {
@@ -455,56 +473,73 @@
 {
     ngx_http_headers_conf_t *hcf = conf;
 
-    ngx_uint_t   minus;
+    ngx_uint_t   minus, n;
     ngx_str_t   *value;
 
-    if (hcf->expires != NGX_HTTP_EXPIRES_UNSET) {
+    if (hcf->expires != NGX_CONF_UNSET_UINT) {
         return "is duplicate";
     }
 
     value = cf->args->elts;
 
-    if (ngx_strcmp(value[1].data, "epoch") == 0) {
-        hcf->expires = NGX_HTTP_EXPIRES_EPOCH;
-        return NGX_CONF_OK;
-    }
+    if (cf->args->nelts == 2) {
+
+        if (ngx_strcmp(value[1].data, "epoch") == 0) {
+            hcf->expires = NGX_HTTP_EXPIRES_EPOCH;
+            return NGX_CONF_OK;
+        }
+
+        if (ngx_strcmp(value[1].data, "max") == 0) {
+            hcf->expires = NGX_HTTP_EXPIRES_MAX;
+            return NGX_CONF_OK;
+        }
 
-    if (ngx_strcmp(value[1].data, "max") == 0) {
-        hcf->expires = NGX_HTTP_EXPIRES_MAX;
-        return NGX_CONF_OK;
+        if (ngx_strcmp(value[1].data, "off") == 0) {
+            hcf->expires = NGX_HTTP_EXPIRES_OFF;
+            return NGX_CONF_OK;
+        }
+
+        hcf->expires = NGX_HTTP_EXPIRES_ACCESS;
+
+        n = 1;
+
+    } else { /* cf->args->nelts == 3 */
+
+        if (ngx_strcmp(value[1].data, "modified") != 0) {
+            return "invalid value";
+        }
+
+        hcf->expires = NGX_HTTP_EXPIRES_MODIFIED;
+
+        n = 2;
     }
 
-    if (ngx_strcmp(value[1].data, "off") == 0) {
-        hcf->expires = NGX_HTTP_EXPIRES_OFF;
-        return NGX_CONF_OK;
-    }
-
-    if (value[1].data[0] == '+') {
-        value[1].data++;
-        value[1].len--;
+    if (value[n].data[0] == '+') {
+        value[n].data++;
+        value[n].len--;
         minus = 0;
 
-    } else if (value[1].data[0] == '-') {
-        value[1].data++;
-        value[1].len--;
+    } else if (value[n].data[0] == '-') {
+        value[n].data++;
+        value[n].len--;
         minus = 1;
 
     } else {
         minus = 0;
     }
 
-    hcf->expires = ngx_parse_time(&value[1], 1);
+    hcf->expires_time = ngx_parse_time(&value[n], 1);
 
-    if (hcf->expires == NGX_ERROR) {
+    if (hcf->expires_time == NGX_ERROR) {
         return "invalid value";
     }
 
-    if (hcf->expires == NGX_PARSE_LARGE_TIME) {
+    if (hcf->expires_time == NGX_PARSE_LARGE_TIME) {
         return "value must be less than 68 years";
     }
 
     if (minus) {
-        hcf->expires = - hcf->expires;
+        hcf->expires_time = - hcf->expires_time;
     }
 
     return NGX_CONF_OK;
--- a/src/http/modules/ngx_http_log_module.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/http/modules/ngx_http_log_module.c	Mon Jul 07 00:00:00 2008 +0400
@@ -88,6 +88,7 @@
     uintptr_t data);
 static u_char *ngx_http_log_variable(ngx_http_request_t *r, u_char *buf,
     ngx_http_log_op_t *op);
+static uintptr_t ngx_http_log_escape(u_char *dst, u_char *src, size_t size);
 
 
 static void *ngx_http_log_create_main_conf(ngx_conf_t *cf);
@@ -478,6 +479,7 @@
 static size_t
 ngx_http_log_variable_getlen(ngx_http_request_t *r, uintptr_t data)
 {
+    uintptr_t                   len;
     ngx_http_variable_value_t  *value;
 
     value = ngx_http_get_indexed_variable(r, data);
@@ -486,7 +488,11 @@
         return 1;
     }
 
-    return value->len;
+    len = ngx_http_log_escape(NULL, value->data, value->len);
+
+    value->escape = len ? 1 : 0;
+
+    return value->len + len * 3;
 }
 
 
@@ -502,7 +508,70 @@
         return buf + 1;
     }
 
-    return ngx_cpymem(buf, value->data, value->len);
+    if (value->escape == 0) {
+        return ngx_cpymem(buf, value->data, value->len);
+
+    } else {
+        return (u_char *) ngx_http_log_escape(buf, value->data, value->len);
+    }
+}
+
+
+static uintptr_t
+ngx_http_log_escape(u_char *dst, u_char *src, size_t size)
+{
+    ngx_uint_t      i, n;
+    static u_char   hex[] = "0123456789ABCDEF";
+
+    static uint32_t   escape[] = {
+        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
+
+                    /* ?>=< ;:98 7654 3210  /.-, +*)( '&%$ #"!  */
+        0x00000004, /* 0000 0000 0000 0000  0000 0000 0000 0100 */
+
+                    /* _^]\ [ZYX WVUT SRQP  ONML KJIH GFED CBA@ */
+        0x10000000, /* 0001 0000 0000 0000  0000 0000 0000 0000 */
+
+                    /*  ~}| {zyx wvut srqp  onml kjih gfed cba` */
+        0x00000000, /* 0000 0000 0000 0000  0000 0000 0000 0000 */
+
+        0x00000000, /* 0000 0000 0000 0000  0000 0000 0000 0000 */
+        0x00000000, /* 0000 0000 0000 0000  0000 0000 0000 0000 */
+        0x00000000, /* 0000 0000 0000 0000  0000 0000 0000 0000 */
+        0x00000000, /* 0000 0000 0000 0000  0000 0000 0000 0000 */
+    };
+
+
+    if (dst == NULL) {
+
+        /* find the number of the characters to be escaped */
+
+        n  = 0;
+
+        for (i = 0; i < size; i++) {
+            if (escape[*src >> 5] & (1 << (*src & 0x1f))) {
+                n++;
+            }
+            src++;
+        }
+
+        return (uintptr_t) n;
+    }
+
+    for (i = 0; i < size; i++) {
+        if (escape[*src >> 5] & (1 << (*src & 0x1f))) {
+            *dst++ = '\\';
+            *dst++ = 'x';
+            *dst++ = hex[*src >> 4];
+            *dst++ = hex[*src & 0xf];
+            src++;
+
+        } else {
+            *dst++ = *src++;
+        }
+    }
+
+    return (uintptr_t) dst;
 }
 
 
--- a/src/http/modules/ngx_http_proxy_module.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/http/modules/ngx_http_proxy_module.c	Mon Jul 07 00:00:00 2008 +0400
@@ -1224,7 +1224,7 @@
 
     umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module);
 
-    for ( ;;  ) {
+    for ( ;; ) {
 
         rc = ngx_http_parse_header_line(r, &r->upstream->buffer);
 
--- a/src/http/modules/ngx_http_ssi_filter_module.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/http/modules/ngx_http_ssi_filter_module.c	Mon Jul 07 00:00:00 2008 +0400
@@ -100,7 +100,7 @@
     ngx_http_ssi_ctx_t *ctx, ngx_str_t **params);
 
 static ngx_int_t ngx_http_ssi_date_gmt_local_variable(ngx_http_request_t *r,
-    ngx_http_variable_value_t *v,  uintptr_t gmt);
+    ngx_http_variable_value_t *v, uintptr_t gmt);
 
 static char *ngx_http_ssi_types(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
 
@@ -558,8 +558,9 @@
                     if (b->in_file) {
                         if (slcf->min_file_chunk < (size_t) (b->last - b->pos))
                         {
-                            b->file_last = b->file_pos + (b->last - b->start);
-                            b->file_pos += b->pos - b->start;
+                            b->file_last = b->file_pos
+                                                   + (b->last - ctx->buf->pos);
+                            b->file_pos += b->pos - ctx->buf->pos;
 
                         } else {
                             b->in_file = 0;
@@ -1637,7 +1638,7 @@
 
         quoted = 0;
 
-        for (i = 0 ; i < text->len; i++) {
+        for (i = 0; i < text->len; i++) {
             ch = text->data[i];
 
             if (!quoted) {
@@ -2647,7 +2648,7 @@
 
 static ngx_int_t
 ngx_http_ssi_date_gmt_local_variable(ngx_http_request_t *r,
-    ngx_http_variable_value_t *v,  uintptr_t gmt)
+    ngx_http_variable_value_t *v, uintptr_t gmt)
 {
     ngx_http_ssi_ctx_t  *ctx;
     ngx_time_t          *tp;
--- a/src/http/modules/ngx_http_ssl_module.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/http/modules/ngx_http_ssl_module.c	Mon Jul 07 00:00:00 2008 +0400
@@ -415,7 +415,7 @@
     }
 
     ngx_conf_merge_value(conf->builtin_session_cache,
-                         prev->builtin_session_cache, NGX_SSL_NO_SCACHE);
+                         prev->builtin_session_cache, NGX_SSL_NONE_SCACHE);
 
     if (conf->shm_zone == NULL) {
         conf->shm_zone = prev->shm_zone;
@@ -452,6 +452,11 @@
             continue;
         }
 
+        if (ngx_strcmp(value[i].data, "none") == 0) {
+            sscf->builtin_session_cache = NGX_SSL_NONE_SCACHE;
+            continue;
+        }
+
         if (ngx_strcmp(value[i].data, "builtin") == 0) {
             sscf->builtin_session_cache = NGX_SSL_DFLT_BUILTIN_SCACHE;
             continue;
--- a/src/http/modules/ngx_http_sub_filter_module.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/http/modules/ngx_http_sub_filter_module.c	Mon Jul 07 00:00:00 2008 +0400
@@ -322,8 +322,8 @@
                 b->recycled = 0;
 
                 if (b->in_file) {
-                    b->file_last = b->file_pos + (b->last - b->start);
-                    b->file_pos += b->pos - b->start;
+                    b->file_last = b->file_pos + (b->last - ctx->buf->pos);
+                    b->file_pos += b->pos - ctx->buf->pos;
                 }
 
                 cl->next = NULL;
--- a/src/http/modules/ngx_http_userid_filter_module.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/http/modules/ngx_http_userid_filter_module.c	Mon Jul 07 00:00:00 2008 +0400
@@ -41,15 +41,14 @@
 } ngx_http_userid_ctx_t;
 
 
-static void ngx_http_userid_get_uid(ngx_http_request_t *r,
-    ngx_http_userid_ctx_t *ctx, ngx_http_userid_conf_t *conf);
+static ngx_http_userid_ctx_t *ngx_http_userid_get_uid(ngx_http_request_t *r,
+    ngx_http_userid_conf_t *conf);
+static ngx_int_t ngx_http_userid_variable(ngx_http_request_t *r,
+    ngx_http_variable_value_t *v, ngx_str_t *name, uint32_t *uid);
 static ngx_int_t ngx_http_userid_set_uid(ngx_http_request_t *r,
     ngx_http_userid_ctx_t *ctx, ngx_http_userid_conf_t *conf);
 
 static ngx_int_t ngx_http_userid_add_variables(ngx_conf_t *cf);
-static ngx_int_t ngx_http_userid_variable(ngx_http_request_t *r,
-    ngx_http_variable_value_t *v, uintptr_t data);
-
 static ngx_int_t ngx_http_userid_init(ngx_conf_t *cf);
 static void *ngx_http_userid_create_conf(ngx_conf_t *cf);
 static char *ngx_http_userid_merge_conf(ngx_conf_t *cf, void *parent,
@@ -191,7 +190,6 @@
 static ngx_int_t
 ngx_http_userid_filter(ngx_http_request_t *r)
 {
-    ngx_int_t                rc;
     ngx_http_userid_ctx_t   *ctx;
     ngx_http_userid_conf_t  *conf;
 
@@ -201,25 +199,18 @@
 
     conf = ngx_http_get_module_loc_conf(r, ngx_http_userid_filter_module);
 
-    if (conf->enable == NGX_HTTP_USERID_OFF) {
+    if (conf->enable <= NGX_HTTP_USERID_LOG) {
         return ngx_http_next_header_filter(r);
     }
 
+    ctx = ngx_http_userid_get_uid(r, conf);
 
-    ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_userid_ctx_t));
     if (ctx == NULL) {
         return NGX_ERROR;
     }
 
-    ngx_http_set_ctx(r, ctx, ngx_http_userid_filter_module);
-
-    ngx_http_userid_get_uid(r, ctx, conf);
+    if (ctx->uid_got[3] != 0) {
 
-    if (conf->enable == NGX_HTTP_USERID_LOG) {
-        return ngx_http_next_header_filter(r);
-    }
-
-    if (ctx->uid_got[3] != 0) {
         if (conf->mark == '\0') {
             return ngx_http_next_header_filter(r);
 
@@ -233,28 +224,95 @@
         }
     }
 
-    rc = ngx_http_userid_set_uid(r, ctx, conf);
+    /* ctx->status == NGX_DECLINED */
 
-    if (rc != NGX_OK) {
-        return rc;
+    if (ngx_http_userid_set_uid(r, ctx, conf) == NGX_OK) {
+        return ngx_http_next_header_filter(r);
     }
 
-    return ngx_http_next_header_filter(r);
+    return NGX_ERROR;
+}
+
+
+static ngx_int_t
+ngx_http_userid_got_variable(ngx_http_request_t *r,
+    ngx_http_variable_value_t *v, uintptr_t data)
+{
+    ngx_http_userid_ctx_t   *ctx;
+    ngx_http_userid_conf_t  *conf;
+
+    conf = ngx_http_get_module_loc_conf(r->main, ngx_http_userid_filter_module);
+
+    if (conf->enable == NGX_HTTP_USERID_OFF) {
+        v->not_found = 1;
+        return NGX_OK;
+    }
+
+    ctx = ngx_http_userid_get_uid(r, conf);
+
+    if (ctx == NULL) {
+        return NGX_ERROR;
+    }
+
+    if (ctx->uid_got[3] != 0) {
+        return ngx_http_userid_variable(r, v, &conf->name, ctx->uid_got);
+    }
+
+    /* ctx->status == NGX_DECLINED */
+
+    v->not_found = 1;
+
+    return NGX_OK;
 }
 
 
-static void
-ngx_http_userid_get_uid(ngx_http_request_t *r, ngx_http_userid_ctx_t *ctx,
-    ngx_http_userid_conf_t *conf)
+static ngx_int_t
+ngx_http_userid_set_variable(ngx_http_request_t *r,
+    ngx_http_variable_value_t *v, uintptr_t data)
 {
-    ngx_int_t          n;
-    ngx_str_t          src, dst;
-    ngx_table_elt_t  **cookies;
+    ngx_http_userid_ctx_t   *ctx;
+    ngx_http_userid_conf_t  *conf;
+
+    ctx = ngx_http_get_module_ctx(r, ngx_http_userid_filter_module);
+
+    if (ctx == NULL || ctx->uid_set[3] == 0) {
+        v->not_found = 1;
+        return NGX_OK;
+    }
+
+    conf = ngx_http_get_module_loc_conf(r, ngx_http_userid_filter_module);
+
+    return ngx_http_userid_variable(r, v, &conf->name, ctx->uid_set);
+}
+
+
+static ngx_http_userid_ctx_t *
+ngx_http_userid_get_uid(ngx_http_request_t *r, ngx_http_userid_conf_t *conf)
+{
+    ngx_int_t                n;
+    ngx_str_t                src, dst;
+    ngx_table_elt_t        **cookies;
+    ngx_http_userid_ctx_t   *ctx;
+
+    ctx = ngx_http_get_module_ctx(r, ngx_http_userid_filter_module);
+
+    if (ctx) {
+        return ctx;
+    }
+
+    if (ctx == NULL) {
+        ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_userid_ctx_t));
+        if (ctx == NULL) {
+            return NULL;
+        }
+
+        ngx_http_set_ctx(r, ctx, ngx_http_userid_filter_module);
+    }
 
     n = ngx_http_parse_multi_header_lines(&r->headers_in.cookies, &conf->name,
                                           &ctx->cookie);
     if (n == NGX_DECLINED) {
-        return;
+        return ctx;
     }
 
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
@@ -265,7 +323,7 @@
         ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
                       "client sent too short userid cookie \"%V\"",
                       &cookies[n]->value);
-        return;
+        return ctx;
     }
 
     src = ctx->cookie;
@@ -286,13 +344,15 @@
         ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
                       "client sent invalid userid cookie \"%V\"",
                       &cookies[n]->value);
-        return;
+        return ctx;
     }
 
     ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                    "uid: %08XD%08XD%08XD%08XD",
                    ctx->uid_got[0], ctx->uid_got[1],
                    ctx->uid_got[2], ctx->uid_got[3]);
+
+    return ctx;
 }
 
 
@@ -304,7 +364,6 @@
     size_t            len;
     ngx_str_t         src, dst;
     ngx_table_elt_t  *set_cookie, *p3p;
-
     /*
      * TODO: in the threaded mode the sequencers should be in TLS and their
      * ranges should be divided between threads
@@ -433,50 +492,10 @@
 
 
 static ngx_int_t
-ngx_http_userid_add_variables(ngx_conf_t *cf)
+ngx_http_userid_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
+    ngx_str_t *name, uint32_t *uid)
 {
-    ngx_http_variable_t  *var;
-
-    var = ngx_http_add_variable(cf, &ngx_http_userid_got, NGX_HTTP_VAR_NOHASH);
-    if (var == NULL) {
-        return NGX_ERROR;
-    }
-
-    var->get_handler = ngx_http_userid_variable;
-    var->data = offsetof(ngx_http_userid_ctx_t, uid_got);
-
-    var = ngx_http_add_variable(cf, &ngx_http_userid_set, NGX_HTTP_VAR_NOHASH);
-    if (var == NULL) {
-        return NGX_ERROR;
-    }
-
-    var->get_handler = ngx_http_userid_variable;
-    var->data = offsetof(ngx_http_userid_ctx_t, uid_set);
-
-    return NGX_OK;
-}
-
-
-static ngx_int_t
-ngx_http_userid_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
-    uintptr_t data)
-{
-    uint32_t                *uid;
-    ngx_http_userid_ctx_t   *ctx;
-    ngx_http_userid_conf_t  *conf;
-
-    ctx = ngx_http_get_module_ctx(r, ngx_http_userid_filter_module);
-
-    uid = (uint32_t *) ((char *) ctx + data);
-
-    if (ctx == NULL || uid[3] == 0) {
-        v->not_found = 1;
-        return NGX_OK;
-    }
-
-    conf = ngx_http_get_module_loc_conf(r, ngx_http_userid_filter_module);
-
-    v->len = conf->name.len + sizeof("=00001111222233334444555566667777") - 1;
+    v->len = name->len + sizeof("=00001111222233334444555566667777") - 1;
     v->data = ngx_palloc(r->pool, v->len);
     if (v->data == NULL) {
         return NGX_ERROR;
@@ -487,7 +506,30 @@
     v->not_found = 0;
 
     ngx_sprintf(v->data, "%V=%08XD%08XD%08XD%08XD",
-                &conf->name, uid[0], uid[1], uid[2], uid[3]);
+                name, uid[0], uid[1], uid[2], uid[3]);
+
+    return NGX_OK;
+}
+
+
+static ngx_int_t
+ngx_http_userid_add_variables(ngx_conf_t *cf)
+{
+    ngx_http_variable_t  *var;
+
+    var = ngx_http_add_variable(cf, &ngx_http_userid_got, NGX_HTTP_VAR_NOHASH);
+    if (var == NULL) {
+        return NGX_ERROR;
+    }
+
+    var->get_handler = ngx_http_userid_got_variable;
+
+    var = ngx_http_add_variable(cf, &ngx_http_userid_set, NGX_HTTP_VAR_NOHASH);
+    if (var == NULL) {
+        return NGX_ERROR;
+    }
+
+    var->get_handler = ngx_http_userid_set_variable;
 
     return NGX_OK;
 }
--- a/src/http/modules/perl/nginx.pm	Mon May 12 00:00:00 2008 +0400
+++ b/src/http/modules/perl/nginx.pm	Mon Jul 07 00:00:00 2008 +0400
@@ -47,7 +47,7 @@
     HTTP_INSUFFICIENT_STORAGE
 );
 
-our $VERSION = '0.6.31';
+our $VERSION = '0.6.32';
 
 require XSLoader;
 XSLoader::load('nginx', $VERSION);
--- a/src/http/ngx_http_core_module.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/http/ngx_http_core_module.c	Mon Jul 07 00:00:00 2008 +0400
@@ -2606,20 +2606,7 @@
     }
 
     if (conf->server_name.data == NULL) {
-        conf->server_name.data = ngx_palloc(cf->pool, NGX_MAXHOSTNAMELEN);
-        if (conf->server_name.data == NULL) {
-            return NGX_CONF_ERROR;
-        }
-
-        if (gethostname((char *) conf->server_name.data, NGX_MAXHOSTNAMELEN)
-            == -1)
-        {
-            ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
-                               "gethostname() failed");
-            return NGX_CONF_ERROR;
-        }
-
-        conf->server_name.len = ngx_strlen(conf->server_name.data);
+        conf->server_name = cf->cycle->hostname;
 
         sn = ngx_array_push(&conf->server_names);
         if (sn == NULL) {
@@ -2922,7 +2909,7 @@
                 return NGX_CONF_ERROR;
             }
         }
- 
+
         conf->resolver = prev->resolver;
     }
 
@@ -3216,8 +3203,7 @@
         value[i].len--;
         value[i].data++;
 
-        sn->regex = ngx_regex_compile(&value[i], NGX_REGEX_CASELESS, cf->pool,
-                                      &err);
+        sn->regex = ngx_regex_compile(&value[i], 0, cf->pool, &err);
 
         if (sn->regex == NULL) {
             ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%s", err.data);
--- a/src/http/ngx_http_core_module.h	Mon May 12 00:00:00 2008 +0400
+++ b/src/http/ngx_http_core_module.h	Mon Jul 07 00:00:00 2008 +0400
@@ -255,10 +255,10 @@
     ngx_array_t  *locations;
 
     /* pointer to the modules' loc_conf */
-    void        **loc_conf ;
+    void        **loc_conf;
 
     uint32_t      limit_except;
-    void        **limit_except_loc_conf ;
+    void        **limit_except_loc_conf;
 
     ngx_http_handler_pt  handler;
 
@@ -401,7 +401,7 @@
                                                                               \
     r->allow_ranges = 0;                                                      \
     if (r->headers_out.accept_ranges) {                                       \
-        r->headers_out.accept_ranges->hash = 0 ;                              \
+        r->headers_out.accept_ranges->hash = 0;                               \
         r->headers_out.accept_ranges = NULL;                                  \
     }
 
--- a/src/http/ngx_http_header_filter_module.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/http/ngx_http_header_filter_module.c	Mon Jul 07 00:00:00 2008 +0400
@@ -286,9 +286,8 @@
             cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
             host = cscf->server_name;
 
-        } else if (r->headers_in.host) {
-            host.len = r->headers_in.host_name_len;
-            host.data = r->headers_in.host->value.data;
+        } else if (r->headers_in.server.len) {
+            host = r->headers_in.server;
 
         } else {
             host.data = addr;
@@ -537,7 +536,7 @@
         }
 
         b->last = ngx_copy(b->last, header[i].key.data, header[i].key.len);
-        *b->last++ = ':' ; *b->last++ = ' ' ;
+        *b->last++ = ':'; *b->last++ = ' ';
 
         b->last = ngx_copy(b->last, header[i].value.data, header[i].value.len);
         *b->last++ = CR; *b->last++ = LF;
--- a/src/http/ngx_http_postpone_filter_module.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/http/ngx_http_postpone_filter_module.c	Mon Jul 07 00:00:00 2008 +0400
@@ -168,7 +168,7 @@
         pr = r->postponed;
 
         if (pr == NULL) {
-            return NGX_OK;
+            break;
         }
 
         if (pr->request) {
@@ -196,7 +196,7 @@
         }
 
         if (pr == NULL) {
-            return NGX_OK;
+            break;
         }
 
         out = pr->out;
@@ -215,6 +215,17 @@
 
         r->postponed = r->postponed->next;
     }
+
+    if (r->out) {
+        ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+                       "http postpone filter out again \"%V?%V\"",
+                       &r->uri, &r->args);
+
+        r->connection->data = r;
+        return NGX_AGAIN;
+    }
+
+    return NGX_OK;
 }
 
 
--- a/src/http/ngx_http_request.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/http/ngx_http_request.c	Mon Jul 07 00:00:00 2008 +0400
@@ -21,15 +21,20 @@
     ngx_table_elt_t *h, ngx_uint_t offset);
 static ngx_int_t ngx_http_process_unique_header_line(ngx_http_request_t *r,
     ngx_table_elt_t *h, ngx_uint_t offset);
+static ngx_int_t ngx_http_process_host(ngx_http_request_t *r,
+    ngx_table_elt_t *h, ngx_uint_t offset);
 static ngx_int_t ngx_http_process_connection(ngx_http_request_t *r,
     ngx_table_elt_t *h, ngx_uint_t offset);
+static ngx_int_t ngx_http_process_user_agent(ngx_http_request_t *r,
+    ngx_table_elt_t *h, ngx_uint_t offset);
 static ngx_int_t ngx_http_process_cookie(ngx_http_request_t *r,
     ngx_table_elt_t *h, ngx_uint_t offset);
 
 static ngx_int_t ngx_http_process_request_header(ngx_http_request_t *r);
 static void ngx_http_process_request(ngx_http_request_t *r);
-static void ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host,
-    size_t len, ngx_uint_t hash);
+static ssize_t ngx_http_validate_host(u_char *host, size_t len);
+static ngx_int_t ngx_http_find_virtual_server(ngx_http_request_t *r,
+    u_char *host, size_t len);
 
 static void ngx_http_request_handler(ngx_event_t *ev);
 static ngx_int_t ngx_http_set_write_handler(ngx_http_request_t *r);
@@ -69,18 +74,15 @@
 
 
 ngx_http_header_t  ngx_http_headers_in[] = {
-    { ngx_string("Host"), offsetof(ngx_http_headers_in_t, host),
-                 ngx_http_process_unique_header_line },
-
-    { ngx_string("Connection"), offsetof(ngx_http_headers_in_t, connection),
-                 ngx_http_process_connection },
+    { ngx_string("Host"), 0, ngx_http_process_host },
+
+    { ngx_string("Connection"), 0, ngx_http_process_connection },
 
     { ngx_string("If-Modified-Since"),
                  offsetof(ngx_http_headers_in_t, if_modified_since),
                  ngx_http_process_unique_header_line },
 
-    { ngx_string("User-Agent"), offsetof(ngx_http_headers_in_t, user_agent),
-                 ngx_http_process_header_line },
+    { ngx_string("User-Agent"), 0, ngx_http_process_user_agent },
 
     { ngx_string("Referer"), offsetof(ngx_http_headers_in_t, referer),
                  ngx_http_process_header_line },
@@ -562,8 +564,6 @@
 int
 ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg)
 {
-    u_char                   *p;
-    ngx_uint_t                hash;
     const char               *servername;
     ngx_connection_t         *c;
     ngx_http_request_t       *r;
@@ -582,21 +582,13 @@
 
     r = c->data;
 
-    if (r->virtual_names == NULL) {
+    if (ngx_http_find_virtual_server(r, (u_char *) servername,
+                                     ngx_strlen(servername))
+        != NGX_OK)
+    {
         return SSL_TLSEXT_ERR_NOACK;
     }
 
-    /* it seems browsers send low case server name */
-
-    hash = 0;
-
-    for (p = (u_char *) servername; *p; p++) {
-        hash = ngx_hash(hash, *p);
-    }
-
-    ngx_http_find_virtual_server(r, (u_char *) servername,
-                                 p - (u_char *) servername, hash);
-
     sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module);
 
     SSL_set_SSL_CTX(ssl_conn, sscf->ssl.ctx);
@@ -726,7 +718,31 @@
             ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
                            "http exten: \"%V\"", &r->exten);
 
+            if (r->host_start && r->host_end) {
+                n = ngx_http_validate_host(r->host_start,
+                                           r->host_end - r->host_start);
+
+                if (n <= 0) {
+                    ngx_log_error(NGX_LOG_INFO, c->log, 0,
+                                  "client sent invalid host in request line");
+                    ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
+                    return;
+                }
+
+                r->headers_in.server.len = n;
+                r->headers_in.server.data = r->host_start;
+            }
+
             if (r->http_version < NGX_HTTP_VERSION_10) {
+
+                if (ngx_http_find_virtual_server(r, r->headers_in.server.data,
+                                                 r->headers_in.server.len)
+                    == NGX_ERROR)
+                {
+                    ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+                    return;
+                }
+
                 ngx_http_process_request(r);
                 return;
             }
@@ -1217,6 +1233,36 @@
 
 
 static ngx_int_t
+ngx_http_process_host(ngx_http_request_t *r, ngx_table_elt_t *h,
+    ngx_uint_t offset)
+{
+    ssize_t  len;
+
+    if (r->headers_in.host == NULL) {
+        r->headers_in.host = h;
+    }
+
+    len = ngx_http_validate_host(h->value.data, h->value.len);
+
+    if (len <= 0) {
+        ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
+                      "client sent invalid host header");
+        ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
+        return NGX_ERROR;
+    }
+
+    if (r->headers_in.server.len) {
+        return NGX_OK;
+    }
+
+    r->headers_in.server.len = len;
+    r->headers_in.server.data = h->value.data;
+
+    return NGX_OK;
+}
+
+
+static ngx_int_t
 ngx_http_process_connection(ngx_http_request_t *r, ngx_table_elt_t *h,
     ngx_uint_t offset)
 {
@@ -1232,6 +1278,60 @@
 
 
 static ngx_int_t
+ngx_http_process_user_agent(ngx_http_request_t *r, ngx_table_elt_t *h,
+    ngx_uint_t offset)
+{
+    u_char  *ua, *user_agent;
+
+    if (r->headers_in.user_agent) {
+        return NGX_OK;
+    }
+
+    r->headers_in.user_agent = h;
+
+    /* check some widespread browsers while the header is in CPU cache */
+
+    user_agent = h->value.data;
+
+    ua = ngx_strstrn(user_agent, "MSIE", 4 - 1);
+
+    if (ua && ua + 8 < user_agent + h->value.len) {
+
+        r->headers_in.msie = 1;
+
+        if (ua[4] == ' ' && ua[5] == '4' && ua[6] == '.') {
+            r->headers_in.msie4 = 1;
+        }
+
+#if 0
+        /* MSIE ignores the SSL "close notify" alert */
+        if (c->ssl) {
+            c->ssl->no_send_shutdown = 1;
+        }
+#endif
+    }
+
+    if (ngx_strstrn(user_agent, "Opera", 5 - 1)) {
+        r->headers_in.opera = 1;
+        r->headers_in.msie = 0;
+        r->headers_in.msie4 = 0;
+    }
+
+    if (!r->headers_in.msie && !r->headers_in.opera) {
+
+        if (ngx_strstrn(user_agent, "Gecko/", 6 - 1)) {
+            r->headers_in.gecko = 1;
+
+        } else if (ngx_strstrn(user_agent, "Konqueror", 9 - 1)) {
+            r->headers_in.konqueror = 1;
+        }
+    }
+
+    return NGX_OK;
+}
+
+
+static ngx_int_t
 ngx_http_process_cookie(ngx_http_request_t *r, ngx_table_elt_t *h,
     ngx_uint_t offset)
 {
@@ -1252,57 +1352,19 @@
 static ngx_int_t
 ngx_http_process_request_header(ngx_http_request_t *r)
 {
-    size_t       len;
-    u_char      *host, *ua, *user_agent, ch;
-    ngx_uint_t   hash;
-
-    if (r->headers_in.host) {
-
-        hash = 0;
-
-        for (len = 0; len < r->headers_in.host->value.len; len++) {
-            ch = r->headers_in.host->value.data[len];
-
-            if (ch == ':') {
-                break;
-            }
-
-            ch = ngx_tolower(ch);
-            r->headers_in.host->value.data[len] = ch;
-            hash = ngx_hash(hash, ch);
-        }
-
-        if (len && r->headers_in.host->value.data[len - 1] == '.') {
-            len--;
-            hash = ngx_hash_key(r->headers_in.host->value.data, len);
-        }
-
-        r->headers_in.host_name_len = len;
-
-        if (r->virtual_names) {
-
-            host = r->host_start;
-
-            if (host == NULL) {
-                host = r->headers_in.host->value.data;
-                len = r->headers_in.host_name_len;
-
-            } else {
-                len = r->host_end - host;
-            }
-
-            ngx_http_find_virtual_server(r, host, len, hash);
-        }
-
-    } else {
-        if (r->http_version > NGX_HTTP_VERSION_10) {
-            ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
-                       "client sent HTTP/1.1 request without \"Host\" header");
-            ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
-            return NGX_ERROR;
-        }
-
-        r->headers_in.host_name_len = 0;
+    if (ngx_http_find_virtual_server(r, r->headers_in.server.data,
+                                     r->headers_in.server.len)
+        == NGX_ERROR)
+    {
+        ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+        return NGX_ERROR;
+    }
+
+    if (r->headers_in.host == NULL && r->http_version > NGX_HTTP_VERSION_10) {
+        ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
+                   "client sent HTTP/1.1 request without \"Host\" header");
+        ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
+        return NGX_ERROR;
     }
 
     if (r->headers_in.content_length) {
@@ -1353,50 +1415,6 @@
         }
     }
 
-    if (r->headers_in.user_agent) {
-
-        /*
-         * check some widespread browsers while the headers are still
-         * in CPU cache
-         */
-
-        user_agent = r->headers_in.user_agent->value.data;
-
-        ua = ngx_strstrn(user_agent, "MSIE", 4 - 1);
-
-        if (ua && ua + 8 < user_agent + r->headers_in.user_agent->value.len) {
-
-            r->headers_in.msie = 1;
-
-            if (ua[4] == ' ' && ua[5] == '4' && ua[6] == '.') {
-                r->headers_in.msie4 = 1;
-            }
-
-#if 0
-            /* MSIE ignores the SSL "close notify" alert */
-            if (c->ssl) {
-                c->ssl->no_send_shutdown = 1;
-            }
-#endif
-        }
-
-        if (ngx_strstrn(user_agent, "Opera", 5 - 1)) {
-            r->headers_in.opera = 1;
-            r->headers_in.msie = 0;
-            r->headers_in.msie4 = 0;
-        }
-
-        if (!r->headers_in.msie && !r->headers_in.opera) {
-
-            if (ngx_strstrn(user_agent, "Gecko/", 6 - 1)) {
-                r->headers_in.gecko = 1;
-
-            } else if (ngx_strstrn(user_agent, "Konqueror", 9 - 1)) {
-                r->headers_in.konqueror = 1;
-            }
-        }
-    }
-
     return NGX_OK;
 }
 
@@ -1479,14 +1497,89 @@
 }
 
 
-static void
-ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len,
-    ngx_uint_t hash)
+static ssize_t
+ngx_http_validate_host(u_char *host, size_t len)
 {
+    u_char      ch;
+    size_t      i, last;
+    ngx_uint_t  dot;
+
+    last = len;
+    dot = 0;
+
+    for (i = 0; i < len; i++) {
+        ch = host[i];
+
+        if (ch == '.') {
+            if (dot) {
+                return -1;
+            }
+
+            dot = 1;
+            continue;
+        }
+
+        dot = 0;
+
+        if (ch == ':') {
+            last = i;
+            continue;
+        }
+
+        if (ch == '/' || ch == '\0') {
+            return -1;
+        }
+
+#if (NGX_WIN32)
+        if (ch == '\\') {
+            return -1;
+        }
+#endif
+    }
+
+    if (dot) {
+        last--;
+    }
+
+    return last;
+}
+
+
+static ngx_int_t
+ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len)
+{
+    u_char                    *server, ch;
+    ngx_uint_t                 i, hash;
     ngx_http_core_loc_conf_t  *clcf;
     ngx_http_core_srv_conf_t  *cscf;
-
-    cscf = ngx_hash_find_combined(&r->virtual_names->names, hash, host, len);
+    u_char                     buf[32];
+
+    if (len == 0 || r->virtual_names == NULL) {
+        return NGX_DECLINED;
+    }
+
+    if (len <= 32) {
+        server = buf;
+
+    } else {
+        server = ngx_palloc(r->pool, len);
+        if (server == NULL) {
+            return NGX_ERROR;
+        }
+    }
+
+    hash = 0;
+
+    for (i = 0; i < len; i++) {
+        ch = host[i];
+
+        ch = ngx_tolower(ch);
+        server[i] = ch;
+
+        hash = ngx_hash(hash, ch);
+    }
+
+    cscf = ngx_hash_find_combined(&r->virtual_names->names, hash, server, len);
 
     if (cscf) {
         goto found;
@@ -1501,7 +1594,7 @@
         ngx_http_server_name_t  *sn;
 
         name.len = len;
-        name.data = host;
+        name.data = server;
 
         sn = r->virtual_names->regex;
 
@@ -1518,7 +1611,7 @@
                               ngx_regex_exec_n
                               " failed: %d on \"%V\" using \"%V\"",
                               n, &name, &sn[i].name);
-                return;
+                return NGX_ERROR;
             }
 
             /* match */
@@ -1531,7 +1624,7 @@
 
 #endif
 
-    return;
+    return NGX_OK;
 
 found:
 
@@ -1545,7 +1638,7 @@
         r->connection->log->log_level = clcf->err_log->log_level;
     }
 
-    return;
+    return NGX_OK;
 }
 
 
@@ -2064,7 +2157,8 @@
         hc->pipeline = 1;
         c->log->action = "reading client pipelined request line";
 
-        ngx_http_init_request(rev);
+        rev->handler = ngx_http_init_request;
+        ngx_post_event(rev, &ngx_posted_events);
         return;
     }
 
@@ -2180,7 +2274,7 @@
     c->idle = 1;
 
     if (rev->ready) {
-        ngx_http_keepalive_handler(rev);
+        ngx_post_event(rev, &ngx_posted_events);
     }
 }
 
--- a/src/http/ngx_http_request.h	Mon May 12 00:00:00 2008 +0400
+++ b/src/http/ngx_http_request.h	Mon Jul 07 00:00:00 2008 +0400
@@ -206,7 +206,7 @@
 
     ngx_array_t                       cookies;
 
-    size_t                            host_name_len;
+    ngx_str_t                         server;
     off_t                             content_length_n;
     time_t                            keep_alive_n;
 
--- a/src/http/ngx_http_special_response.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/http/ngx_http_special_response.c	Mon Jul 07 00:00:00 2008 +0400
@@ -619,7 +619,7 @@
     b->last = tail + len;
 
     out[1].buf = b;
-    out[1].next = NULL;;
+    out[1].next = NULL;
 
     if (msie_padding) {
         b = ngx_calloc_buf(r->pool);
@@ -633,7 +633,7 @@
 
         out[1].next = &out[2];
         out[2].buf = b;
-        out[2].next = NULL;;
+        out[2].next = NULL;
     }
 
     if (r == r->main) {
--- a/src/http/ngx_http_variables.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/http/ngx_http_variables.c	Mon Jul 07 00:00:00 2008 +0400
@@ -75,6 +75,8 @@
 
 static ngx_int_t ngx_http_variable_nginx_version(ngx_http_request_t *r,
     ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_variable_hostname(ngx_http_request_t *r,
+    ngx_http_variable_value_t *v, uintptr_t data);
 
 /*
  * TODO:
@@ -221,6 +223,9 @@
     { ngx_string("nginx_version"), NULL, ngx_http_variable_nginx_version,
       0, 0, 0 },
 
+    { ngx_string("hostname"), NULL, ngx_http_variable_hostname,
+      0, 0, 0 },
+
     { ngx_null_string, NULL, NULL, 0, 0, 0 }
 };
 
@@ -712,26 +717,15 @@
 {
     ngx_http_core_srv_conf_t  *cscf;
 
-    if (r->host_start == NULL) {
-
-        if (r->headers_in.host) {
-            v->len = r->headers_in.host_name_len;
-            v->data = r->headers_in.host->value.data;
-
-        } else {
-            cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
-
-            v->len = cscf->server_name.len;
-            v->data = cscf->server_name.data;
-        }
-
-    } else if (r->host_end) {
-        v->len = r->host_end - r->host_start;
-        v->data = r->host_start;
+    if (r->headers_in.server.len) {
+        v->len = r->headers_in.server.len;
+        v->data = r->headers_in.server.data;
 
     } else {
-        v->not_found = 1;
-        return NGX_OK;
+        cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
+
+        v->len = cscf->server_name.len;
+        v->data = cscf->server_name.data;
     }
 
     v->valid = 1;
@@ -1283,6 +1277,20 @@
 }
 
 
+static ngx_int_t
+ngx_http_variable_hostname(ngx_http_request_t *r,
+    ngx_http_variable_value_t *v, uintptr_t data)
+{
+    v->len = ngx_cycle->hostname.len;
+    v->valid = 1;
+    v->no_cacheable = 0;
+    v->not_found = 0;
+    v->data = ngx_cycle->hostname.data;
+
+    return NGX_OK;
+}
+
+
 ngx_int_t
 ngx_http_variables_add_core_vars(ngx_conf_t *cf)
 {
--- a/src/http/ngx_http_variables.h	Mon May 12 00:00:00 2008 +0400
+++ b/src/http/ngx_http_variables.h	Mon Jul 07 00:00:00 2008 +0400
@@ -16,7 +16,7 @@
 
 typedef ngx_variable_value_t  ngx_http_variable_value_t;
 
-#define ngx_http_variable(v)     { sizeof(v) - 1, 1, 0, 0, (u_char *) v }
+#define ngx_http_variable(v)     { sizeof(v) - 1, 1, 0, 0, 0, (u_char *) v }
 
 typedef struct ngx_http_variable_s  ngx_http_variable_t;
 
--- a/src/mail/ngx_mail_core_module.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/mail/ngx_mail_core_module.c	Mon Jul 07 00:00:00 2008 +0400
@@ -185,20 +185,7 @@
     ngx_conf_merge_str_value(conf->server_name, prev->server_name, "");
 
     if (conf->server_name.len == 0) {
-        conf->server_name.data = ngx_palloc(cf->pool, NGX_MAXHOSTNAMELEN);
-        if (conf->server_name.data == NULL) {
-            return NGX_CONF_ERROR;
-        }
-
-        if (gethostname((char *) conf->server_name.data, NGX_MAXHOSTNAMELEN)
-            == -1)
-        {
-            ngx_log_error(NGX_LOG_EMERG, cf->log, ngx_errno,
-                          "gethostname() failed");
-            return NGX_CONF_ERROR;
-        }
-
-        conf->server_name.len = ngx_strlen(conf->server_name.data);
+        conf->server_name = cf->cycle->hostname;
     }
 
     if (conf->protocol == NULL) {
--- a/src/mail/ngx_mail_ssl_module.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/mail/ngx_mail_ssl_module.c	Mon Jul 07 00:00:00 2008 +0400
@@ -261,7 +261,7 @@
     }
 
     ngx_conf_merge_value(conf->builtin_session_cache,
-                         prev->builtin_session_cache, NGX_SSL_NO_SCACHE);
+                         prev->builtin_session_cache, NGX_SSL_NONE_SCACHE);
 
     if (conf->shm_zone == NULL) {
         conf->shm_zone = prev->shm_zone;
@@ -298,6 +298,11 @@
             continue;
         }
 
+        if (ngx_strcmp(value[i].data, "none") == 0) {
+            scf->builtin_session_cache = NGX_SSL_NONE_SCACHE;
+            continue;
+        }
+
         if (ngx_strcmp(value[i].data, "builtin") == 0) {
             scf->builtin_session_cache = NGX_SSL_DFLT_BUILTIN_SCACHE;
             continue;
--- a/src/os/unix/ngx_linux_config.h	Mon May 12 00:00:00 2008 +0400
+++ b/src/os/unix/ngx_linux_config.h	Mon Jul 07 00:00:00 2008 +0400
@@ -47,6 +47,7 @@
 
 #include <time.h>               /* tzset() */
 #include <malloc.h>             /* memalign() */
+#include <limits.h>             /* IOV_MAX */
 #include <sys/ioctl.h>
 #include <sys/sysctl.h>
 #include <crypt.h>
--- a/src/os/unix/ngx_posix_config.h	Mon May 12 00:00:00 2008 +0400
+++ b/src/os/unix/ngx_posix_config.h	Mon Jul 07 00:00:00 2008 +0400
@@ -110,7 +110,7 @@
 
 #include <sys/param.h>          /* ALIGN() */
 
-/* 
+/*
  * FreeBSD 3.x has no CMSG_SPACE() and CMSG_LEN() and has the broken CMSG_DATA()
  */
 
--- a/src/os/unix/ngx_process_cycle.c	Mon May 12 00:00:00 2008 +0400
+++ b/src/os/unix/ngx_process_cycle.c	Mon Jul 07 00:00:00 2008 +0400
@@ -1054,70 +1054,74 @@
 
     ngx_log_debug0(NGX_LOG_DEBUG_CORE, ev->log, 0, "channel handler");
 
-    n = ngx_read_channel(c->fd, &ch, sizeof(ngx_channel_t), ev->log);
+    for ( ;; ) {
 
-    ngx_log_debug1(NGX_LOG_DEBUG_CORE, ev->log, 0, "channel: %i", n);
+        n = ngx_read_channel(c->fd, &ch, sizeof(ngx_channel_t), ev->log);
+
+        ngx_log_debug1(NGX_LOG_DEBUG_CORE, ev->log, 0, "channel: %i", n);
 
-    if (n == NGX_ERROR) {
+        if (n == NGX_ERROR) {
 
-        if (ngx_event_flags & NGX_USE_EPOLL_EVENT) {
-            ngx_del_conn(c, 0);
+            if (ngx_event_flags & NGX_USE_EPOLL_EVENT) {
+                ngx_del_conn(c, 0);
+            }
+
+            ngx_close_connection(c);
+            return;
         }
 
-        ngx_close_connection(c);
-        return;
-    }
+        if (ngx_event_flags & NGX_USE_EVENTPORT_EVENT) {
+            if (ngx_add_event(ev, NGX_READ_EVENT, 0) == NGX_ERROR) {
+                return;
+            }
+        }
 
-    if (ngx_event_flags & NGX_USE_EVENTPORT_EVENT) {
-        if (ngx_add_event(ev, NGX_READ_EVENT, 0) == NGX_ERROR) {
+        if (n == NGX_AGAIN) {
             return;
         }
-    }
+
+        ngx_log_debug1(NGX_LOG_DEBUG_CORE, ev->log, 0,
+                       "channel command: %d", ch.command);
 
-    if (n == NGX_AGAIN) {
-        return;
-    }
+        switch (ch.command) {
 
-    ngx_log_debug1(NGX_LOG_DEBUG_CORE, ev->log, 0,
-                   "channel command: %d", ch.command);
-
-    switch (ch.command) {
+        case NGX_CMD_QUIT:
+            ngx_quit = 1;
+            break;
 
-    case NGX_CMD_QUIT:
-        ngx_quit = 1;
-        break;
+        case NGX_CMD_TERMINATE:
+            ngx_terminate = 1;
+            break;
 
-    case NGX_CMD_TERMINATE:
-        ngx_terminate = 1;
-        break;
+        case NGX_CMD_REOPEN:
+            ngx_reopen = 1;
+            break;
 
-    case NGX_CMD_REOPEN:
-        ngx_reopen = 1;
-        break;
+        case NGX_CMD_OPEN_CHANNEL:
 
-    case NGX_CMD_OPEN_CHANNEL:
-
-        ngx_log_debug3(NGX_LOG_DEBUG_CORE, ev->log, 0,
-                       "get channel s:%i pid:%P fd:%d", ch.slot, ch.pid, ch.fd);
+            ngx_log_debug3(NGX_LOG_DEBUG_CORE, ev->log, 0,
+                           "get channel s:%i pid:%P fd:%d",
+                           ch.slot, ch.pid, ch.fd);
 
-        ngx_processes[ch.slot].pid = ch.pid;
-        ngx_processes[ch.slot].channel[0] = ch.fd;
-        break;
+            ngx_processes[ch.slot].pid = ch.pid;
+            ngx_processes[ch.slot].channel[0] = ch.fd;
+            break;
 
-    case NGX_CMD_CLOSE_CHANNEL:
+        case NGX_CMD_CLOSE_CHANNEL:
 
-        ngx_log_debug4(NGX_LOG_DEBUG_CORE, ev->log, 0,
-                       "close channel s:%i pid:%P our:%P fd:%d",
-                       ch.slot, ch.pid, ngx_processes[ch.slot].pid,
-                       ngx_processes[ch.slot].channel[0]);
+            ngx_log_debug4(NGX_LOG_DEBUG_CORE, ev->log, 0,
+                           "close channel s:%i pid:%P our:%P fd:%d",
+                           ch.slot, ch.pid, ngx_processes[ch.slot].pid,
+                           ngx_processes[ch.slot].channel[0]);
 
-        if (close(ngx_processes[ch.slot].channel[0]) == -1) {
-            ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_errno,
-                          "close() channel failed");
+            if (close(ngx_processes[ch.slot].channel[0]) == -1) {
+                ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_errno,
+                              "close() channel failed");
+            }
+
+            ngx_processes[ch.slot].channel[0] = -1;
+            break;
         }
-
-        ngx_processes[ch.slot].channel[0] = -1;
-        break;
     }
 }