# HG changeset patch # User Igor Sysoev # Date 1215374400 -14400 # Node ID d13234035cad0a7e5cee032bbf479bf446bcfc5b # Parent 52f3c9c7eff03fee0a2ede166976441aa22a3651 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. diff --git a/CHANGES b/CHANGES --- a/CHANGES +++ b/CHANGES @@ -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 @@ Changes with nginx 0.6.30 *) 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 @@ Changes with nginx 0.6.29 *) 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 @@ Changes with nginx 0.6.26 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 @@ Changes with nginx 0.6.25 *) 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 @@ Changes with nginx 0.6.23 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 @@ Changes with nginx 0.6.22 *) 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 @@ Changes with nginx 0.6.22 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 @@ Changes with nginx 0.6.21 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.21 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 @@ Changes with nginx 0.6.17 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 @@ Changes with nginx 0.6.16 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 @@ Changes with nginx 0.6.15 *) 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 @@ Changes with nginx 0.6.14 "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 @@ Changes with nginx 0.6.14 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 @@ Changes with nginx 0.6.12 *) 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 @@ Changes with nginx 0.6.11 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 @@ Changes with nginx 0.6.10 *) 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.10 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 @@ Changes with nginx 0.6.9 *) 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 @@ Changes with nginx 0.6.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 @@ Changes with nginx 0.6.7 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 @@ Changes with nginx 0.6.6 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 @@ Changes with nginx 0.6.3 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.6.0 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 @@ Changes with nginx 0.5.24 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.23 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 @@ Changes with nginx 0.5.18 *) 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 @@ Changes with nginx 0.5.16 *) 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 @@ Changes with nginx 0.5.13 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 @@ Changes with nginx 0.5.11 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.11 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 @@ Changes with nginx 0.5.8 *) 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 @@ Changes with nginx 0.5.4 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.3 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 @@ Changes with nginx 0.5.1 *) 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 @@ Changes with nginx 0.5.0 *) 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 @@ Changes with nginx 0.4.14 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 @@ Changes with nginx 0.4.13 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 @@ Changes with nginx 0.4.13 *) 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 @@ Changes with nginx 0.4.11 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 @@ Changes with nginx 0.4.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 @@ Changes with nginx 0.4.6 $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 @@ Changes with nginx 0.4.3 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.3 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 @@ Changes with nginx 0.4.0 *) 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.61 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 @@ Changes with nginx 0.3.59 *) 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 @@ Changes with nginx 0.3.55 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 @@ Changes with nginx 0.3.54 *) 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 @@ Changes with nginx 0.3.52 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.52 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 @@ Changes with nginx 0.3.48 *) 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 @@ Changes with nginx 0.3.45 *) Change: the ° 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 @@ Changes with nginx 0.3.39 *) 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.36 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.33 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 @@ Changes with nginx 0.3.31 *) 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 @@ Changes with nginx 0.3.30 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.26 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 @@ Changes with nginx 0.3.24 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 @@ Changes with nginx 0.3.22 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 @@ Changes with nginx 0.3.18 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 @@ Changes with nginx 0.3.17 *) 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 @@ Changes with nginx 0.3.16 *) 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.15 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 @@ Changes with nginx 0.3.13 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 @@ Changes with nginx 0.3.12 *) 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 @@ Changes with nginx 0.3.12 *) 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.12 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.10 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 @@ Changes with nginx 0.3.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 @@ Changes with nginx 0.3.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 @@ Changes with nginx 0.3.6 *) 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.6 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.5 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 @@ Changes with nginx 0.3.3 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.2 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 @@ Changes with nginx 0.2.6 *) 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 @@ Changes with nginx 0.2.4 *) 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.2 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 @@ Changes with nginx 0.1.43 *) 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 @@ Changes with nginx 0.1.42 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 @@ Changes with nginx 0.1.40 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 @@ Changes with nginx 0.1.39 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 @@ Changes with nginx 0.1.39 *) 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 @@ Changes with nginx 0.1.38 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 @@ Changes with nginx 0.1.35 *) 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 @@ Changes with nginx 0.1.35 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.34 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.33 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 @@ Changes with nginx 0.1.31 *) 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 @@ Changes with nginx 0.1.30 *) 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 @@ Changes with nginx 0.1.29 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 @@ Changes with nginx 0.1.23 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 @@ Changes with nginx 0.1.22 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 @@ Changes with nginx 0.1.17 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 @@ Changes with nginx 0.1.16 *) 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 @@ Changes with nginx 0.1.15 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 @@ Changes with nginx 0.1.14 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 @@ Changes with nginx 0.1.10 *) 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 @@ Changes with nginx 0.1.9 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.8 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 @@ Changes with nginx 0.1.2 *) 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. diff --git a/CHANGES.ru b/CHANGES.ru --- a/CHANGES.ru +++ b/CHANGES.ru @@ -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-сервера, если строка diff --git a/auto/install b/auto/install --- a/auto/install +++ b/auto/install @@ -17,47 +17,53 @@ fi 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 diff --git a/auto/lib/conf b/auto/lib/conf --- a/auto/lib/conf +++ b/auto/lib/conf @@ -16,6 +16,7 @@ if [ $USE_MD5 = YES ]; then 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 [ $USE_SHA1 = YES ]; then 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 diff --git a/auto/lib/md5/conf b/auto/lib/md5/conf --- a/auto/lib/md5/conf +++ b/auto/lib/md5/conf @@ -45,6 +45,7 @@ if [ $MD5 != NONE ]; then else if [ "$NGX_PLATFORM" != win32 ]; then + MD5=NO # Solaris 8/9 @@ -58,55 +59,43 @@ else 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 " - 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 " + 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 " - 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 diff --git a/auto/lib/pcre/conf b/auto/lib/pcre/conf --- a/auto/lib/pcre/conf +++ b/auto/lib/pcre/conf @@ -84,6 +84,7 @@ if [ $PCRE != NONE ]; then else if [ "$NGX_PLATFORM" != win32 ]; then + PCRE=NO ngx_feature="PCRE library" @@ -95,20 +96,11 @@ else 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 " ngx_feature_path="/usr/local/include" if [ $NGX_RPATH = YES ]; then @@ -117,8 +109,49 @@ else 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 @@ else 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 " - 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 " - 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 " - 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 diff --git a/auto/lib/sha1/conf b/auto/lib/sha1/conf --- a/auto/lib/sha1/conf +++ b/auto/lib/sha1/conf @@ -35,6 +35,7 @@ if [ $SHA1 != NONE ]; then else if [ "$NGX_PLATFORM" != win32 ]; then + SHA1=NO # FreeBSD @@ -48,35 +49,28 @@ else 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 " + 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 " - 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 diff --git a/auto/summary b/auto/summary --- a/auto/summary +++ b/auto/summary @@ -51,26 +51,14 @@ case $OPENSSL in 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" ;; diff --git a/src/core/nginx.c b/src/core/nginx.c --- a/src/core/nginx.c +++ b/src/core/nginx.c @@ -1078,7 +1078,7 @@ ngx_set_cpu_affinity(ngx_conf_t *cf, ngx 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; } } diff --git a/src/core/nginx.h b/src/core/nginx.h --- a/src/core/nginx.h +++ b/src/core/nginx.h @@ -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" diff --git a/src/core/ngx_config.h b/src/core/ngx_config.h --- a/src/core/ngx_config.h +++ b/src/core/ngx_config.h @@ -116,10 +116,11 @@ typedef intptr_t ngx_flag_t; #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)) diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c --- a/src/core/ngx_connection.c +++ b/src/core/ngx_connection.c @@ -229,7 +229,7 @@ ngx_open_listening_sockets(ngx_cycle_t * /* TODO: configurable try number */ - for (tries = 5 ; tries; tries--) { + for (tries = 5; tries; tries--) { failed = 0; /* for each listening socket */ diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c --- a/src/core/ngx_cycle.c +++ b/src/core/ngx_cycle.c @@ -57,6 +57,7 @@ ngx_init_cycle(ngx_cycle_t *old_cycle) 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 @@ ngx_init_cycle(ngx_cycle_t *old_cycle) } + 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; diff --git a/src/core/ngx_cycle.h b/src/core/ngx_cycle.h --- a/src/core/ngx_cycle.h +++ b/src/core/ngx_cycle.h @@ -62,6 +62,7 @@ struct ngx_cycle_s { ngx_str_t conf_file; ngx_str_t root; ngx_str_t lock_file; + ngx_str_t hostname; }; diff --git a/src/core/ngx_open_file_cache.c b/src/core/ngx_open_file_cache.c --- a/src/core/ngx_open_file_cache.c +++ b/src/core/ngx_open_file_cache.c @@ -413,13 +413,13 @@ failed: 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); diff --git a/src/core/ngx_resolver.c b/src/core/ngx_resolver.c --- a/src/core/ngx_resolver.c +++ b/src/core/ngx_resolver.c @@ -202,7 +202,7 @@ ngx_resolver_cleanup_tree(ngx_resolver_t 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); diff --git a/src/core/ngx_string.h b/src/core/ngx_string.h --- a/src/core/ngx_string.h +++ b/src/core/ngx_string.h @@ -25,11 +25,12 @@ typedef struct { 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; diff --git a/src/event/modules/ngx_kqueue_module.c b/src/event/modules/ngx_kqueue_module.c --- a/src/event/modules/ngx_kqueue_module.c +++ b/src/event/modules/ngx_kqueue_module.c @@ -446,7 +446,7 @@ ngx_kqueue_set_event(ngx_event_t *ev, ng || __FreeBSD_version >= 500018 |NOTE_REVOKE #endif - ; + ; kev->data = 0; } else { diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c --- a/src/event/ngx_event.c +++ b/src/event/ngx_event.c @@ -942,7 +942,7 @@ ngx_event_connections(ngx_conf_t *cf, ng 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_use(ngx_conf_t *cf, ngx_comman ngx_event_module_t *module; if (ecf->use != NGX_CONF_UNSET_UINT) { - return "is duplicate" ; + return "is duplicate"; } value = cf->args->elts; diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c --- a/src/event/ngx_event_openssl.c +++ b/src/event/ngx_event_openssl.c @@ -590,6 +590,11 @@ ngx_ssl_recv_chain(ngx_connection_t *c, } if (bytes) { + + if (n == 0 || n == NGX_ERROR) { + c->read->ready = 1; + } + return bytes; } @@ -1267,6 +1272,29 @@ ngx_ssl_session_cache(ngx_ssl_t *ssl, ng 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) { diff --git a/src/event/ngx_event_openssl.h b/src/event/ngx_event_openssl.h --- a/src/event/ngx_event_openssl.h +++ b/src/event/ngx_event_openssl.h @@ -51,9 +51,10 @@ typedef struct { } 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 diff --git a/src/event/ngx_event_pipe.c b/src/event/ngx_event_pipe.c --- a/src/event/ngx_event_pipe.c +++ b/src/event/ngx_event_pipe.c @@ -880,7 +880,7 @@ ngx_event_pipe_free_shadow_raw_buf(ngx_c ll = free; - for (cl = *free ; cl; cl = cl->next) { + for (cl = *free; cl; cl = cl->next) { if (cl->buf == s) { *ll = cl->next; break; diff --git a/src/http/modules/ngx_http_dav_module.c b/src/http/modules/ngx_http_dav_module.c --- a/src/http/modules/ngx_http_dav_module.c +++ b/src/http/modules/ngx_http_dav_module.c @@ -512,7 +512,7 @@ ngx_http_dav_mkcol_handler(ngx_http_requ 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_http_dav_copy_move_handler(ngx_http_ 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 @@ ngx_http_dav_copy_move_handler(ngx_http_ 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 @@ ngx_http_dav_copy_move_handler(ngx_http_ goto invalid_destination; } - desthost = dest->value.data + sizeof("https://") - 1; + host = dest->value.data + sizeof("https://") - 1; } else #endif @@ -564,12 +564,10 @@ ngx_http_dav_copy_move_handler(ngx_http_ 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 @@ ngx_http_dav_copy_move_handler(ngx_http_ 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; } diff --git a/src/http/modules/ngx_http_headers_filter_module.c b/src/http/modules/ngx_http_headers_filter_module.c --- a/src/http/modules/ngx_http_headers_filter_module.c +++ b/src/http/modules/ngx_http_headers_filter_module.c @@ -31,18 +31,20 @@ struct ngx_http_header_val_s { }; +#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 @@ static ngx_command_t ngx_http_headers_f { 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 @@ static ngx_int_t 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 @@ ngx_http_set_expires(ngx_http_request_t 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 @@ ngx_http_set_expires(ngx_http_request_t 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 @@ ngx_http_set_expires(ngx_http_request_t 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 @@ ngx_http_headers_create_conf(ngx_conf_t * 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_merge_conf(ngx_conf_t * 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_expires(ngx_conf_t *cf, { 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; diff --git a/src/http/modules/ngx_http_log_module.c b/src/http/modules/ngx_http_log_module.c --- a/src/http/modules/ngx_http_log_module.c +++ b/src/http/modules/ngx_http_log_module.c @@ -88,6 +88,7 @@ static size_t ngx_http_log_variable_getl 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 @@ ngx_http_log_variable_compile(ngx_conf_t 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 @@ ngx_http_log_variable_getlen(ngx_http_re 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 @@ ngx_http_log_variable(ngx_http_request_t 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; } diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c --- a/src/http/modules/ngx_http_proxy_module.c +++ b/src/http/modules/ngx_http_proxy_module.c @@ -1224,7 +1224,7 @@ ngx_http_proxy_process_header(ngx_http_r umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module); - for ( ;; ) { + for ( ;; ) { rc = ngx_http_parse_header_line(r, &r->upstream->buffer); diff --git a/src/http/modules/ngx_http_ssi_filter_module.c b/src/http/modules/ngx_http_ssi_filter_module.c --- a/src/http/modules/ngx_http_ssi_filter_module.c +++ b/src/http/modules/ngx_http_ssi_filter_module.c @@ -100,7 +100,7 @@ static ngx_int_t ngx_http_ssi_endblock(n 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 @@ ngx_http_ssi_body_filter(ngx_http_reques 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 @@ ngx_http_ssi_evaluate_string(ngx_http_re 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 @@ ngx_http_ssi_endblock(ngx_http_request_t 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; diff --git a/src/http/modules/ngx_http_ssl_module.c b/src/http/modules/ngx_http_ssl_module.c --- a/src/http/modules/ngx_http_ssl_module.c +++ b/src/http/modules/ngx_http_ssl_module.c @@ -415,7 +415,7 @@ ngx_http_ssl_merge_srv_conf(ngx_conf_t * } 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 @@ ngx_http_ssl_session_cache(ngx_conf_t *c 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; diff --git a/src/http/modules/ngx_http_sub_filter_module.c b/src/http/modules/ngx_http_sub_filter_module.c --- a/src/http/modules/ngx_http_sub_filter_module.c +++ b/src/http/modules/ngx_http_sub_filter_module.c @@ -322,8 +322,8 @@ ngx_http_sub_body_filter(ngx_http_reques 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; diff --git a/src/http/modules/ngx_http_userid_filter_module.c b/src/http/modules/ngx_http_userid_filter_module.c --- a/src/http/modules/ngx_http_userid_filter_module.c +++ b/src/http/modules/ngx_http_userid_filter_module.c @@ -41,15 +41,14 @@ typedef struct { } 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_str_t ngx_http_userid_set = 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 @@ ngx_http_userid_filter(ngx_http_request_ 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 @@ ngx_http_userid_filter(ngx_http_request_ } } - 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_http_userid_get_uid(ngx_http_request 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_http_userid_get_uid(ngx_http_request 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 @@ ngx_http_userid_set_uid(ngx_http_request 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 @@ ngx_http_userid_set_uid(ngx_http_request 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 @@ ngx_http_userid_variable(ngx_http_reques 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; } diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm --- a/src/http/modules/perl/nginx.pm +++ b/src/http/modules/perl/nginx.pm @@ -47,7 +47,7 @@ our @EXPORT = qw( HTTP_INSUFFICIENT_STORAGE ); -our $VERSION = '0.6.31'; +our $VERSION = '0.6.32'; require XSLoader; XSLoader::load('nginx', $VERSION); diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -2606,20 +2606,7 @@ ngx_http_core_merge_srv_conf(ngx_conf_t } 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 @@ ngx_http_core_merge_loc_conf(ngx_conf_t return NGX_CONF_ERROR; } } - + conf->resolver = prev->resolver; } @@ -3216,8 +3203,7 @@ ngx_http_core_server_name(ngx_conf_t *cf 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); diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h --- a/src/http/ngx_http_core_module.h +++ b/src/http/ngx_http_core_module.h @@ -255,10 +255,10 @@ struct ngx_http_core_loc_conf_s { 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 @@ extern ngx_uint_t ngx_http_max_module; \ 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; \ } diff --git a/src/http/ngx_http_header_filter_module.c b/src/http/ngx_http_header_filter_module.c --- a/src/http/ngx_http_header_filter_module.c +++ b/src/http/ngx_http_header_filter_module.c @@ -286,9 +286,8 @@ ngx_http_header_filter(ngx_http_request_ 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 @@ ngx_http_header_filter(ngx_http_request_ } 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; diff --git a/src/http/ngx_http_postpone_filter_module.c b/src/http/ngx_http_postpone_filter_module.c --- a/src/http/ngx_http_postpone_filter_module.c +++ b/src/http/ngx_http_postpone_filter_module.c @@ -168,7 +168,7 @@ ngx_http_postpone_filter_output_postpone pr = r->postponed; if (pr == NULL) { - return NGX_OK; + break; } if (pr->request) { @@ -196,7 +196,7 @@ ngx_http_postpone_filter_output_postpone } if (pr == NULL) { - return NGX_OK; + break; } out = pr->out; @@ -215,6 +215,17 @@ ngx_http_postpone_filter_output_postpone 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; } diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -21,15 +21,20 @@ static ngx_int_t ngx_http_process_header 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 @@ static char *ngx_http_client_errors[] = 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 @@ ngx_http_ssl_handshake_handler(ngx_conne 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 @@ ngx_http_ssl_servername(ngx_ssl_conn_t * 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_http_process_request_line(ngx_event_ 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 @@ ngx_http_process_unique_header_line(ngx_ 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 @@ ngx_http_process_connection(ngx_http_req 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 @@ ngx_http_process_cookie(ngx_http_request 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 @@ ngx_http_process_request_header(ngx_http } } - 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 @@ ngx_http_process_request(ngx_http_reques } -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_find_virtual_server(ngx_http_re 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_http_find_virtual_server(ngx_http_re ngx_regex_exec_n " failed: %d on \"%V\" using \"%V\"", n, &name, &sn[i].name); - return; + return NGX_ERROR; } /* match */ @@ -1531,7 +1624,7 @@ ngx_http_find_virtual_server(ngx_http_re #endif - return; + return NGX_OK; found: @@ -1545,7 +1638,7 @@ found: r->connection->log->log_level = clcf->err_log->log_level; } - return; + return NGX_OK; } @@ -2064,7 +2157,8 @@ ngx_http_set_keepalive(ngx_http_request_ 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 @@ ngx_http_set_keepalive(ngx_http_request_ c->idle = 1; if (rev->ready) { - ngx_http_keepalive_handler(rev); + ngx_post_event(rev, &ngx_posted_events); } } diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h --- a/src/http/ngx_http_request.h +++ b/src/http/ngx_http_request.h @@ -206,7 +206,7 @@ typedef struct { ngx_array_t cookies; - size_t host_name_len; + ngx_str_t server; off_t content_length_n; time_t keep_alive_n; diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c --- a/src/http/ngx_http_special_response.c +++ b/src/http/ngx_http_special_response.c @@ -619,7 +619,7 @@ ngx_http_send_special_response(ngx_http_ 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 @@ ngx_http_send_special_response(ngx_http_ out[1].next = &out[2]; out[2].buf = b; - out[2].next = NULL;; + out[2].next = NULL; } if (r == r->main) { diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c --- a/src/http/ngx_http_variables.c +++ b/src/http/ngx_http_variables.c @@ -75,6 +75,8 @@ static ngx_int_t ngx_http_variable_sent_ 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 @@ static ngx_http_variable_t ngx_http_cor { 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_variable_host(ngx_http_request_ { 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 @@ ngx_http_variable_nginx_version(ngx_http } +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) { diff --git a/src/http/ngx_http_variables.h b/src/http/ngx_http_variables.h --- a/src/http/ngx_http_variables.h +++ b/src/http/ngx_http_variables.h @@ -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; diff --git a/src/mail/ngx_mail_core_module.c b/src/mail/ngx_mail_core_module.c --- a/src/mail/ngx_mail_core_module.c +++ b/src/mail/ngx_mail_core_module.c @@ -185,20 +185,7 @@ ngx_mail_core_merge_srv_conf(ngx_conf_t 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) { diff --git a/src/mail/ngx_mail_ssl_module.c b/src/mail/ngx_mail_ssl_module.c --- a/src/mail/ngx_mail_ssl_module.c +++ b/src/mail/ngx_mail_ssl_module.c @@ -261,7 +261,7 @@ ngx_mail_ssl_merge_conf(ngx_conf_t *cf, } 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 @@ ngx_mail_ssl_session_cache(ngx_conf_t *c 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; diff --git a/src/os/unix/ngx_linux_config.h b/src/os/unix/ngx_linux_config.h --- a/src/os/unix/ngx_linux_config.h +++ b/src/os/unix/ngx_linux_config.h @@ -47,6 +47,7 @@ #include /* tzset() */ #include /* memalign() */ +#include /* IOV_MAX */ #include #include #include diff --git a/src/os/unix/ngx_posix_config.h b/src/os/unix/ngx_posix_config.h --- a/src/os/unix/ngx_posix_config.h +++ b/src/os/unix/ngx_posix_config.h @@ -110,7 +110,7 @@ #include /* ALIGN() */ -/* +/* * FreeBSD 3.x has no CMSG_SPACE() and CMSG_LEN() and has the broken CMSG_DATA() */ diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c --- a/src/os/unix/ngx_process_cycle.c +++ b/src/os/unix/ngx_process_cycle.c @@ -1054,70 +1054,74 @@ ngx_channel_handler(ngx_event_t *ev) 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; } }