[-]
[+]
|
Changed |
nginx-0.7.changes
|
|
[-]
[+]
|
Changed |
nginx-0.7-RHEL_5.spec
^
|
|
[-]
[+]
|
Changed |
nginx-0.7.spec
^
|
|
|
Deleted |
nginx-0.7.62.tar.gz
^
|
|
Deleted |
nginx-0.7.65.tar.gz
^
|
|
Deleted |
nginx-0.7.67.tar.gz
^
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/CHANGES
^
|
@@ -1,8 +1,412 @@
+Changes with nginx 0.7.69 19 Jul 2011
+
+ *) Bugfix: a segmentation fault might occur in a worker process, if a
+ caching was used.
+ Thanks to Lanshun Zhou.
+
+
+Changes with nginx 0.7.68 14 Dec 2010
+
+ *) Bugfix: if there was a single server for given IPv6 address:port
+ pair, then captures in regular expressions in a "server_name"
+ directive did not work.
+
+ *) Bugfix: a segmentation fault might occur in a worker process, if the
+ "auth_basic" directive was used.
+ Thanks to Michail Laletin.
+
+ *) Bugfix: SSI response might be truncated after include with
+ wait="yes"; the bug had appeared in 0.7.25.
+ Thanks to Maxim Dounin.
+
+ *) Bugfix: the "sub_filter" directive might change character case on
+ partial match.
+
+ *) Bugfix: nginx treated large SSLv2 packets as plain requests.
+ Thanks to Miroslaw Jaworski.
+
+ *) Bugfix: nginx might close IPv6 listen socket during
+ reconfiguration.
+ Thanks to Maxim Dounin.
+
+
+Changes with nginx 0.7.67 15 Jun 2010
+
+ *) Security: nginx/Windows worker might be terminated abnormally if a
+ requested file name has invalid UTF-8 encoding.
+
+
+Changes with nginx 0.7.66 07 Jun 2010
+
+ *) Security: now nginx/Windows ignores default file stream name.
+ Thanks to Jose Antonio Vazquez Gonzalez.
+
+ *) Change: now the charset filter runs before the SSI filter.
+
+ *) Change: now no message is written in an error log if a variable is
+ not found by $r->variable() method.
+
+ *) Change: now keepalive connections after POST requests are not
+ disabled for MSIE 7.0+.
+ Thanks to Adam Lounds.
+
+ *) Feature: the "proxy_no_cache" and "fastcgi_no_cache" directives.
+
+ *) Feature: now the "rewrite" directive does a redirect automatically
+ if the $scheme variable is used.
+ Thanks to Piotr Sikora.
+
+ *) Feature: the "chunked_transfer_encoding" directive.
+
+ *) Feature: the $geoip_city_continent_code, $geoip_latitude, and
+ $geoip_longitude variables.
+ Thanks to Arvind Sundararajan.
+
+ *) Feature: now the ngx_http_image_filter_module deletes always EXIF
+ and other application specific data if the data consume more than 5%
+ of a JPEG file.
+
+ *) Feature: now the "msie_padding" directive works for Chrome too.
+
+ *) Workaround: now keepalive connections are disabled for Safari.
+ Thanks to Joshua Sierles.
+
+ *) Bugfix: nginx ignored the "private" and "no-store" values in the
+ "Cache-Control" backend response header line.
+
+ *) Bugfix: an "&" character was not escaped when it was copied in
+ arguments part in a rewrite rule.
+
+ *) Bugfix: nginx might be terminated abnormally while a signal
+ processing or if the directive "timer_resolution" was used on
+ platforms which do not support kqueue or eventport notification
+ methods.
+ Thanks to George Xie and Maxim Dounin.
+
+ *) Bugfix: if temporary files and permanent storage area resided at
+ different file systems, then permanent file modification times were
+ incorrect.
+ Thanks to Maxim Dounin.
+
+ *) Bugfix: ngx_http_memcached_module might issue the error message
+ "memcached sent invalid trailer".
+ Thanks to Maxim Dounin.
+
+ *) Bugfix: nginx could not built zlib-1.2.4 library using the library
+ sources.
+ Thanks to Maxim Dounin.
+
+ *) Bugfix: values of the $query_string, $arg_..., etc. variables cached
+ in main request were used by the SSI module in subrequests.
+
+ *) Bugfix: nginx did not support HTTPS referrers.
+
+ *) Bugfix: nginx/Windows might not find file if path in configuration
+ was given in other character case; the bug had appeared in 0.7.65.
+
+ *) Bugfix: the $date_local variable has an incorrect value, if the "%s"
+ format was used.
+ Thanks to Maxim Dounin.
+
+ *) Bugfix: nginx did not support all ciphers and digests used in client
+ certificates.
+ Thanks to Innocenty Enikeew.
+
+ *) Bugfix: if ssl_session_cache was not set or was set to "none", then
+ during client certificate verify the error "session id context
+ uninitialized" might occur; the bug had appeared in 0.7.1.
+
+ *) Bugfix: OpenSSL-1.0.0 compatibility on 64-bit Linux.
+ Thanks to Maxim Dounin.
+
+ *) Bugfix: a geo range returned default value if the range included two
+ or more /16 networks and did not begin at /16 network boundary.
+
+ *) Bugfix: the $uid_got variable might not be used in the SSI and perl
+ modules.
+
+ *) Bugfix: a worker process hung if a FIFO file was requested.
+ Thanks to Vicente Aguilar and Maxim Dounin.
+
+ *) Bugfix: a variable value was repeatedly encoded after each an "echo"
+ SSI-command output; the bug had appeared in 0.6.14.
+
+ *) Bugfix: a "stub" parameter of an "include" SSI directive was not
+ used, if empty response has 200 status code.
+
+ *) Bugfix: a block used in a "stub" parameter of an "include" SSI
+ directive was output with "text/plain" MIME type.
+
+ *) Bugfix: if a proxied or FastCGI request was internally redirected to
+ another proxied or FastCGI location, then a segmentation fault might
+ occur in a worker process; the bug had appeared in 0.7.65.
+ Thanks to Yichun Zhang.
+
+ *) Bugfix: IMAP connections may hang until they timed out while talking
+ to Zimbra server.
+ Thanks to Alan Batie.
+
+ *) Bugfix: nginx did not support chunked transfer encoding for 201
+ responses.
+ Thanks to Julian Reich.
+
+
+Changes with nginx 0.7.65 01 Feb 2010
+
+ *) Security: now nginx/Windows ignores trailing spaces in URI.
+ Thanks to Dan Crowley, Core Security Technologies.
+
+ *) Security: now nginx/Windows ignores short files names.
+ Thanks to Dan Crowley, Core Security Technologies.
+
+ *) Change: now the "009" status code is written to an access log for
+ proxied HTTP/0.9 responses.
+
+ *) Change: now the default buffer size of the
+ "large_client_header_buffers" directive is 8K.
+ Thanks to Andrew Cholakian.
+
+ *) Change: now default SSL ciphers are "HIGH:!ADH:!MD5".
+
+ *) Change: now SSLv2 protocol is disabled by default.
+
+ *) Change: now $host variable value is always low case.
+
+ *) Feature: the conf/fastcgi.conf for simple FastCGI configurations.
+
+ *) Feature: now URI part is not required a "proxy_pass" directive if
+ variables are used.
+
+ *) Feature: the $ssl_session_id variable.
+
+ *) Bugfix: if a proxied or FastCGI request was internally redirected to
+ another proxied or FastCGI location, then $upstream_response_time
+ variable may have abnormally large value; the bug had appeared in
+ 0.7.63.
+
+ *) Bugfix: if the "expires modified" set date in the past, then a
+ negative number was set in the "Cache-Control" response header
+ line.
+ Thanks to Alex Kapranoff.
+
+ *) Bugfix: nginx closed a connection if a cached response had an empty
+ body.
+ Thanks to Piotr Sikora.
+
+ *) Bugfix: nginx cached a 304 response if there was the "If-None-Match"
+ header line in a proxied request.
+ Thanks to Tim Dettrick and David Kostal.
+
+ *) Bugfix: nginx did not treat a comma as separator in the
+ "Cache-Control" backend response header line.
+
+ *) Bugfix: cached HTTP/0.9 responses were handled incorrectly.
+
+ *) Bugfix: nginx sent gzipped responses to clients those do not support
+ gzip, if "gzip_static on" and "gzip_vary off"; the bug had appeared
+ in 0.8.16.
+
+ *) Bugfix: nginx always added "Content-Encoding: gzip" response header
+ line in 304 responses sent by ngx_http_gzip_static_module.
+
+ *) Bugfix: the "!-x" operator did not work.
+ Thanks to Maxim Dounin.
+
+ *) Bugfix: a segmentation fault might occur in a worker process, if
+ limit_rate was used in HTTPS server.
+ Thanks to Maxim Dounin.
+
+ *) Bugfix: a segmentation fault might occur in a worker process while
+ $limit_rate logging.
+ Thanks to Maxim Dounin.
+
+ *) Bugfix: nginx did not support dates in 2038 year on 32-bit platforms;
+
+ *) Bugfix: nginx/Windows tried to delete a temporary file twice if the
+ file should replace an already existent file.
+
+ *) Bugfix: nginx/Windows tried to rename a temporary file twice if the
+ file should replace an already existent file.
+
+ *) Bugfix: nginx/Windows might not create temporary file, a cache file,
+ or "proxy/fastcgi_store"d file if a worker had no enough access
+ rights for top level directories.
+
+ *) Bugfix: in UTF-8 encoding support by "try_files" directive in
+ nginx/Windows.
+
+ *) Bugfix: UTF-8 encoding usage in the ngx_http_autoindex_module.
+ Thanks to Maxim Dounin.
+
+ *) Bugfix: the ngx_http_autoindex_module did not show the trailing
+ slash in links to a directory; the bug had appeared in 0.7.15.
+
+ *) Bugfix: nginx did not close a log file set by the --error-log-path
+ configuration option; the bug had appeared in 0.7.53.
+
+ *) Bugfix: "addition_types" directive was incorrectly named
+ "addtion_types".
+
+ *) Bugfix: invalid request line in $request variable was written in
+ access_log only if error_log was set to "info" or "debug" level.
+
+
+Changes with nginx 0.7.64 16 Nov 2009
+
+ *) Security: now SSL/TLS renegotiation is disabled.
+ Thanks to Maxim Dounin.
+
+ *) Bugfix: nginx sent gzipped responses to clients those do not support
+ gzip, if "gzip_static on" and "gzip_vary off"; the bug had appeared
+ in 0.7.63.
+
+ *) Bugfix: if names .domain.tld, .sub.domain.tld, and .domain-some.tld
+ were defined, then the name .sub.domain.tld was matched by
+ .domain.tld.
+
+ *) Bugfix: segmentation fault and infinite looping in resolver.
+
+ *) Bugfix: in resolver.
+ Thanks to Artem Bokhan.
+
+ *) Bugfix: resolver cache poisoning.
+ Thanks to Matthew Dempsky.
+
+ *) Bugfix: memory leak in resolver.
+ Thanks to Matthew Dempsky.
+
+
+Changes with nginx 0.7.63 26 Oct 2009
+
+ *) Security: now "/../" are disabled in "Destination" request header
+ line.
+
+ *) Change: minimum supported OpenSSL version is 0.9.7.
+
+ *) Change: the "ask" parameter of the "ssl_verify_client" directive was
+ changed to the "optional" parameter and now it checks a client
+ certificate if it was offered.
+ Thanks to Brice Figureau.
+
+ *) Feature: now the "-V" switch shows TLS SNI support.
+
+ *) Feature: the $ssl_client_verify variable.
+ Thanks to Brice Figureau.
+
+ *) Feature: the "ssl_crl" directive.
+ Thanks to Brice Figureau.
+
+ *) Bugfix: the $ssl_client_cert variable usage corrupted memory; the
+ bug had appeared in 0.7.7.
+ Thanks to Sergey Zhuravlev.
+
+ *) Feature: now the start cache loader runs in a separate process; this
+ should improve large caches handling.
+
+ *) Feature: now temporary files and permanent storage area may reside
+ at different file systems.
+
+ *) Bugfix: nginx counted incorrectly disk cache size.
+
+ *) Change: now directive "gzip_disable msie6" does not disable gzipping
+ for MSIE 6.0 SV1.
+
+ *) Bugfix: nginx always added "Vary: Accept-Encoding" response header
+ line, if both "gzip_static" and "gzip_vary" were on.
+
+ *) Feature: the "proxy" parameter of the "geo" directive.
+
+ *) Feature: the ngx_http_geoip_module.
+
+ *) Feature: the "limit_rate_after" directive.
+ Thanks to Ivan Debnar.
+
+ *) Feature: the "limit_req_log_level" and "limit_conn_log_level"
+ directives.
+
+ *) Bugfix: now "limit_req" directive conforms to the leaky bucket
+ algorithm.
+ Thanks to Maxim Dounin.
+
+ *) Bugfix: in ngx_http_limit_req_module.
+ Thanks to Maxim Dounin.
+
+ *) Bugfix: now nginx allows underscores in a request method.
+
+ *) Bugfix: "proxy_pass_header" and "fastcgi_pass_header" directives did
+ not pass to a client the "X-Accel-Redirect", "X-Accel-Limit-Rate",
+ "X-Accel-Buffering", and "X-Accel-Charset" lines from backend
+ response header.
+ Thanks to Maxim Dounin.
+
+ *) Bugfix: in handling "Last-Modified" and "Accept-Ranges" backend
+ response header lines; the bug had appeared in 0.7.44.
+ Thanks to Maxim Dounin.
+
+ *) Feature: the "image_filter_transparency" directive.
+
+ *) Feature: the "image_filter" directive supports variables for setting
+ size.
+
+ *) Bugfix: in PNG alpha-channel support in the
+ ngx_http_image_filter_module.
+
+ *) Bugfix: in transparency support in the ngx_http_image_filter_module.
+
+ *) Feature: now several "perl_modules" directives may be used.
+
+ *) Bugfix: ngx_http_perl_module responses did not work in subrequests.
+
+ *) Bugfix: nginx sent '\0' in a "Location" response header line on
+ MKCOL request.
+ Thanks to Xie Zhenye.
+
+ *) Bugfix: an "error_page" directive did not redirect a 413 error; the
+ bug had appeared in 0.6.10.
+
+ *) Bugfix: in memory allocation error handling.
+ Thanks to Maxim Dounin and Kirill A. Korinskiy.
+
+
+Changes with nginx 0.7.62 14 Sep 2009
+
+ *) Security: a segmentation fault might occur in worker process while
+ specially crafted request handling.
+ Thanks to Chris Ries.
+
+ *) Feature: the $upstream_cache_status variable.
+
+ *) Bugfix: an expired cached response might stick in the "UPDATING"
+ state.
+
+ *) Bugfix: a segmentation fault might occur in worker process, if
+ error_log was set to info or debug level.
+ Thanks to Sergey Bochenkov.
+
+ *) Bugfix: in handling FastCGI headers split in records.
+
+ *) Bugfix: XSLT filter may fail with message "not well formed XML
+ document" for valid XML document.
+ Thanks to Kuramoto Eiji.
+
+ *) Bugfix: now in MacOSX, Cygwin, and nginx/Windows locations given by
+ a regular expression are always tested in case insensitive mode.
+
+ *) Bugfix: now nginx/Windows ignores trailing dots in URI.
+ Thanks to Hugo Leisink.
+
+ *) Bugfix: name of file specified in --conf-path was not honored during
+ installation; the bug had appeared in 0.6.6.
+ Thanks to Maxim Dounin.
+
+ *) Bugfix: a 500 error code was returned for invalid login/password
+ while HTTP Basic authentication on Windows.
+
+
Changes with nginx 0.7.61 22 Jun 2009
- *) Bugfix: nginx could not be built on MacOSX 10.6. the bug had
- appeared in 0.8.2.
+ *) Bugfix: nginx could not be built on MacOSX 10.6.
*) Bugfix: nginx could not be built --without-http-cache; the bug had
appeared in 0.7.60.
@@ -23,7 +427,8 @@
*) Bugfix: in open_file_cache and proxy/fastcgi cache interaction on
start up.
- *) Bugfix: open_file_cache might cache open file descriptors too long.
+ *) Bugfix: open_file_cache might cache open file descriptors too long;
+ the bug had appeared in 0.7.4.
*) Bugfix: the "If-Modified-Since", "If-Range", etc. client request
header lines were passed to backend while caching if no
@@ -324,7 +729,7 @@
*) Bugfix: the "try_files" directive might test incorrectly directories.
- *) Bugfix: if there is the single server for given address:port pair,
+ *) Bugfix: if there was a single server for given address:port pair,
then captures in regular expressions in a "server_name" directive
did not work.
@@ -678,7 +1083,7 @@
*) Bugfix: the "http_503" parameter of the "proxy_next_upstream" or
"fastcgi_next_upstream" directives did not work.
- *) Bugfix: nginx might send a "Transfer-Encoding: chunked" heaer line
+ *) Bugfix: nginx might send a "Transfer-Encoding: chunked" header line
for HEAD requests.
*) Bugfix: now accept threshold depends on worker_connections.
@@ -1828,8 +2233,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; the
- bug had appeared in 0.5.8.
+ temporary 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.
@@ -2732,8 +3137,8 @@
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
- not transferred.
+ and the request body was in temporary file then the request was not
+ transferred.
*) Bugfix: perl 5.8.8 compatibility.
@@ -4087,7 +4492,7 @@
Changes with nginx 0.1.10 26 Nov 2004
*) Bugfix: if the request without arguments contains "//", "/./",
- "/../" or "%XX" then the lost character in the request line was
+ "/../" or "%XX" then the last character in the request line was
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
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/CHANGES.ru
^
|
@@ -1,4 +1,424 @@
+éÚÍÅÎÅÎÉÑ × nginx 0.7.69 19.07.2011
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ ËÜÛÉÒÏ×ÁÎÉÑ × ÒÁÂÏÞÅÍ ÐÒÏÃÅÓÓÅ ÍÏÇ
+ ÐÒÏÉÚÏÊÔÉ segmentation fault.
+ óÐÁÓÉÂÏ Lanshun Zhou.
+
+
+éÚÍÅÎÅÎÉÑ × nginx 0.7.68 14.12.2010
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÅÓÌÉ ÄÌÑ ÐÁÒÙ IPv6-ÁÄÒÅÓ:ÐÏÒÔ ÏÐÉÓÁÎ ÔÏÌØËÏ ÏÄÉÎ
+ ÓÅÒ×ÅÒ, ÔÏ ×ÙÄÅÌÅÎÉÑ × ÒÅÇÕÌÑÒÎÙÈ ×ÙÒÁÖÅÎÉÑÈ × ÄÉÒÅËÔÉ×Å server_name
+ ÎÅ ÒÁÂÏÔÁÌÉ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ ÄÉÒÅËÔÉ×Ù auth_basic × ÒÁÂÏÞÅÍ
+ ÐÒÏÃÅÓÓÅ ÍÏÇ ÐÒÏÉÚÏÊÔÉ segmentation fault.
+ óÐÁÓÉÂÏ íÉÈÁÉÌÕ ìÁÌÅÔÉÎÕ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÏÔ×ÅÔ SSI ÍÏÄÕÌÑ ÍÏÇ ÐÅÒÅÄÁ×ÁÔØÓÑ ÎÅ ÐÏÌÎÏÓÔØÀ ÐÏÓÌÅ
+ ËÏÍÁÎÄÙ include Ó ÐÁÒÁÍÅÔÒÏÍ wait="yes"; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.25.
+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Á sub_filter ÍÏÇÌÁ ÉÚÍÅÎÑÔØ ÒÅÇÉÓÔÒ ÂÕË× ÐÒÉ
+ ÞÁÓÔÉÞÎÏÍ ÓÏ×ÐÁÄÅÎÉÉ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÓÞÉÔÁÌ ÂÏÌØÛÉÅ ÐÁËÅÔÙ SSLv2 ËÁË ÏÂÙÞÎÙÅ ÔÅËÓÔÏ×ÙÅ
+ ÚÁÐÒÏÓÙ.
+ óÐÁÓÉÂÏ Miroslaw Jaworski.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÍÏÇ ÚÁËÒÙ×ÁÔØ IPv6 listen ÓÏËÅÔ ×Ï ×ÒÅÍÑ
+ ÐÅÒÅËÏÎÆÉÇÕÒÁÃÉÉ.
+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
+
+
+éÚÍÅÎÅÎÉÑ × nginx 0.7.67 15.06.2010
+
+ *) âÅÚÏÐÁÓÎÏÓÔØ: ÒÁÂÏÞÉÊ ÐÒÏÃÅÓÓ nginx/Windows ÍÏÇ ÚÁ×ÅÒÛÁÔØÓÑ Á×ÁÒÉÊÎÏ
+ ÐÒÉ ÚÁÐÒÏÓÅ ÆÁÊÌÁ Ó ÎÅ×ÅÒÎÏÊ ËÏÄÉÒÏ×ËÏÊ UTF-8.
+
+
+éÚÍÅÎÅÎÉÑ × nginx 0.7.66 07.06.2010
+
+ *) âÅÚÏÐÁÓÎÏÓÔØ: ÔÅÐÅÒØ nginx/Windows ÉÇÎÏÒÉÒÕÅÔ ÉÍÑ ÐÏÔÏËÁ ÆÁÊÌÁ ÐÏ
+ ÕÍÏÌÞÁÎÉÀ.
+ óÐÁÓÉÂÏ Jose Antonio Vazquez Gonzalez.
+
+ *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ charset-ÆÉÌØÔÒ ÒÁÂÏÔÁÅÔ ÄÏ SSI-ÆÉÌØÔÒÁ.
+
+ *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ × ÌÏÇ ÏÛÉÂÏË ÎÅ ÐÉÛÅÔÓÑ ÓÏÏÂÝÅÎÉÅ, ÅÓÌÉ ÐÅÒÅÍÅÎÎÁÑ
+ ÎÅ ÎÁÊÄÅÎÁ Ó ÐÏÍÏÝØÀ ÍÅÔÏÄÁ $r->variable().
+
+ *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ keepalive ÓÏÅÄÉÎÅÎÉÑ ÐÏÓÌÅ ÚÁÐÒÏÓÏ× POST ÎÅ
+ ÚÁÐÒÅÝÁÀÔÓÑ ÄÌÑ MSIE 7.0+.
+ óÐÁÓÉÂÏ Adam Lounds.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Ù proxy_no_cache É fastcgi_no_cache.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÔÅÐÅÒØ ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ ÐÅÒÅÍÅÎÎÏÊ $scheme × ÄÉÒÅËÔÉ×Å
+ rewrite Á×ÔÏÍÁÔÉÞÅÓËÉ ÄÅÌÁÅÔÓÑ ÒÅÄÉÒÅËÔ.
+ óÐÁÓÉÂÏ Piotr Sikora.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Á chunked_transfer_encoding.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÐÅÒÅÍÅÎÎÙÅ $geoip_city_continent_code, $geoip_latitude É
+ $geoip_longitude.
+ óÐÁÓÉÂÏ Arvind Sundararajan.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÍÏÄÕÌØ ngx_http_image_filter_module ÔÅÐÅÒØ ×ÓÅÇÄÁ
+ ÕÄÁÌÑÅÔ EXIF É ÄÒÕÇÉÅ ÄÁÎÎÙÅ, ÅÓÌÉ ÏÎÉ ÚÁÎÉÍÁÀÔ ÂÏÌØÛÅ 5% ×
+ JPEG-ÆÁÊÌÅ.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÔÅÐÅÒØ ÄÉÒÅËÔÉ×Á msie_padding ÒÁÂÏÔÁÅÔ É ÄÌÑ Chrome.
+
+ *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ keepalive ÓÏÅÄÉÎÅÎÉÑ ÚÁÐÒÅÝÅÎÙ ÄÌÑ Safari.
+ óÐÁÓÉÂÏ Joshua Sierles.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÉÇÎÏÒÉÒÏ×ÁÌ ÚÎÁÞÅÎÉÑ "private" É "no-store" ×
+ ÓÔÒÏËÅ "Cache-Control" × ÚÁÇÏÌÏ×ËÅ ÏÔ×ÅÔÁ ÂÜËÅÎÄÁ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÓÉÍ×ÏÌ "&" ÐÒÉ ËÏÐÉÒÏ×ÁÎÉÉ × ÁÒÇÕÍÅÎÔÙ × ÐÒÁ×ÉÌÁÈ
+ rewrite ÎÅ ÜËÒÁÎÉÒÏ×ÁÌÓÑ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÍÏÇ ÚÁ×ÅÒÛÁÔØÓÑ Á×ÁÒÉÊÎÏ ×Ï ×ÒÅÍÑ ÏÂÒÁÂÏÔËÉ
+ ÓÉÇÎÁÌÁ ÉÌÉ ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ ÄÉÒÅËÔÉ×Ù timer_resolution ÎÁ
+ ÐÌÁÔÆÏÒÍÁÈ, ÎÅ ÐÏÄÄÅÒÖÉ×ÁÀÝÉÈ ÍÅÔÏÄÙ kqueue ÉÌÉ eventport.
+ óÐÁÓÉÂÏ George Xie É íÁËÓÉÍÕ äÕÎÉÎÕ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÅÓÌÉ ×ÒÅÍÅÎÎÙÅ ÆÁÊÌÙ É ÐÏÓÔÏÑÎÎÏÅ ÍÅÓÔÏ ÈÒÁÎÅÎÉÑ
+ ÒÁÓÐÏÌÁÇÁÌÉÓØ ÎÁ ÒÁÚÎÙÈ ÆÁÊÌÏ×ÙÈ ÓÉÓÔÅÍÁÈ, ÔÏ Õ ÐÏÓÔÏÑÎÎÙÈ ÆÁÊÌÏ×
+ ×ÒÅÍÑ ÉÚÍÅÎÅÎÉÑ ÂÙÌÏ ÎÅ×ÅÒÎÙÍ.
+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÍÏÄÕÌØ ngx_http_memcached_module ÍÏÇ ×ÙÄÁ×ÁÔØ ÏÛÉÂËÕ
+ "memcached sent invalid trailer".
+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÍÏÇ ÓÏÂÒÁÔØ ÂÉÂÌÉÏÔÅËÕ zlib-1.2.4 ÉÚ ÉÓÈÏÄÎÙÈ
+ ÔÅËÓÔÏ×.
+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÍÏÄÕÌØ SSI × ÐÏÄÚÁÐÒÏÓÁÈ ÉÓÐÏÌØÚÏ×ÁÌ ÚÁËÜÛÉÒÏ×ÁÎÎÙÅ ×
+ ÏÓÎÏ×ÎÏÍ ÚÁÐÒÏÓÅ ÚÎÁÞÅÎÉÑ ÐÅÒÅÍÅÎÎÙÈ $query_string, $arg_... É ÉÍ
+ ÐÏÄÏÂÎÙÈ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÐÏÄÄÅÒÖÉ×ÁÌ HTTPS-ÒÅÆÅÒÅÒÙ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx/Windows ÍÏÇ ÎÅ ÎÁÈÏÄÉÔØ ÆÁÊÌÙ, ÅÓÌÉ ÐÕÔØ ×
+ ËÏÎÆÉÇÕÒÁÃÉÉ ÂÙÌ ÚÁÄÁÎ × ÄÒÕÇÏÍ ÒÅÇÉÓÔÒÅ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.65.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÅÒÅÍÅÎÎÁÑ $date_local ×ÙÄÁ×ÁÌÁ ÎÅ×ÅÒÎÏÅ ×ÒÅÍÑ, ÅÓÌÉ
+ ÉÓÐÏÌØÚÏ×ÁÌÓÑ ÆÏÒÍÁÔ "%s".
+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÐÏÄÄÅÒÖÉ×ÁÌ ×ÓÅ ÛÉÆÒÙ, ÉÓÐÏÌØÚÕÅÍÙÅ ×
+ ËÌÉÅÎÔÓËÉÈ ÓÅÒÔÉÆÉËÁÔÁÈ.
+ óÐÁÓÉÂÏ éÎÎÏËÅÎÔÉÀ åÎÉËÅÅ×Õ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÅÓÌÉ ssl_session_cache ÎÅ ÂÙÌ ÕÓÔÁÎÏ×ÌÅÎ ÉÌÉ ÕÓÔÁÎÏ×ÌÅÎ
+ × none, ÔÏ ÐÒÉ ÐÒÏ×ÅÒËÅ ËÌÉÅÎÔÓËÏÇÏ ÓÅÒÔÉÆÉËÁÔÙ ÍÏÇÌÁ ÐÒÏÉÓÈÏÄÉÔØ
+ ÏÛÉÂËÁ "session id context uninitialized"; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.1.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÓÏ×ÍÅÓÔÉÍÏÓÔØ Ó OpenSSL-1.0.0 ÎÁ 64-ÂÉÔÎÏÍ Linux.
+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: geo-ÄÉÁÐÁÚÏÎ ×ÏÚ×ÒÁÝÁÌ ÚÎÁÞÅÎÉÅ ÐÏ ÕÍÏÌÞÁÎÉÀ, ÅÓÌÉ
+ ÄÉÁÐÁÚÏÎ ×ËÌÀÞÁÌ × ÓÅÂÑ ÏÄÎÕ É ÂÏÌÅÅ ÓÅÔÅÊ ÒÁÚÍÅÒÏÍ /16 É ÎÅ
+ ÎÁÞÉÎÁÌÓÑ ÎÁ ÇÒÁÎÉÃÅ ÓÅÔÉ ÒÁÚÍÅÒÏÍ /16.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÅÒÅÍÅÎÎÕÀ $uid_got ÎÅÌØÚÑ ÂÙÌÏ ÉÓÐÏÌØÚÏ×ÁÔØ × SSI É
+ ÐÅÒÌÏ×ÏÍ ÍÏÄÕÌÑÈ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÒÁÂÏÞÉÊ ÐÒÏÃÅÓÓ ÚÁ×ÉÓÁÌ ÐÒÉ ÚÁÐÒÏÓÅ ÆÁÊÌÁ FIFO.
+ óÐÁÓÉÂÏ Vicente Aguilar É íÁËÓÉÍÕ äÕÎÉÎÕ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÚÎÁÞÅÎÉÅ ÐÅÒÅÍÅÎÎÏÊ ÐÏ×ÔÏÒÎÏ ÜËÒÁÎÉÒÏ×ÁÌÏÓØ ÐÏÓÌÅ
+ ËÁÖÄÏÇÏ ×Ù×ÏÄÁ SSI-ËÏÍÁÎÄÙ echo; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.6.14.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÁÒÁÍÅÔÒ stub × SSI-ÄÉÒÅËÔÉ×Å include ÎÅ ÉÓÐÏÌØÚÏ×ÁÌÓÑ,
+ ÅÓÌÉ ÐÕÓÔÏÊ ÏÔ×ÅÔ ÉÍÅÌ ËÏÄ 200.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÂÌÏË, ÉÓÐÏÌØÚÕÅÍÙÊ × ÐÁÒÁÍÅÔÒÅ stub × SSI-ÄÉÒÅËÔÉ×Å
+ include, ×Ù×ÏÄÉÌÓÑ Ó MIME-ÔÉÐÏÍ "text/plain".
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÅÓÌÉ ÐÒÏËÓÉÒÏ×ÁÎÎÙÊ ÉÌÉ FastCGI ÚÁÐÒÏÓ ×ÎÕÔÒÅÎÎÅ
+ ÐÅÒÅÎÁÐÒÁ×ÌÑÌÓÑ × ÄÒÕÇÏÊ ÐÒÏËÓÉÒÏ×ÁÎÎÙÊ ÉÌÉ FastCGI location, ÔÏ ×
+ ÒÁÂÏÞÅÍ ÐÒÏÃÅÓÓÅ ÍÏÇ ÐÒÏÉÚÏÊÔÉ segmentation fault; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ
+ × 0.7.65.
+ óÐÁÓÉÂÏ Yichun Zhang.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÓÏÅÄÉÎÅÎÉÑ IMAP Ë ÓÅÒ×ÅÒÕ Zimbra ÍÏÇÌÏ ÚÁ×ÉÓÎÕÔØ ÄÏ
+ ÔÁÊÍÁÕÔÁ.
+ óÐÁÓÉÂÏ Alan Batie.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÐÏÄÄÅÒÖÉ×ÁÌ ÐÅÒÅÄÁÞÕ chunk'ÁÍÉ ÄÌÑ 201-ÙÈ
+ ÏÔ×ÅÔÏ×.
+ óÐÁÓÉÂÏ Julian Reich.
+
+
+éÚÍÅÎÅÎÉÑ × nginx 0.7.65 01.02.2010
+
+ *) âÅÚÏÐÁÓÎÏÓÔØ: ÔÅÐÅÒØ nginx/Windows ÉÇÎÏÒÉÒÕÅÔ ÐÒÏÂÅÌÙ × ËÏÎÃÅ URI.
+ óÐÁÓÉÂÏ Dan Crowley, Core Security Technologies.
+
+ *) âÅÚÏÐÁÓÎÏÓÔØ: ÔÅÐÅÒØ nginx/Windows ÉÇÎÏÒÉÒÕÅÔ ËÏÒÏÔËÉÅ ÉÍÅÎÁ ÆÁÊÌÏ×.
+ óÐÁÓÉÂÏ Dan Crowley, Core Security Technologies.
+
+ *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ ÄÌÑ ÐÒÏËÓÉÒÕÅÍÙÈ ÏÔ×ÅÔÏ× HTTP/0.9 × ÌÏÇ ÐÉÛÅÔÓÑ
+ ËÏÄ ÏÔ×ÅÔÁ "009".
+
+ *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ ÐÏ ÕÍÏÌÞÁÎÉÀ ÒÁÚÍÅÒ ÂÕÆÅÒÁ ÄÉÒÅËÔÉ×Ù
+ large_client_header_buffers ÒÁ×ÅÎ 8K.
+ óÐÁÓÉÂÏ Andrew Cholakian.
+
+ *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ ÐÏ ÕÍÏÌÞÁÎÉÀ ÉÓÐÏÌØÚÕÀÔÓÑ ÓÌÅÄÕÀÝÉÅ ÛÉÆÒÙ SSL:
+ "HIGH:!ADH:!MD5".
+
+ *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ ÐÒÏÔÏËÏÌ SSLv2 ÐÏ ÕÍÏÌÞÁÎÉÀ ÚÁÐÒÅÝ£Î.
+
+ *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ ÚÎÁÞÅÎÉÅ ÐÅÒÅÍÅÎÎÏÊ $host ×ÓÅÇÄÁ × ÎÉÖÎÅÍ ÒÅÇÉÓÔÒÅ.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÆÁÊÌ conf/fastcgi.conf ÄÌÑ ÐÒÏÓÔÙÈ ËÏÎÆÉÇÕÒÁÃÉÊ FastCGI.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÔÅÐÅÒØ ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ ÐÅÒÅÍÅÎÎÙÈ × ÄÉÒÅËÔÉ×Å
+ proxy_pass ÎÅ ÔÒÅÂÕÅÔÓÑ ÚÁÄÁ×ÁÔØ URI.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÐÅÒÅÍÅÎÎÁÑ $ssl_session_id.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÅÓÌÉ ÐÒÏËÓÉÒÏ×ÁÎÎÙÊ ÉÌÉ FastCGI ÚÁÐÒÏÓ ×ÎÕÔÒÅÎÎÅ
+ ÐÅÒÅÎÁÐÒÁ×ÌÑÌÓÑ × ÄÒÕÇÏÊ ÐÒÏËÓÉÒÏ×ÁÎÎÙÊ ÉÌÉ FastCGI location, ÔÏ
+ ÐÅÒÅÍÅÎÎÁÑ $upstream_response_time ÍÏÇÌÁ ÉÍÅÔØ ÎÅÎÏÒÍÁÌØÎÏ ÂÏÌØÛÏÅ
+ ÚÎÁÞÅÎÉÅ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.63.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÅÓÌÉ ÄÉÒÅËÔÉ×Á "expires modified" ×ÙÓÔÁ×ÌÑÌÁ ÄÁÔÕ ×
+ ÐÒÏÛÌÏÍ, ÔÏ × ÓÔÒÏËÅ ÚÁÇÏÌÏ×ËÁ ÏÔ×ÅÔÁ "Cache-Control" ×ÙÄÁ×ÁÌÏÓØ
+ ÏÔÒÉÃÁÔÅÌØÎÏÅ ÞÉÓÌÏ.
+ óÐÁÓÉÂÏ áÌÅËÓÅÀ ëÁÐÒÁÎÏ×Õ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÚÁËÒÙ×ÁÌ ÓÏÅÄÉÎÅÎÉÅ ÐÒÉ ÚÁÐÒÏÓÅ ÚÁËÜÛÉÒÏ×ÁÎÎÏÇÏ
+ ÏÔ×ÅÔÁ Ó ÐÕÓÔÙÍ ÔÅÌÏÍ.
+ óÐÁÓÉÂÏ Piotr Sikora.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ËÜÛÉÒÏ×ÁÌ 304 ÏÔ×ÅÔ, ÅÓÌÉ × ÚÁÇÏÌÏ×ËÅ
+ ÐÒÏËÓÉÒÕÅÍÏÇÏ ÚÁÐÒÏÓÁ ÂÙÌÁ ÓÔÒÏËÁ "If-None-Match".
+ óÐÁÓÉÂÏ Tim Dettrick É David Kostal.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÓÞÉÔÁÌ ÚÁÐÑÔÕÀ ÒÁÚÄÅÌÉÔÅÌÅÍ × ÓÔÒÏËÅ
+ "Cache-Control" × ÓÔÒÏËÅ ÚÁÇÏÌÏ×ËÁ ÂÜËÅÎÄÁ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÚÁËÜÛÉÒÏ×ÁÎÎÙÅ ÏÔ×ÅÔÙ ÏÔ×ÅÔÏ× HTTP/0.9 ÎÅÐÒÁ×ÉÌØÎÏ
+ ÏÂÒÁÂÁÔÙ×ÁÌÉÓØ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÐÅÒÅÄÁ×ÁÌ ÓÖÁÔÙÅ ÏÔ×ÅÔÙ ËÌÉÅÎÔÁÍ, ÎÅ
+ ÐÏÄÄÅÒÖÉ×ÁÀÝÉÍ ÓÖÁÔÉÅ, ÐÒÉ ÎÁÓÔÒÏÊËÁÈ gzip_static on É gzip_vary
+ off; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.8.16.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ×ÓÅÇÄÁ ÄÏÂÁ×ÌÑÌ ÓÔÒÏËÕ "Content-Encoding: gzip" ×
+ ÚÁÇÏÌÏ×ÏË 304-ÙÈ ÏÔ×ÅÔÏ× ÍÏÄÕÌÑ ngx_http_gzip_static_module.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÏÐÅÒÁÔÏÒ "!-x" ÎÅ ÒÁÂÏÔÁÌ.
+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: × ÒÁÂÏÞÅÍ ÐÒÏÃÅÓÓÅ ÍÏÇ ÐÒÏÉÚÏÊÔÉ segmentation fault ÐÒÉ
+ ÉÓÐÏÌØÚÏ×ÁÎÉÉ limit_rate × HTTPS ÓÅÒ×ÅÒÅ.
+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÒÉ ÚÁÐÉÓÉ × ÌÏÇ ÐÅÒÅÍÅÎÎÏÊ $limit_rate × ÒÁÂÏÞÅÍ
+ ÐÒÏÃÅÓÓÅ ÐÒÏÉÓÈÏÄÉÌ segmentation fault.
+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÐÏÄÄÅÒÖÉ×ÁÌ ÄÁÔÙ × 2038 ÇÏÄÕ ÎÁ 32-ÂÉÔÎÙÈ
+ ÐÌÁÔÆÏÒÍÁÈ;
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx/Windows ÐÙÔÁÌÓÑ Ä×ÁÖÄÙ ÕÄÁÌÉÔØ ×ÒÅÍÅÎÎÙÊ ÆÁÊÌ ÐÒÉ
+ ÐÅÒÅÚÁÐÉÓÉ ÕÖÅ ÓÕÝÅÓÔ×ÕÀÝÅÇÏ ÆÁÊÌÁ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx/Windows ÐÙÔÁÌÓÑ Ä×ÁÖÄÙ ÐÅÒÅÉÍÅÎÏ×ÁÔØ ×ÒÅÍÅÎÎÙÊ
+ ÆÁÊÌ ÐÒÉ ÐÅÒÅÚÁÐÉÓÉ ÕÖÅ ÓÕÝÅÓÔ×ÕÀÝÅÇÏ ÆÁÊÌÁ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx/Windows ÍÏÇ ÎÅ ÓÏÚÄÁÔØ ×ÒÅÍÅÎÎÙÊ ÆÁÊÌ, ÆÁÊÌ ×
+ ËÜÛÅ ÉÌÉ ÆÁÊÌ Ó ÐÏÍÏÝØÀ ÄÉÒÅËÔÉ× proxy/fastcgi_store, ÅÓÌÉ ÒÁÂÏÞÉÊ
+ ÐÒÏÃÅÓÓ ÎÅ ÉÍÅÌ ÄÏÓÔÁÔÏÞÎÏ ÐÒÁ× ÄÌÑ ÒÁÂÏÔÙ Ó ËÁÔÁÌÏÇÁÍÉ ×ÅÒÈÎÅÇÏ
+ ÕÒÏ×ÎÑ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: × ÐÏÄÄÅÒÖËÅ ËÏÄÉÒÏ×ËÉ UTF-8 ÄÉÒÅËÔÉ×ÏÊ try_files ×
+ nginx/Windows.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÏÛÉÂËÉ ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ ËÏÄÉÒÏ×ËÉ UTF-8 ×
+ ngx_http_autoindex_module.
+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÍÏÄÕÌØ ngx_http_autoindex_module ÎÅ ÐÏËÁÚÙ×ÁÌ ÐÏÓÌÅÄÎÉÊ
+ ÓÌÜÛ ÄÌÑ ÌÉÎËÏ× ÎÁ ËÁÔÁÌÏÇÉ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.15.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÚÁËÒÙ×ÁÌ ÌÏÇ, ÚÁÄÁÎÎÙÊ ÐÁÒÁÍÅÔÒÏÍ ËÏÎÆÉÇÕÒÁÃÉÉ
+ --error-log-path; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.53.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Á "addition_types" ÂÙÌÁ ÎÅ×ÅÒÎÏ ÎÁÚ×ÁÎÁ
+ "addtion_types".
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÎÅ×ÅÒÎÁÑ ÓÔÒÏËÁ ÚÁÐÒÏÓÁ × ÐÅÒÅÍÅÎÎÏÊ $request
+ ÚÁÐÉÓÙ×ÁÌÁÓØ × access_log ÔÏÌØËÏ ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ error_log ÎÁ
+ ÕÒÏ×ÎÅ info ÉÌÉ debug.
+
+
+éÚÍÅÎÅÎÉÑ × nginx 0.7.64 16.11.2009
+
+ *) âÅÚÏÐÁÓÎÏÓÔØ: ÔÅÐÅÒØ SSL/TLS renegotiation ÚÁÐÒÅÝ£Î.
+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÐÅÒÅÄÁ×ÁÌ ÓÖÁÔÙÅ ÏÔ×ÅÔÙ ËÌÉÅÎÔÁÍ, ÎÅ
+ ÐÏÄÄÅÒÖÉ×ÁÀÝÉÍ ÓÖÁÔÉÅ, ÐÒÉ ÎÁÓÔÒÏÊËÁÈ gzip_static on É gzip_vary
+ off; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.63.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÅÓÌÉ ÂÙÌÉ ÏÐÉÓÁÎÙ ÉÍÅÎÁ .domain.tld, .sub.domain.tld É
+ .domain-some.tld, ÔÏ ÉÍÑ .sub.domain.tld ÐÏÐÁÄÁÌÏ ÐÏÄ ÍÁÓËÕ
+ .domain.tld.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: segmentation fault É ÚÁÃÉËÌÉ×ÁÎÉÑ × resolver'Å.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: × resolver'Å.
+ óÐÁÓÉÂÏ áÒÔ£ÍÕ âÏÈÁÎÕ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÏÒÞÉ ËÜÛÁ resolver'Á.
+ óÐÁÓÉÂÏ Matthew Dempsky.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÕÔÅÞËÉ ÐÁÍÑÔÉ × resolver'Å.
+ óÐÁÓÉÂÏ Matthew Dempsky.
+
+
+éÚÍÅÎÅÎÉÑ × nginx 0.7.63 26.10.2009
+
+ *) âÅÚÏÐÁÓÎÏÓÔØ: ÔÅÐÅÒØ ÓÉÍ×ÏÌÙ "/../" ÚÁÐÒÅÝÅÎÙ × ÓÔÒÏËÅ "Destination"
+ × ÚÁÇÏÌÏ×ËÅ ÚÁÐÒÏÓÁ.
+
+ *) éÚÍÅÎÅÎÉÅ: ÍÉÎÉÍÁÌØÎÁÑ ÐÏÄÄÅÒÖÉ×ÁÅÍÁÑ ×ÅÒÓÉÑ OpenSSL - 0.9.7.
+
+ *) éÚÍÅÎÅÎÉÅ: ÐÁÒÁÍÅÔÒ ask ÄÉÒÅËÔÉ×Ù ssl_verify_client ÉÚÍÅΣΠÎÁ
+ ÐÁÒÁÍÅÔÒ optional É ÔÅÐÅÒØ ÏÎ ÐÒÏ×ÅÒÑÅÔ ËÌÉÅÎÔÓËÉÊ ÓÅÒÔÉÆÉËÁÔ, ÅÓÌÉ
+ ÏÎ ÂÙÌ ÐÒÅÄÌÏÖÅÎ.
+ óÐÁÓÉÂÏ Brice Figureau.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÔÅÐÅÒØ ËÌÀÞ -V ÐÏËÁÚÙ×ÁÅÔ ÓÔÁÔÕÓ ÐÏÄÄÅÒÖËÉ TLS SNI.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÐÅÒÅÍÅÎÎÁÑ $ssl_client_verify.
+ óÐÁÓÉÂÏ Brice Figureau.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Á ssl_crl.
+ óÐÁÓÉÂÏ Brice Figureau.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÉÓÐÏÌØÚÏ×ÁÎÉÅ ÐÅÒÅÍÅÎÎÏÊ $ssl_client_cert ÐÏÒÔÉÌÏ
+ ÐÁÍÑÔØ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.7.
+ óÐÁÓÉÂÏ óÅÒÇÅÀ öÕÒÁ×Ì£×Õ.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÔÅÐÅÒØ ÓÔÁÒÔÏ×ÙÊ ÚÁÇÒÕÚÞÉË ËÜÛÁ ÒÁÂÏÔÁÅÔ × ÏÔÄÅÌØÎÏÍ
+ ÐÒÏÃÅÓÓ; ÜÔÏ ÄÏÌÖÎÏ ÕÌÕÞÛÉÔØ ÏÂÒÁÂÏÔËÕ ÂÏÌØÛÉÈ ËÜÛÅÊ.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÔÅÐÅÒØ ×ÒÅÍÅÎÎÙÅ ÆÁÊÌÙ É ÐÏÓÔÏÑÎÎÏÅ ÍÅÓÔÏ ÈÒÁÎÅÎÉÑ ÍÏÇÕÔ
+ ÒÁÓÐÏÌÁÇÁÔØÓÑ ÎÁ ÒÁÚÎÙÈ ÆÁÊÌÏ×ÙÈ ÓÉÓÔÅÍÁÈ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ×ÅÒÎÏ ÓÞÉÔÁÌ ÒÁÚÍÅÒ ËÜÛÁ ÎÁ ÄÉÓËÅ.
+
+ *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ ÄÉÒÅËÔÉ×Á "gzip_disable msie6" ÎÅ ÚÁÐÒÅÝÁÅÔ ÓÖÁÔÉÅ
+ ÄÌÑ MSIE 6.0 SV1.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ×ÓÅÇÄÁ ÄÏÂÁ×ÌÑÌ ÓÔÒÏËÕ "Vary: Accept-Encoding" ×
+ ÚÁÇÏÌÏ×ÏË ÏÔ×ÅÔÁ, ÅÓÌÉ ÏÂÅ ÄÉÒÅËÔÉ×Ù gzip_static É gzip_vary ÂÙÌÉ
+ ×ËÌÀÞÅÎÙ.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÐÁÒÁÍÅÔÒ proxy ÄÉÒÅËÔÉ×Ù geo.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÍÏÄÕÌØ ngx_http_geoip_module.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Á limit_rate_after.
+ óÐÁÓÉÂÏ Ivan Debnar.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Ù limit_req_log_level É limit_conn_log_level.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÔÅÐÅÒØ ÄÉÒÅËÔÉ×Á limit_req ÓÏÏÔ×ÅÔÓÔ×ÕÅÔ ÁÌÇÏÒÉÔÍÕ
+ leaky bucket.
+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: × ÍÏÄÕÌÅ ngx_http_limit_req_module.
+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÔÅÐÅÒØ nginx ÒÁÚÒÅÛÁÅÔ ÐÏÄÞ£ÒËÉ×ÁÎÉÑ × ÍÅÔÏÄÅ ÚÁÐÒÏÓÁ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Ù proxy_pass_header É fastcgi_pass_header" ÎÅ
+ ÐÅÒÅÄÁ×ÁÌÉ ËÌÉÅÎÔÕ ÓÔÒÏËÉ "X-Accel-Redirect", "X-Accel-Limit-Rate",
+ "X-Accel-Buffering" É "X-Accel-Charset" ÉÚ ÚÁÇÏÌÏ×ËÁ ÏÔ×ÅÔÁ
+ ÂÜËÅÎÄÁ.
+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: × ÏÂÒÁÂÏÔËÅ ÓÔÒÏË "Last-Modified" É "Accept-Ranges" ×
+ ÚÁÇÏÌÏ×ËÅ ÏÔ×ÅÔÁ ÂÜËÅÎÄÁ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.44.
+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Á image_filter_transparency.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Á image_filter ÐÏÄÄÅÒÖÉ×ÁÅÔ ÐÅÒÅÍÅÎÎÙÅ ÄÌÑ
+ ÚÁÄÁÎÉÑ ÒÁÚÍÅÒÏ×.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: × ÐÏÄÄÅÒÖËÅ ÁÌØÆÁ-ËÁÎÁÌÁ PNG × ÍÏÄÕÌÅ
+ ngx_http_image_filter_module.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: × ÐÏÄÄÅÒÖËÅ ÐÒÏÚÒÁÞÎÏÓÔÉ × ÍÏÄÕÌÅ
+ ngx_http_image_filter_module.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÔÅÐÅÒØ ÍÏÖÎÏ ÉÓÐÏÌØÚÏ×ÁÔØ ÎÅÓËÏÌØËÏ ÄÉÒÅËÔÉ×
+ perl_modules.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÏÔ×ÅÔÙ ÍÏÄÕÌÑ ngx_http_perl_module ÎÅ ÒÁÂÏÔÁÌÉ ×
+ ÐÏÄÚÁÐÒÏÓÁÈ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÓÌÁÌ ÓÉÍ×ÏÌ '\0' × ÓÔÒÏËÅ "Location" × ÚÁÇÏÌÏ×ËÅ
+ × ÏÔ×ÅÔÅ ÎÁ ÚÁÐÒÏÓ MKCOL.
+ óÐÁÓÉÂÏ Xie Zhenye.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Á error_page ÎÅ ÐÅÒÅÎÁÐÒÁ×ÌÑÌÁ ÏÛÉÂËÕ 413;
+ ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.6.10.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: × ÏÂÒÁÂÏÔËÅ ÏÛÉÂÏË ×ÙÄÅÌÅÎÉÑ ÐÁÍÑÔÉ.
+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ É ëÉÒÉÌÌÕ ëÏÒÉÎÓËÏÍÕ.
+
+
+éÚÍÅÎÅÎÉÑ × nginx 0.7.62 14.09.2009
+
+ *) âÅÚÏÐÁÓÎÏÓÔØ: ÐÒÉ ÏÂÒÁÂÏÔËÅ ÓÐÅÃÉÁÌØÎÏ ÓÏÚÄÁÎÎÏÇÏ ÚÁÐÒÏÓÁ × ÒÁÂÏÞÅÍ
+ ÐÒÏÃÅÓÓÅ ÍÏÇ ÐÒÏÉÚÏÊÔÉ segmentation fault.
+ óÐÁÓÉÂÏ Chris Ries.
+
+ *) äÏÂÁ×ÌÅÎÉÅ: ÐÅÒÅÍÅÎÎÁÑ $upstream_cache_status.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÕÓÔÁÒÅ×ÛÉÊ ÚÁËÜÛÉÒÏ×ÁÎÎÙÊ ÚÁÐÒÏÓ ÍÏÇ ÚÁÌÉÐÎÕÔØ ×
+ ÓÏÓÔÏÑÎÉÉ "UPDATING".
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ error_log ÎÁ ÕÒÏ×ÎÅ info ÉÌÉ debug ×
+ ÒÁÂÏÞÅÍ ÐÒÏÃÅÓÓÅ ÍÏÇ ÐÒÏÉÚÏÊÔÉ segmentation fault.
+ óÐÁÓÉÂÏ óÅÒÇÅÀ âÏÞÅÎËÏ×Õ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: × ÏÂÒÁÂÏÔËÅ ÚÁÇÏÌÏ×ËÏ× ÏÔ×ÅÔÁ, ÒÁÚÄÅÌ£ÎÎÙÈ ×
+ FastCGI-ÚÁÐÉÓÑÈ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: XSLT-ÆÉÌØÔÒ ÍÏÇ ×ÙÄÁ×ÁÔØ ÏÛÉÂËÕ "not well formed XML
+ document" ÄÌÑ ÐÒÁ×ÉÌØÎÏÇÏ ÄÏËÕÍÅÎÔÁ.
+ óÐÁÓÉÂÏ Kuramoto Eiji.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: × MacOSX, Cygwin É nginx/Windows ÐÒÉ ÐÒÏ×ÅÒËÅ
+ location'Ï×, ÚÁÄÁÎÎÙÈ ÒÅÇÕÌÑÒÎÙÍ ×ÙÒÁÖÅÎÉÅÍ, ÔÅÐÅÒØ ×ÓÅÇÄÁ ÄÅÌÁÅÔÓÑ
+ ÓÒÁ×ÎÅÎÉÅ ÂÅÚ ÕÞ£ÔÁ ÒÅÇÉÓÔÒÁ ÓÉÍ×ÏÌÏ×.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÔÅÐÅÒØ nginx/Windows ÉÇÎÏÒÉÒÕÅÔ ÔÏÞËÉ × ËÏÎÃÅ URI.
+ óÐÁÓÉÂÏ Hugo Leisink.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÉÍÑ ÆÁÊÌÁ ÕËÁÚÁÎÎÏÇÏ × --conf-path ÉÇÎÏÒÉÒÏ×ÁÌÏÓØ ÐÒÉ
+ ÕÓÔÁÎÏ×ËÅ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.6.6.
+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
+
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ HTTP Basic-ÁÕÔÅÎÔÉÆÉËÁÃÉÉ ÎÁ Windows
+ ÄÌÑ ÎÅ×ÅÒÎÙÈ ÉÍÅÎÉ/ÐÁÒÏÌÑ ×ÏÚ×ÒÁÝÁÌÁÓØ 500-ÁÑ ÏÛÉÂËÁ.
+
+
éÚÍÅÎÅÎÉÑ × nginx 0.7.61 22.06.2009
*) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÓÏÂÉÒÁÌÓÑ ÎÁ MacOSX 10.6.
@@ -6,9 +426,9 @@
*) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÓÏÂÉÒÁÌÓÑ Ó ÐÁÒÁÍÅÔÒÏÍ --without-http-cache;
ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.60.
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÅÓÌÉ ÂÙÌÏ ÉÓÐÏÌØÚÏ×ÁÌÓÑ ÐÅÒÅÈ×ÁÔ 401 ÏÛÉÂËÉ ÏÔ ÂÜËÅÎÄÁ
- É ÂÜËÅÎÄ ÎÅ ×ÏÚ×ÒÁÝÁÌ ÓÔÒÏËÕ "WWW-Authenticate" × ÚÁÇÏÌÏ×ËÅ ÏÔ×ÅÔÁ,
- ÔÏ × ÒÁÂÏÞÅÍ ÐÒÏÃÅÓÓÅ ÐÒÏÉÓÈÏÄÉÌ segmentation fault.
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÅÓÌÉ ÉÓÐÏÌØÚÏ×ÁÌÓÑ ÐÅÒÅÈ×ÁÔ 401 ÏÛÉÂËÉ ÏÔ ÂÜËÅÎÄÁ É
+ ÂÜËÅÎÄ ÎÅ ×ÏÚ×ÒÁÝÁÌ ÓÔÒÏËÕ "WWW-Authenticate" × ÚÁÇÏÌÏ×ËÅ ÏÔ×ÅÔÁ, ÔÏ
+ × ÒÁÂÏÞÅÍ ÐÒÏÃÅÓÓÅ ÐÒÏÉÓÈÏÄÉÌ segmentation fault.
óÐÁÓÉÂÏ å×ÇÅÎÉÀ íÙÞÌÏ.
@@ -23,7 +443,7 @@
ÎÁ ÓÔÁÒÔÅ.
*) éÓÐÒÁ×ÌÅÎÉÅ: open_file_cache ÍÏÇ ËÜÛÉÒÏ×ÁÔØ ÏÔËÒÙÔÙÅ ÆÁÊÌÙ ÏÞÅÎØ
- ÄÏÌÇÏ.
+ ÄÏÌÇÏ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.4.
*) éÓÐÒÁ×ÌÅÎÉÅ: ÓÔÒÏËÉ "If-Modified-Since", "If-Range" É ÉÍ ÐÏÄÏÂÎÙÅ ×
ÚÁÇÏÌÏ×ËÅ ÚÁÐÒÏÓÁ ËÌÉÅÎÔÁ ÐÅÒÅÄÁ×ÁÌÉÓØ ÂÜËÅÎÄÕ ÐÒÉ ËÜÛÉÒÏ×ÁÎÉÉ, ÅÓÌÉ
@@ -1117,7 +1537,7 @@
*) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ×ÅÒÎÏ ÏÐÒÅÄÅÌÑÌ ÄÌÉÎÕ ÓÔÒÏËÉ ËÜÛÁ ÎÁ
Pentium 4.
- óÐÁÓÉÂÏ Gena Makhomed.
+ óÐÁÓÉÂÏ çÅÎÎÁÄÉÀ íÁÈÏÍÅÄÕ.
*) éÓÐÒÁ×ÌÅÎÉÅ: × ÐÒÏËÓÉÒÏ×ÁÎÎÙÈ ÐÏÄÚÁÐÒÏÓÁÈ É ÐÏÄÚÁÐÒÏÓÁÈ Ë
FastCGI-ÓÅÒ×ÅÒÕ ×ÍÅÓÔÏ ÍÅÔÏÄÁ GET ÉÓÐÏÌØÚÏ×ÁÌÓÑ ÏÒÉÇÉÎÁÌØÎÙÊ ÍÅÔÏÄ
@@ -1385,7 +1805,7 @@
óÐÁÓÉÂÏ áÎÄÒÅÀ îÉÇÍÁÔÕÌÉÎÕ.
*) éÓÐÒÁ×ÌÅÎÉÅ: ngx_http_memcached_module ÎÅ ÕÓÔÁÎÁ×ÌÉ×ÁÌ
- upstream_response_time.
+ $upstream_response_time.
óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
*) éÓÐÒÁ×ÌÅÎÉÅ: ÒÁÂÏÞÉÊ ÐÒÏÃÅÓÓ ÍÏÇ ÚÁÃÉËÌÉÔØÓÑ ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/LICENSE
^
|
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2009 Igor Sysoev
+ * Copyright (C) 2002-2010 Igor Sysoev
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/auto/cc/conf
^
|
@@ -104,6 +104,7 @@
fi
CFLAGS="$CFLAGS $NGX_CC_OPT"
+NGX_TEST_LD_OPT="$NGX_LD_OPT"
if [ "$NGX_PLATFORM" != win32 ]; then
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/auto/cc/gcc
^
|
@@ -51,8 +51,6 @@
#NGX_GCC_OPT="-Os"
NGX_GCC_OPT="-O"
-CFLAGS="$CFLAGS $NGX_GCC_OPT"
-
#CFLAGS="$CFLAGS -fomit-frame-pointer"
case $CPU in
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/auto/feature
^
|
@@ -39,7 +39,7 @@
ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS $ngx_feature_inc_path \
- -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
+ -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_TEST_LD_OPT $ngx_feature_libs"
ngx_feature_inc_path=
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/auto/install
^
|
@@ -101,8 +101,12 @@
cp conf/fastcgi_params \
'\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi_params.default'
+ test -f '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi.conf' \
+ || cp conf/fastcgi.conf '\$(DESTDIR)$NGX_CONF_PREFIX'
+ cp conf/fastcgi.conf '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi.conf.default'
+
test -f '\$(DESTDIR)$NGX_CONF_PATH' \
- || cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PREFIX'
+ || cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PATH'
cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PREFIX/nginx.conf.default'
test -d '\$(DESTDIR)`dirname "$NGX_PID_PATH"`' \
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/auto/lib/conf
^
|
@@ -67,6 +67,9 @@
. auto/lib/perl/conf
fi
+if [ $HTTP_GEOIP = YES ]; then
+ . auto/lib/geoip/conf
+fi
if [ $NGX_GOOGLE_PERFTOOLS = YES ]; then
. auto/lib/google-perftools/conf
fi
|
[-]
[+]
|
Added |
nginx-0.7.69.tar.bz2/auto/lib/geoip
^
|
+(directory)
|
[-]
[+]
|
Added |
nginx-0.7.69.tar.bz2/auto/lib/geoip/conf
^
|
@@ -0,0 +1,78 @@
+
+# Copyright (C) Igor Sysoev
+
+
+ ngx_feature="GeoIP library"
+ ngx_feature_name=
+ ngx_feature_run=no
+ ngx_feature_incs=
+ ngx_feature_path=
+ ngx_feature_libs="-lGeoIP"
+ ngx_feature_test="GeoIP_open(NULL, 0)"
+ . auto/feature
+
+
+if [ $ngx_found = no ]; then
+
+ # FreeBSD port
+
+ ngx_feature="GeoIP library in /usr/local/"
+
+ if [ $NGX_RPATH = YES ]; then
+ ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lGeoIP"
+ else
+ ngx_feature_libs="-L/usr/local/lib -lGeoIP"
+ fi
+
+ . auto/feature
+fi
+
+
+if [ $ngx_found = no ]; then
+
+ # NetBSD port
+
+ ngx_feature="GeoIP 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 -lGeoIP"
+ else
+ ngx_feature_libs="-L/usr/pkg/lib -lGeoIP"
+ fi
+
+ . auto/feature
+fi
+
+
+if [ $ngx_found = no ]; then
+
+ # MacPorts
+
+ ngx_feature="GeoIP 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 -lGeoIP"
+ else
+ ngx_feature_libs="-L/opt/local/lib -lGeoIP"
+ fi
+
+ . auto/feature
+fi
+
+
+if [ $ngx_found = yes ]; then
+ CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
+
+else
+
+cat << END
+
+$0: error: the GeoIP module requires the GeoIP library.
+You can either do not enable the module or install the library.
+
+END
+
+ exit 1
+fi
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/auto/lib/openssl/conf
^
|
@@ -19,16 +19,18 @@
# libeay32.lib requires gdi32.lib
CORE_LIBS="$CORE_LIBS gdi32.lib"
+ # OpenSSL 1.0.0 requires crypt32.lib
+ CORE_LIBS="$CORE_LIBS crypt32.lib"
;;
*)
have=NGX_OPENSSL . auto/have
have=NGX_SSL . auto/have
- CORE_INCS="$CORE_INCS $OPENSSL/openssl/include"
- CORE_DEPS="$CORE_DEPS $OPENSSL/openssl/include/openssl/ssl.h"
- CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/libssl.a"
- CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/libcrypto.a"
+ CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include"
+ CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h"
+ CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"
+ CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a"
CORE_LIBS="$CORE_LIBS $NGX_LIBDL"
;;
esac
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/auto/lib/openssl/make
^
|
@@ -46,18 +46,18 @@
esac
case $OPENSSL in
- /*) ngx_prefix="$OPENSSL/openssl" ;;
- *) ngx_prefix="$PWD/$OPENSSL/openssl" ;;
+ /*) ngx_prefix="$OPENSSL/.openssl" ;;
+ *) ngx_prefix="$PWD/$OPENSSL/.openssl" ;;
esac
cat << END >> $NGX_MAKEFILE
-$OPENSSL/openssl/include/openssl/ssl.h: $NGX_MAKEFILE
+$OPENSSL/.openssl/include/openssl/ssl.h: $NGX_MAKEFILE
cd $OPENSSL \\
&& \$(MAKE) clean \\
&& ./config --prefix=$ngx_prefix no-shared $OPENSSL_OPT \\
&& \$(MAKE) \\
- && \$(MAKE) install
+ && \$(MAKE) install LIBDIR=lib
END
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/auto/lib/openssl/makefile.bcc
^
|
@@ -5,8 +5,7 @@
all:
cd $(OPENSSL)
- perl Configure BC-32 no-shared --prefix=openssl -DNO_SYS_TYPES_H \
- $(OPENSSL_OPT)
+ perl Configure BC-32 no-shared --prefix=openssl $(OPENSSL_OPT)
ms\do_nasm
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/auto/lib/openssl/makefile.msvc
^
|
@@ -5,8 +5,7 @@
all:
cd $(OPENSSL)
- perl Configure VC-WIN32 no-shared --prefix=openssl -DNO_SYS_TYPES_H \
- $(OPENSSL_OPT)
+ perl Configure VC-WIN32 no-shared --prefix=openssl $(OPENSSL_OPT)
ms\do_ms
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/auto/lib/zlib/make
^
|
@@ -53,7 +53,7 @@
$ZLIB/libz.a: $NGX_MAKEFILE
cd $ZLIB \\
- && \$(MAKE) clean \\
+ && \$(MAKE) distclean \\
&& cp contrib/asm586/match.S . \\
&& CFLAGS="$ZLIB_OPT -DASMV" CC="\$(CC)" \\
./configure \\
@@ -70,7 +70,7 @@
$ZLIB/libz.a: $NGX_MAKEFILE
cd $ZLIB \\
- && \$(MAKE) clean \\
+ && \$(MAKE) distclean \\
&& cp contrib/asm686/match.S . \\
&& CFLAGS="$ZLIB_OPT -DASMV" CC="\$(CC)" \\
./configure \\
@@ -103,7 +103,7 @@
$ZLIB/libz.a: $NGX_MAKEFILE
cd $ZLIB \\
- && \$(MAKE) clean \\
+ && \$(MAKE) distclean \\
&& CFLAGS="$ZLIB_OPT" CC="\$(CC)" \\
./configure \\
&& \$(MAKE) libz.a
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/auto/modules
^
|
@@ -101,8 +101,8 @@
# ngx_http_range_header_filter
# ngx_http_gzip_filter
# ngx_http_postpone_filter
-# ngx_http_charset_filter
# ngx_http_ssi_filter
+# ngx_http_charset_filter
# ngx_http_xslt_filter
# ngx_http_image_filter_filter
# ngx_http_sub_filter
@@ -130,12 +130,6 @@
HTTP_SRCS="$HTTP_SRCS $HTTP_POSTPONE_FILTER_SRCS"
fi
-if [ $HTTP_CHARSET = YES ]; then
- have=NGX_HTTP_CHARSET . auto/have
- HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_CHARSET_FILTER_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_CHARSET_SRCS"
-fi
-
if [ $HTTP_SSI = YES ]; then
have=NGX_HTTP_SSI . auto/have
HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_SSI_FILTER_MODULE"
@@ -143,6 +137,12 @@
HTTP_SRCS="$HTTP_SRCS $HTTP_SSI_SRCS"
fi
+if [ $HTTP_CHARSET = YES ]; then
+ have=NGX_HTTP_CHARSET . auto/have
+ HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_CHARSET_FILTER_MODULE"
+ HTTP_SRCS="$HTTP_SRCS $HTTP_CHARSET_SRCS"
+fi
+
if [ $HTTP_XSLT = YES ]; then
USE_LIBXSLT=YES
HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_XSLT_FILTER_MODULE"
@@ -240,6 +240,12 @@
HTTP_SRCS="$HTTP_SRCS $HTTP_GEO_SRCS"
fi
+if [ $HTTP_GEOIP = YES ]; then
+ have=NGX_HTTP_GEOIP . auto/have
+ HTTP_MODULES="$HTTP_MODULES $HTTP_GEOIP_MODULE"
+ HTTP_SRCS="$HTTP_SRCS $HTTP_GEOIP_SRCS"
+fi
+
if [ $HTTP_MAP = YES ]; then
have=NGX_HTTP_MAP . auto/have
HTTP_MODULES="$HTTP_MODULES $HTTP_MAP_MODULE"
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/auto/options
^
|
@@ -71,6 +71,7 @@
HTTP_RANDOM_INDEX=NO
HTTP_STATUS=NO
HTTP_GEO=YES
+HTTP_GEOIP=NO
HTTP_MAP=YES
HTTP_REFERER=YES
HTTP_REWRITE=YES
@@ -184,6 +185,7 @@
--with-http_addition_module) HTTP_ADDITION=YES ;;
--with-http_xslt_module) HTTP_XSLT=YES ;;
--with-http_image_filter_module) HTTP_IMAGE_FILTER=YES ;;
+ --with-http_geoip_module) HTTP_GEOIP=YES ;;
--with-http_sub_module) HTTP_SUB=YES ;;
--with-http_dav_module) HTTP_DAV=YES ;;
--with-http_flv_module) HTTP_FLV=YES ;;
@@ -310,6 +312,7 @@
--with-http_addition_module enable ngx_http_addition_module
--with-http_xslt_module enable ngx_http_xslt_module
--with-http_image_filter_module enable ngx_http_image_filter_module
+ --with-http_geoip_module enable ngx_http_geoip_module
--with-http_sub_module enable ngx_http_sub_module
--with-http_dav_module enable ngx_http_dav_module
--with-http_flv_module enable ngx_http_flv_module
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/auto/os/linux
^
|
@@ -18,7 +18,7 @@
# Linux kernel version
version=$((`uname -r \
- | sed 's/^\([^.]*\)\.\([^.]*\)\.\([^.-]*\).*/\1*256*256+\2*256+\3/'`))
+ | sed 's/^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1*256*256+\2*256+\3/'`))
version=${version:-0}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/auto/sources
^
|
@@ -377,6 +377,10 @@
HTTP_GEO_SRCS=src/http/modules/ngx_http_geo_module.c
+HTTP_GEOIP_MODULE=ngx_http_geoip_module
+HTTP_GEOIP_SRCS=src/http/modules/ngx_http_geoip_module.c
+
+
HTTP_MAP_MODULE=ngx_http_map_module
HTTP_MAP_SRCS=src/http/modules/ngx_http_map_module.c
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/auto/unix
^
|
@@ -133,6 +133,16 @@
. auto/feature
+ngx_feature="sys_errlist[]"
+ngx_feature_name="NGX_HAVE_SYS_ERRLIST"
+ngx_feature_run=yes
+ngx_feature_incs="#include <stdio.h>"
+ngx_feature_path=
+ngx_feature_libs=
+ngx_feature_test="int n = sys_nerr; const char *p = sys_errlist[1];"
+. auto/feature
+
+
ngx_feature="localtime_r()"
ngx_feature_name="NGX_HAVE_LOCALTIME_R"
ngx_feature_run=no
|
[-]
[+]
|
Added |
nginx-0.7.69.tar.bz2/conf/fastcgi.conf
^
|
@@ -0,0 +1,24 @@
+
+fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+fastcgi_param QUERY_STRING $query_string;
+fastcgi_param REQUEST_METHOD $request_method;
+fastcgi_param CONTENT_TYPE $content_type;
+fastcgi_param CONTENT_LENGTH $content_length;
+
+fastcgi_param SCRIPT_NAME $fastcgi_script_name;
+fastcgi_param REQUEST_URI $request_uri;
+fastcgi_param DOCUMENT_URI $document_uri;
+fastcgi_param DOCUMENT_ROOT $document_root;
+fastcgi_param SERVER_PROTOCOL $server_protocol;
+
+fastcgi_param GATEWAY_INTERFACE CGI/1.1;
+fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
+
+fastcgi_param REMOTE_ADDR $remote_addr;
+fastcgi_param REMOTE_PORT $remote_port;
+fastcgi_param SERVER_ADDR $server_addr;
+fastcgi_param SERVER_PORT $server_port;
+fastcgi_param SERVER_NAME $server_name;
+
+# PHP only, required if PHP was built with --enable-force-cgi-redirect
+fastcgi_param REDIRECT_STATUS 200;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/core/nginx.c
^
|
@@ -239,6 +239,13 @@
#ifdef NGX_COMPILER
ngx_log_stderr(0, "built by " NGX_COMPILER);
#endif
+#if (NGX_SSL)
+#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
+ ngx_log_stderr(0, "TLS SNI support enabled");
+#else
+ ngx_log_stderr(0, "TLS SNI support disabled");
+#endif
+#endif
ngx_log_stderr(0, "configure arguments:" NGX_CONFIGURE);
}
@@ -373,6 +380,13 @@
}
}
+ if (log->file->fd != ngx_stderr) {
+ if (ngx_close_file(log->file->fd) == NGX_FILE_ERROR) {
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
+ ngx_close_file_n " built-in log failed");
+ }
+ }
+
ngx_use_stderr = 0;
if (ngx_process == NGX_PROCESS_SINGLE) {
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/core/nginx.h
^
|
@@ -8,8 +8,8 @@
#define _NGINX_H_INCLUDED_
-#define nginx_version 7061
-#define NGINX_VERSION "0.7.61"
+#define nginx_version 7069
+#define NGINX_VERSION "0.7.69"
#define NGINX_VER "nginx/" NGINX_VERSION
#define NGINX_VAR "NGINX"
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/core/ngx_buf.h
^
|
@@ -75,13 +75,13 @@
ngx_chain_t *free;
ngx_chain_t *busy;
- unsigned sendfile;
- unsigned directio;
+ unsigned sendfile:1;
+ unsigned directio:1;
#if (NGX_HAVE_ALIGNED_DIRECTIO)
- unsigned unaligned;
+ unsigned unaligned:1;
#endif
- unsigned need_in_memory;
- unsigned need_in_temp;
+ unsigned need_in_memory:1;
+ unsigned need_in_temp:1;
ngx_pool_t *pool;
ngx_int_t allocated;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/core/ngx_connection.c
^
|
@@ -917,12 +917,8 @@
level = NGX_LOG_INFO;
break;
- case NGX_ERROR_ERR:
- level = NGX_LOG_ERR;
- break;
-
default:
- level = NGX_LOG_ALERT;
+ level = NGX_LOG_ERR;
}
} else {
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/core/ngx_cycle.c
^
|
@@ -63,7 +63,7 @@
tp = ngx_timeofday();
tp->sec = 0;
- ngx_time_update(0, 0);
+ ngx_time_update();
log = old_cycle->log;
@@ -216,7 +216,7 @@
if (module->create_conf) {
rv = module->create_conf(cycle);
- if (rv == NGX_CONF_ERROR) {
+ if (rv == NULL) {
ngx_destroy_pool(pool);
return NULL;
}
@@ -255,11 +255,13 @@
#endif
if (ngx_conf_param(&conf) != NGX_CONF_OK) {
+ environ = senv;
ngx_destroy_cycle_pools(&conf);
return NULL;
}
if (ngx_conf_parse(&conf, &cycle->conf_file) != NGX_CONF_OK) {
+ environ = senv;
ngx_destroy_cycle_pools(&conf);
return NULL;
}
@@ -280,6 +282,7 @@
if (module->init_conf(cycle, cycle->conf_ctx[ngx_modules[i]->index])
== NGX_CONF_ERROR)
{
+ environ = senv;
ngx_destroy_cycle_pools(&conf);
return NULL;
}
@@ -698,8 +701,8 @@
if (ngx_process == NGX_PROCESS_MASTER || ngx_is_init_cycle(old_cycle)) {
/*
- * perl_destruct() frees environ if it is not the same as it was at
- * perl_construct() time. So we have saved an previous cycle
+ * perl_destruct() frees environ, if it is not the same as it was at
+ * perl_construct() time, therefore we save the previous cycle
* environment before ngx_conf_parse() where it will be changed.
*/
@@ -844,7 +847,7 @@
sin61 = (struct sockaddr_in6 *) sa1;
sin62 = (struct sockaddr_in6 *) sa2;
- if (sin61->sin6_port != sin61->sin6_port) {
+ if (sin61->sin6_port != sin62->sin6_port) {
return NGX_DECLINED;
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/core/ngx_file.c
^
|
@@ -8,8 +8,9 @@
#include <ngx_core.h>
-static ngx_atomic_uint_t ngx_temp_number;
-static ngx_atomic_uint_t ngx_random_number;
+static ngx_atomic_t temp_number = 0;
+ngx_atomic_t *ngx_temp_number = &temp_number;
+ngx_atomic_int_t ngx_random_number = 123456;
ssize_t
@@ -99,13 +100,7 @@
continue;
}
- if ((path->level[0] == 0)
- || (err != NGX_ENOENT
-#if (NGX_WIN32)
- && err != NGX_ENOTDIR
-#endif
- ))
- {
+ if ((path->level[0] == 0) || (err != NGX_ENOPATH)) {
ngx_log_error(NGX_LOG_CRIT, file->log, err,
ngx_open_tempfile_n " \"%s\" failed",
file->name.data);
@@ -188,7 +183,15 @@
u_char *p, ch;
ngx_err_t err;
- for (p = dir + 1; *p; p++) {
+ err = 0;
+
+#if (NGX_WIN32)
+ p = dir + 3;
+#else
+ p = dir + 1;
+#endif
+
+ for ( /* void */ ; *p; p++) {
ch = *p;
if (ch != '/') {
@@ -199,7 +202,14 @@
if (ngx_create_dir(dir, access) == NGX_FILE_ERROR) {
err = ngx_errno;
- if (err != NGX_EEXIST) {
+
+ switch (err) {
+ case NGX_EEXIST:
+ err = 0;
+ case NGX_EACCES:
+ break;
+
+ default:
return err;
}
}
@@ -207,26 +217,20 @@
*p = '/';
}
- return 0;
-}
-
-
-void
-ngx_init_temp_number(void)
-{
- ngx_temp_number = 0;
- ngx_random_number = 123456;
+ return err;
}
ngx_atomic_uint_t
ngx_next_temp_number(ngx_uint_t collision)
{
- if (collision) {
- ngx_temp_number += ngx_random_number;
- }
+ ngx_atomic_uint_t n, add;
+
+ add = collision ? ngx_random_number : 1;
- return ngx_temp_number++;
+ n = ngx_atomic_fetch_add(ngx_temp_number, add);
+
+ return n + add;
}
@@ -264,7 +268,8 @@
}
path->len = 0;
- path->manager = (ngx_path_manager_pt) cmd->post;
+ path->manager = NULL;
+ path->loader = NULL;
path->conf_file = cf->conf_file->file.name.data;
path->line = cf->conf_file->line;
@@ -325,6 +330,7 @@
+ init->level[2] + (init->level[2] ? 1 : 0);
(*path)->manager = NULL;
+ (*path)->loader = NULL;
(*path)->conf_file = NULL;
if (ngx_add_path(cf, path) != NGX_OK) {
@@ -528,7 +534,9 @@
ngx_int_t
ngx_ext_rename_file(ngx_str_t *src, ngx_str_t *to, ngx_ext_rename_file_t *ext)
{
- ngx_err_t err;
+ u_char *name;
+ ngx_err_t err;
+ ngx_copy_file_t cf;
#if !(NGX_WIN32)
@@ -558,14 +566,8 @@
err = ngx_errno;
- if (err
-#if (NGX_WIN32)
- == ERROR_PATH_NOT_FOUND
-#else
- == NGX_ENOENT
-#endif
- )
- {
+ if (err == NGX_ENOPATH) {
+
if (!ext->create_path) {
goto failed;
}
@@ -584,26 +586,66 @@
}
err = ngx_errno;
- goto failed;
}
#if (NGX_WIN32)
if (err == NGX_EEXIST) {
- if (ngx_win32_rename_file(src, to, ext->log) == NGX_OK) {
+ err = ngx_win32_rename_file(src, to, ext->log);
+
+ if (err == 0) {
+ return NGX_OK;
+ }
+ }
+
+#endif
+
+ if (err == NGX_EXDEV) {
+
+ cf.size = -1;
+ cf.buf_size = 0;
+ cf.access = ext->access;
+ cf.time = ext->time;
+ cf.log = ext->log;
+
+ name = ngx_alloc(to->len + 1 + 10 + 1, ext->log);
+ if (name == NULL) {
+ return NGX_ERROR;
+ }
+
+ (void) ngx_sprintf(name, "%*s.%010uD%Z", to->len, to->data,
+ (uint32_t) ngx_next_temp_number(0));
+
+ if (ngx_copy_file(src->data, name, &cf) == NGX_OK) {
+
+ if (ngx_rename_file(name, to->data) != NGX_FILE_ERROR) {
+ ngx_free(name);
+
+ if (ngx_delete_file(src->data) == NGX_FILE_ERROR) {
+ ngx_log_error(NGX_LOG_CRIT, ext->log, ngx_errno,
+ ngx_delete_file_n " \"%s\" failed",
+ src->data);
+ return NGX_ERROR;
+ }
- if (ngx_rename_file(src->data, to->data) != NGX_FILE_ERROR) {
return NGX_OK;
}
- err = ngx_errno;
+ ngx_log_error(NGX_LOG_CRIT, ext->log, ngx_errno,
+ ngx_rename_file_n " \"%s\" to \"%s\" failed",
+ name, to->data);
- } else {
- err = 0;
+ if (ngx_delete_file(name) == NGX_FILE_ERROR) {
+ ngx_log_error(NGX_LOG_CRIT, ext->log, ngx_errno,
+ ngx_delete_file_n " \"%s\" failed", name);
+
+ }
}
- }
-#endif
+ ngx_free(name);
+
+ err = 0;
+ }
failed:
@@ -614,18 +656,146 @@
}
}
- if (err && ext->log_rename_error) {
+ if (err) {
ngx_log_error(NGX_LOG_CRIT, ext->log, err,
ngx_rename_file_n " \"%s\" to \"%s\" failed",
src->data, to->data);
}
- ext->rename_error = err;
-
return NGX_ERROR;
}
+ngx_int_t
+ngx_copy_file(u_char *from, u_char *to, ngx_copy_file_t *cf)
+{
+ char *buf;
+ off_t size;
+ size_t len;
+ ssize_t n;
+ ngx_fd_t fd, nfd;
+ ngx_int_t rc;
+ ngx_file_info_t fi;
+
+ rc = NGX_ERROR;
+ buf = NULL;
+ nfd = NGX_INVALID_FILE;
+
+ fd = ngx_open_file(from, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
+
+ if (fd == NGX_INVALID_FILE) {
+ ngx_log_error(NGX_LOG_CRIT, cf->log, ngx_errno,
+ ngx_open_file_n " \"%s\" failed", from);
+ goto failed;
+ }
+
+ if (cf->size != -1) {
+ size = cf->size;
+
+ } else {
+ if (ngx_fd_info(fd, &fi) == NGX_FILE_ERROR) {
+ ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
+ ngx_fd_info_n " \"%s\" failed", from);
+
+ goto failed;
+ }
+
+ size = ngx_file_size(&fi);
+ }
+
+ len = cf->buf_size ? cf->buf_size : 65536;
+
+ if ((off_t) len > size) {
+ len = (size_t) size;
+ }
+
+ buf = ngx_alloc(len, cf->log);
+ if (buf == NULL) {
+ goto failed;
+ }
+
+ nfd = ngx_open_file(to, NGX_FILE_WRONLY, NGX_FILE_CREATE_OR_OPEN,
+ cf->access);
+
+ if (nfd == NGX_INVALID_FILE) {
+ ngx_log_error(NGX_LOG_CRIT, cf->log, ngx_errno,
+ ngx_open_file_n " \"%s\" failed", to);
+ goto failed;
+ }
+
+ while (size > 0) {
+
+ if ((off_t) len > size) {
+ len = (size_t) size;
+ }
+
+ n = ngx_read_fd(fd, buf, len);
+
+ if (n == NGX_FILE_ERROR) {
+ ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
+ ngx_read_fd_n " \"%s\" failed", from);
+ goto failed;
+ }
+
+ if ((size_t) n != len) {
+ ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
+ ngx_read_fd_n " has read only %z of %uz from %s",
+ n, size, from);
+ goto failed;
+ }
+
+ n = ngx_write_fd(nfd, buf, len);
+
+ if (n == NGX_FILE_ERROR) {
+ ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
+ ngx_write_fd_n " \"%s\" failed", to);
+ goto failed;
+ }
+
+ if ((size_t) n != len) {
+ ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
+ ngx_write_fd_n " has written only %z of %uz to %s",
+ n, size, to);
+ goto failed;
+ }
+
+ size -= n;
+ }
+
+ if (cf->time != -1) {
+ if (ngx_set_file_time(to, nfd, cf->time) != NGX_OK) {
+ ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
+ ngx_set_file_time_n " \"%s\" failed", to);
+ goto failed;
+ }
+ }
+
+ rc = NGX_OK;
+
+failed:
+
+ if (nfd != NGX_INVALID_FILE) {
+ if (ngx_close_file(nfd) == NGX_FILE_ERROR) {
+ ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
+ ngx_close_file_n " \"%s\" failed", to);
+ }
+ }
+
+ if (fd != NGX_INVALID_FILE) {
+ if (ngx_close_file(fd) == NGX_FILE_ERROR) {
+ ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
+ ngx_close_file_n " \"%s\" failed", from);
+ }
+ }
+
+ if (buf) {
+ ngx_free(buf);
+ }
+
+ return rc;
+}
+
+
/*
* ctx->init_handler() - see ctx->alloc
* ctx->file_handler() - file handler
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/core/ngx_file.h
^
|
@@ -30,6 +30,7 @@
typedef time_t (*ngx_path_manager_pt) (void *data);
+typedef void (*ngx_path_loader_pt) (void *data);
typedef struct {
@@ -38,6 +39,7 @@
size_t level[3];
ngx_path_manager_pt manager;
+ ngx_path_loader_pt loader;
void *data;
u_char *conf_file;
@@ -71,16 +73,25 @@
ngx_uint_t path_access;
time_t time;
ngx_fd_t fd;
- ngx_err_t rename_error;
unsigned create_path:1;
unsigned delete_file:1;
- unsigned log_rename_error:1;
ngx_log_t *log;
} ngx_ext_rename_file_t;
+typedef struct {
+ off_t size;
+ size_t buf_size;
+
+ ngx_uint_t access;
+ time_t time;
+
+ ngx_log_t *log;
+} ngx_copy_file_t;
+
+
typedef struct ngx_tree_ctx_s ngx_tree_ctx_t;
typedef ngx_int_t (*ngx_tree_init_handler_pt) (void *ctx, void *prev);
@@ -115,9 +126,9 @@
ngx_int_t ngx_create_pathes(ngx_cycle_t *cycle, ngx_uid_t user);
ngx_int_t ngx_ext_rename_file(ngx_str_t *src, ngx_str_t *to,
ngx_ext_rename_file_t *ext);
+ngx_int_t ngx_copy_file(u_char *from, u_char *to, ngx_copy_file_t *cf);
ngx_int_t ngx_walk_tree(ngx_tree_ctx_t *ctx, ngx_str_t *tree);
-void ngx_init_temp_number(void);
ngx_atomic_uint_t ngx_next_temp_number(ngx_uint_t collision);
char *ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
@@ -126,4 +137,8 @@
char *ngx_conf_set_access_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
+extern ngx_atomic_t *ngx_temp_number;
+extern ngx_atomic_int_t ngx_random_number;
+
+
#endif /* _NGX_FILE_H_INCLUDED_ */
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/core/ngx_hash.c
^
|
@@ -534,7 +534,7 @@
next_name->key.len = names[n].key.len - len;
next_name->key.data = names[n].key.data + len;
- next_name->key_hash= 0;
+ next_name->key_hash = 0;
next_name->value = names[n].value;
#if 0
@@ -562,7 +562,7 @@
next_name->key.len = names[i].key.len - dot_len;
next_name->key.data = names[i].key.data + dot_len;
- next_name->key_hash= 0;
+ next_name->key_hash = 0;
next_name->value = names[i].value;
#if 0
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/core/ngx_open_file_cache.c
^
|
@@ -487,7 +487,14 @@
}
if (!of->log) {
- fd = ngx_open_file(name, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
+
+ /*
+ * Use non-blocking open() not to hang on FIFO files, etc.
+ * This flag has no effect on a regular files.
+ */
+
+ fd = ngx_open_file(name, NGX_FILE_RDONLY|NGX_FILE_NONBLOCK,
+ NGX_FILE_OPEN, 0);
} else {
fd = ngx_open_file(name, NGX_FILE_APPEND, NGX_FILE_CREATE_OR_OPEN,
@@ -525,7 +532,7 @@
of->fd = fd;
if (of->directio <= ngx_file_size(&fi)) {
- if (ngx_directio_on(fd) == -1) {
+ if (ngx_directio_on(fd) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
ngx_directio_on_n " \"%s\" failed", name);
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/core/ngx_output_chain.c
^
|
@@ -314,12 +314,11 @@
#endif
+ cl->next = NULL;
*ll = cl;
ll = &cl->next;
}
- *ll = NULL;
-
return NGX_OK;
}
@@ -511,7 +510,7 @@
#if (NGX_HAVE_ALIGNED_DIRECTIO)
if (ctx->unaligned) {
- if (ngx_directio_off(src->file->fd) == -1) {
+ if (ngx_directio_off(src->file->fd) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, ngx_errno,
ngx_directio_off_n " \"%s\" failed",
src->file->name.data);
@@ -529,7 +528,7 @@
err = ngx_errno;
- if (ngx_directio_on(src->file->fd) == -1) {
+ if (ngx_directio_on(src->file->fd) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, ngx_errno,
ngx_directio_on_n " \"%s\" failed",
src->file->name.data);
@@ -556,9 +555,7 @@
ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0,
ngx_read_file_n " read only %z of %O from \"%s\"",
n, size, src->file->name.data);
- if (n == 0) {
- return NGX_ERROR;
- }
+ return NGX_ERROR;
}
dst->last += n;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/core/ngx_resolver.c
^
|
@@ -464,6 +464,7 @@
ctx->next = rn->waiting;
rn->waiting = ctx;
+ ctx->state = NGX_AGAIN;
return NGX_AGAIN;
}
@@ -625,6 +626,7 @@
ctx->next = rn->waiting;
rn->waiting = ctx;
+ ctx->state = NGX_AGAIN;
/* unlock addr mutex */
@@ -1149,6 +1151,8 @@
goto failed;
}
+ ngx_resolver_free(r, name.data);
+
if (code == 0 && nan == 0) {
code = 3; /* NXDOMAIN */
}
@@ -1400,6 +1404,8 @@
/* unlock name mutex */
+ ngx_resolver_free(r, name.data);
+
return;
}
@@ -1595,7 +1601,6 @@
ngx_resolver_lookup_name(ngx_resolver_t *r, ngx_str_t *name, uint32_t hash)
{
ngx_int_t rc;
- size_t len;
ngx_rbtree_node_t *node, *sentinel;
ngx_resolver_node_t *rn;
@@ -1619,9 +1624,7 @@
do {
rn = (ngx_resolver_node_t *) node;
- len = (name->len > (size_t) rn->nlen) ? rn->nlen : name->len;
-
- rc = ngx_strncmp(name->data, rn->name, len);
+ rc = ngx_memn2cmp(name->data, rn->name, name->len, rn->nlen);
if (rc == 0) {
return rn;
@@ -1675,7 +1678,6 @@
ngx_resolver_rbtree_insert_value(ngx_rbtree_node_t *temp,
ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel)
{
- size_t len;
ngx_rbtree_node_t **p;
ngx_resolver_node_t *rn, *rn_temp;
@@ -1694,10 +1696,8 @@
rn = (ngx_resolver_node_t *) node;
rn_temp = (ngx_resolver_node_t *) temp;
- len = (rn->nlen > rn_temp->nlen) ? rn_temp->nlen : rn->nlen;
-
- p = (ngx_strncmp(rn->name, rn_temp->name, len) < 0)
- ? &temp->left : &temp->right;
+ p = (ngx_memn2cmp(rn->name, rn_temp->name, rn->nlen, rn_temp->nlen)
+ < 0) ? &temp->left : &temp->right;
}
if (*p == sentinel) {
@@ -1719,15 +1719,16 @@
ngx_resolver_create_name_query(ngx_resolver_node_t *rn, ngx_resolver_ctx_t *ctx)
{
u_char *p, *s;
- size_t len;
+ size_t len, nlen;
ngx_uint_t ident;
ngx_resolver_qs_t *qs;
ngx_resolver_query_t *query;
- len = sizeof(ngx_resolver_query_t)
- + 1 + ctx->name.len + 1 + sizeof(ngx_resolver_qs_t);
+ nlen = ctx->name.len ? (1 + ctx->name.len + 1) : 1;
+
+ len = sizeof(ngx_resolver_query_t) + nlen + sizeof(ngx_resolver_qs_t);
- p = ngx_resolver_calloc(ctx->resolver, len);
+ p = ngx_resolver_alloc(ctx->resolver, len);
if (p == NULL) {
return NGX_ERROR;
}
@@ -1754,7 +1755,7 @@
query->nns_hi = 0; query->nns_lo = 0;
query->nar_hi = 0; query->nar_lo = 0;
- p += sizeof(ngx_resolver_query_t) + 1 + ctx->name.len + 1;
+ p += sizeof(ngx_resolver_query_t) + nlen;
qs = (ngx_resolver_qs_t *) p;
@@ -1808,7 +1809,7 @@
+ sizeof(".255.255.255.255.in-addr.arpa.") - 1
+ sizeof(ngx_resolver_qs_t);
- p = ngx_resolver_calloc(ctx->resolver, len);
+ p = ngx_resolver_alloc(ctx->resolver, len);
if (p == NULL) {
return NGX_ERROR;
}
@@ -1902,6 +1903,12 @@
return NGX_OK;
}
+ if (len == -1) {
+ name->len = 0;
+ name->data = NULL;
+ return NGX_OK;
+ }
+
dst = ngx_resolver_alloc(r, len);
if (dst == NULL) {
return NGX_ERROR;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/core/ngx_string.c
^
|
@@ -30,12 +30,15 @@
return dst;
}
- for ( /* void */ ; --n; dst++, src++) {
+ while (--n) {
*dst = *src;
if (*dst == '\0') {
return dst;
}
+
+ dst++;
+ src++;
}
*dst = '\0';
@@ -87,7 +90,7 @@
*
* reserved:
* %t ptrdiff_t
- * %S null-teminated wchar string
+ * %S null-terminated wchar string
* %C wchar
*/
@@ -565,8 +568,8 @@
c1 = (ngx_uint_t) *s1++;
c2 = (ngx_uint_t) *s2++;
- c1 = (c1 >= 'A' && c1 <= 'Z') ? (c1 | 0x20) : c1;
- c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2;
+ c1 = (c1 >= 'A' && c1 <= 'Z') ? (c1 | 0x20) : c1;
+ c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2;
if (c1 == c2) {
@@ -591,8 +594,8 @@
c1 = (ngx_uint_t) *s1++;
c2 = (ngx_uint_t) *s2++;
- c1 = (c1 >= 'A' && c1 <= 'Z') ? (c1 | 0x20) : c1;
- c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2;
+ c1 = (c1 >= 'A' && c1 <= 'Z') ? (c1 | 0x20) : c1;
+ c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2;
if (c1 == c2) {
@@ -680,7 +683,7 @@
ngx_uint_t c1, c2;
c2 = (ngx_uint_t) *s2++;
- c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2;
+ c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2;
do {
do {
@@ -690,7 +693,7 @@
return NULL;
}
- c1 = (c1 >= 'A' && c1 <= 'Z') ? (c1 | 0x20) : c1;
+ c1 = (c1 >= 'A' && c1 <= 'Z') ? (c1 | 0x20) : c1;
} while (c1 != c2);
@@ -712,7 +715,7 @@
ngx_uint_t c1, c2;
c2 = (ngx_uint_t) *s2++;
- c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2;
+ c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2;
last -= n;
do {
@@ -723,7 +726,7 @@
c1 = (ngx_uint_t) *s1++;
- c1 = (c1 >= 'A' && c1 <= 'Z') ? (c1 | 0x20) : c1;
+ c1 = (c1 >= 'A' && c1 <= 'Z') ? (c1 | 0x20) : c1;
} while (c1 != c2);
@@ -817,6 +820,37 @@
ngx_int_t
+ngx_dns_strcmp(u_char *s1, u_char *s2)
+{
+ ngx_uint_t c1, c2;
+
+ for ( ;; ) {
+ c1 = (ngx_uint_t) *s1++;
+ c2 = (ngx_uint_t) *s2++;
+
+ c1 = (c1 >= 'A' && c1 <= 'Z') ? (c1 | 0x20) : c1;
+ c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2;
+
+ if (c1 == c2) {
+
+ if (c1) {
+ continue;
+ }
+
+ return 0;
+ }
+
+ /* in ASCII '.' > '-', but we need '.' to be the lowest character */
+
+ c1 = (c1 == '.') ? ' ' : c1;
+ c2 = (c2 == '.') ? ' ' : c2;
+
+ return c1 - c2;
+ }
+}
+
+
+ngx_int_t
ngx_atoi(u_char *line, size_t n)
{
ngx_int_t value;
@@ -1204,10 +1238,8 @@
break;
}
- len--;
-
while (src < next) {
- *++dst = *++src;
+ *dst++ = *src++;
len--;
}
}
@@ -1245,13 +1277,13 @@
0xffffffff /* 1111 1111 1111 1111 1111 1111 1111 1111 */
};
- /* " ", "#", "%", "+", "?", %00-%1F, %7F-%FF */
+ /* " ", "#", "%", "&", "+", "?", %00-%1F, %7F-%FF */
static uint32_t args[] = {
0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */
/* ?>=< ;:98 7654 3210 /.-, +*)( '&%$ #"! */
- 0x80000829, /* 1000 0000 0000 0000 0000 1000 0010 1001 */
+ 0x80000869, /* 1000 0000 0000 0000 0000 1000 0110 1001 */
/* _^]\ [ZYX WVUT SRQP ONML KJIH GFED CBA@ */
0x00000000, /* 0000 0000 0000 0000 0000 0000 0000 0000 */
@@ -1337,7 +1369,7 @@
/* find the number of the characters to be escaped */
- n = 0;
+ n = 0;
for (i = 0; i < size; i++) {
if (escape[*src >> 5] & (1 << (*src & 0x1f))) {
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/core/ngx_string.h
^
|
@@ -158,6 +158,7 @@
ngx_int_t ngx_rstrncmp(u_char *s1, u_char *s2, size_t n);
ngx_int_t ngx_rstrncasecmp(u_char *s1, u_char *s2, size_t n);
ngx_int_t ngx_memn2cmp(u_char *s1, u_char *s2, size_t n1, size_t n2);
+ngx_int_t ngx_dns_strcmp(u_char *s1, u_char *s2);
ngx_int_t ngx_atoi(u_char *line, size_t n);
ssize_t ngx_atosz(u_char *line, size_t n);
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/core/ngx_times.c
^
|
@@ -28,6 +28,17 @@
volatile ngx_str_t ngx_cached_http_time;
volatile ngx_str_t ngx_cached_http_log_time;
+#if !(NGX_WIN32)
+
+/*
+ * locatime() and localtime_r() are not Async-Signal-Safe functions, therefore,
+ * they must not be called by a signal handler, so we use the cached
+ * GMT offset value. Fortunately the value is changed only two times a year.
+ */
+
+static ngx_int_t cached_gmtoff;
+#endif
+
static ngx_time_t cached_time[NGX_TIME_SLOTS];
static u_char cached_err_log_time[NGX_TIME_SLOTS]
[sizeof("1970/09/28 12:00:00")];
@@ -50,15 +61,17 @@
ngx_cached_time = &cached_time[0];
- ngx_time_update(0, 0);
+ ngx_time_update();
}
void
-ngx_time_update(time_t sec, ngx_uint_t msec)
+ngx_time_update(void)
{
u_char *p0, *p1, *p2;
ngx_tm_t tm, gmt;
+ time_t sec;
+ ngx_uint_t msec;
ngx_time_t *tp;
struct timeval tv;
@@ -66,12 +79,10 @@
return;
}
- if (sec == 0) {
- ngx_gettimeofday(&tv);
+ ngx_gettimeofday(&tv);
- sec = tv.tv_sec;
- msec = tv.tv_usec / 1000;
- }
+ sec = tv.tv_sec;
+ msec = tv.tv_usec / 1000;
ngx_current_msec = (ngx_msec_t) sec * 1000 + msec;
@@ -112,12 +123,14 @@
#elif (NGX_HAVE_GMTOFF)
ngx_localtime(sec, &tm);
- tp->gmtoff = (ngx_int_t) (tm.ngx_tm_gmtoff / 60);
+ cached_gmtoff = (ngx_int_t) (tm.ngx_tm_gmtoff / 60);
+ tp->gmtoff = cached_gmtoff;
#else
ngx_localtime(sec, &tm);
- tp->gmtoff = ngx_timezone(tm.ngx_tm_isdst);
+ cached_gmtoff = ngx_timezone(tm.ngx_tm_isdst);
+ tp->gmtoff = cached_gmtoff;
#endif
@@ -151,6 +164,57 @@
}
+#if !(NGX_WIN32)
+
+void
+ngx_time_sigsafe_update(void)
+{
+ u_char *p;
+ ngx_tm_t tm;
+ time_t sec;
+ ngx_time_t *tp;
+ struct timeval tv;
+
+ if (!ngx_trylock(&ngx_time_lock)) {
+ return;
+ }
+
+ ngx_gettimeofday(&tv);
+
+ sec = tv.tv_sec;
+
+ tp = &cached_time[slot];
+
+ if (tp->sec == sec) {
+ ngx_unlock(&ngx_time_lock);
+ return;
+ }
+
+ if (slot == NGX_TIME_SLOTS - 1) {
+ slot = 0;
+ } else {
+ slot++;
+ }
+
+ ngx_gmtime(sec + cached_gmtoff * 60, &tm);
+
+ p = &cached_err_log_time[slot][0];
+
+ (void) ngx_sprintf(p, "%4d/%02d/%02d %02d:%02d:%02d",
+ tm.ngx_tm_year, tm.ngx_tm_mon,
+ tm.ngx_tm_mday, tm.ngx_tm_hour,
+ tm.ngx_tm_min, tm.ngx_tm_sec);
+
+ ngx_memory_barrier();
+
+ ngx_cached_err_log_time.data = p;
+
+ ngx_unlock(&ngx_time_lock);
+}
+
+#endif
+
+
u_char *
ngx_http_time(u_char *buf, time_t t)
{
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/core/ngx_times.h
^
|
@@ -20,7 +20,8 @@
void ngx_time_init(void);
-void ngx_time_update(time_t sec, ngx_uint_t msec);
+void ngx_time_update(void);
+void ngx_time_sigsafe_update(void);
u_char *ngx_http_time(u_char *buf, time_t t);
u_char *ngx_http_cookie_time(u_char *buf, time_t t);
void ngx_gmtime(time_t t, ngx_tm_t *tp);
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/event/modules/ngx_devpoll_module.c
^
|
@@ -375,8 +375,8 @@
err = 0;
}
- if (flags & NGX_UPDATE_TIME) {
- ngx_time_update(0, 0);
+ if (flags & NGX_UPDATE_TIME || ngx_event_timer_alarm) {
+ ngx_time_update();
}
if (err) {
@@ -550,7 +550,7 @@
dpcf = ngx_palloc(cycle->pool, sizeof(ngx_devpoll_conf_t));
if (dpcf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
dpcf->changes = NGX_CONF_UNSET;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/event/modules/ngx_epoll_module.c
^
|
@@ -407,8 +407,8 @@
err = 0;
}
- if (flags & NGX_UPDATE_TIME) {
- ngx_time_update(0, 0);
+ if (flags & NGX_UPDATE_TIME || ngx_event_timer_alarm) {
+ ngx_time_update();
}
if (err) {
@@ -552,7 +552,7 @@
epcf = ngx_palloc(cycle->pool, sizeof(ngx_epoll_conf_t));
if (epcf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
epcf->events = NGX_CONF_UNSET;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/event/modules/ngx_eventport_module.c
^
|
@@ -405,7 +405,7 @@
err = ngx_errno;
if (flags & NGX_UPDATE_TIME) {
- ngx_time_update(0, 0);
+ ngx_time_update();
}
if (n == -1) {
@@ -439,7 +439,7 @@
for (i = 0; i < events; i++) {
if (event_list[i].portev_source == PORT_SOURCE_TIMER) {
- ngx_time_update(0, 0);
+ ngx_time_update();
continue;
}
@@ -581,7 +581,7 @@
epcf = ngx_palloc(cycle->pool, sizeof(ngx_eventport_conf_t));
if (epcf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
epcf->events = NGX_CONF_UNSET;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/event/modules/ngx_kqueue_module.c
^
|
@@ -543,8 +543,8 @@
err = 0;
}
- if (flags & NGX_UPDATE_TIME) {
- ngx_time_update(0, 0);
+ if (flags & NGX_UPDATE_TIME || ngx_event_timer_alarm) {
+ ngx_time_update();
}
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
@@ -595,7 +595,7 @@
#if (NGX_HAVE_TIMER_EVENT)
if (event_list[i].filter == EVFILT_TIMER) {
- ngx_time_update(0, 0);
+ ngx_time_update();
continue;
}
@@ -768,7 +768,7 @@
kcf = ngx_palloc(cycle->pool, sizeof(ngx_kqueue_conf_t));
if (kcf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
kcf->changes = NGX_CONF_UNSET;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/event/modules/ngx_poll_module.c
^
|
@@ -266,8 +266,8 @@
err = 0;
}
- if (flags & NGX_UPDATE_TIME) {
- ngx_time_update(0, 0);
+ if (flags & NGX_UPDATE_TIME || ngx_event_timer_alarm) {
+ ngx_time_update();
}
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/event/modules/ngx_rtsig_module.c
^
|
@@ -323,7 +323,7 @@
"rtsig signo:%d", signo);
if (flags & NGX_UPDATE_TIME) {
- ngx_time_update(0, 0);
+ ngx_time_update();
}
if (err == NGX_EAGAIN) {
@@ -349,7 +349,7 @@
signo, si.si_fd, si.si_band);
if (flags & NGX_UPDATE_TIME) {
- ngx_time_update(0, 0);
+ ngx_time_update();
}
rtscf = ngx_event_get_conf(ngx_cycle->conf_ctx, ngx_rtsig_module);
@@ -419,7 +419,7 @@
} else if (signo == SIGALRM) {
- ngx_time_update(0, 0);
+ ngx_time_update();
return NGX_OK;
@@ -671,7 +671,7 @@
}
if (flags & NGX_UPDATE_TIME) {
- ngx_time_update(0, 0);
+ ngx_time_update();
}
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
@@ -691,7 +691,7 @@
rtscf = ngx_palloc(cycle->pool, sizeof(ngx_rtsig_conf_t));
if (rtscf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
rtscf->signo = NGX_CONF_UNSET;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/event/modules/ngx_select_module.c
^
|
@@ -266,8 +266,8 @@
err = 0;
}
- if (flags & NGX_UPDATE_TIME) {
- ngx_time_update(0, 0);
+ if (flags & NGX_UPDATE_TIME || ngx_event_timer_alarm) {
+ ngx_time_update();
}
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/event/modules/ngx_win32_select_module.c
^
|
@@ -273,7 +273,7 @@
}
if (flags & NGX_UPDATE_TIME) {
- ngx_time_update(0, 0);
+ ngx_time_update();
}
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/event/ngx_event.c
^
|
@@ -43,7 +43,7 @@
ngx_event_actions_t ngx_event_actions;
-ngx_atomic_t connection_counter = 1;
+static ngx_atomic_t connection_counter = 1;
ngx_atomic_t *ngx_connection_counter = &connection_counter;
@@ -429,6 +429,7 @@
u_char *shared;
size_t size, cl;
ngx_shm_t shm;
+ ngx_time_t *tp;
ngx_core_conf_t *ccf;
ngx_event_conf_t *ecf;
@@ -492,7 +493,8 @@
cl = 128;
size = cl /* ngx_accept_mutex */
- + cl; /* ngx_connection_counter */
+ + cl /* ngx_connection_counter */
+ + cl; /* ngx_temp_number */
#if (NGX_STAT_STUB)
@@ -526,23 +528,29 @@
ngx_connection_counter = (ngx_atomic_t *) (shared + 1 * cl);
-#if (NGX_STAT_STUB)
-
- ngx_stat_accepted = (ngx_atomic_t *) (shared + 2 * cl);
- ngx_stat_handled = (ngx_atomic_t *) (shared + 3 * cl);
- ngx_stat_requests = (ngx_atomic_t *) (shared + 4 * cl);
- ngx_stat_active = (ngx_atomic_t *) (shared + 5 * cl);
- ngx_stat_reading = (ngx_atomic_t *) (shared + 6 * cl);
- ngx_stat_writing = (ngx_atomic_t *) (shared + 7 * cl);
-
-#endif
-
(void) ngx_atomic_cmp_set(ngx_connection_counter, 0, 1);
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"counter: %p, %d",
ngx_connection_counter, *ngx_connection_counter);
+ ngx_temp_number = (ngx_atomic_t *) (shared + 2 * cl);
+
+ tp = ngx_timeofday();
+
+ ngx_random_number = (tp->msec << 16) + ngx_pid;
+
+#if (NGX_STAT_STUB)
+
+ ngx_stat_accepted = (ngx_atomic_t *) (shared + 3 * cl);
+ ngx_stat_handled = (ngx_atomic_t *) (shared + 4 * cl);
+ ngx_stat_requests = (ngx_atomic_t *) (shared + 5 * cl);
+ ngx_stat_active = (ngx_atomic_t *) (shared + 6 * cl);
+ ngx_stat_reading = (ngx_atomic_t *) (shared + 7 * cl);
+ ngx_stat_writing = (ngx_atomic_t *) (shared + 8 * cl);
+
+#endif
+
return NGX_OK;
}
@@ -554,8 +562,6 @@
{
ngx_event_timer_alarm = 1;
- ngx_time_update(0, 0);
-
#if 1
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, ngx_cycle->log, 0, "timer signal");
#endif
@@ -1113,7 +1119,7 @@
ecf = ngx_palloc(cycle->pool, sizeof(ngx_event_conf_t));
if (ecf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
ecf->connections = NGX_CONF_UNSET_UINT;
@@ -1128,7 +1134,7 @@
if (ngx_array_init(&ecf->debug_connection, cycle->pool, 4,
sizeof(ngx_event_debug_t)) == NGX_ERROR)
{
- return NGX_CONF_ERROR;
+ return NULL;
}
#endif
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/event/ngx_event_openssl.c
^
|
@@ -15,6 +15,8 @@
static int ngx_http_ssl_verify_callback(int ok, X509_STORE_CTX *x509_store);
+static void ngx_ssl_info_callback(const ngx_ssl_conn_t *ssl_conn, int where,
+ int ret);
static void ngx_ssl_handshake_handler(ngx_event_t *ev);
static ngx_int_t ngx_ssl_handle_recv(ngx_connection_t *c, int n);
static void ngx_ssl_write_handler(ngx_event_t *wev);
@@ -97,16 +99,14 @@
ngx_int_t
ngx_ssl_init(ngx_log_t *log)
{
-#if OPENSSL_VERSION_NUMBER >= 0x00907000
OPENSSL_config(NULL);
-#endif
SSL_library_init();
SSL_load_error_strings();
-#if (NGX_SSL_ENGINE)
ENGINE_load_builtin_engines();
-#endif
+
+ OpenSSL_add_all_algorithms();
ngx_ssl_connection_index = SSL_get_ex_new_index(0, NULL, NULL, NULL, NULL);
@@ -169,9 +169,7 @@
SSL_CTX_set_options(ssl->ctx, SSL_OP_TLS_D5_BUG);
SSL_CTX_set_options(ssl->ctx, SSL_OP_TLS_BLOCK_PADDING_BUG);
-#ifdef SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS
SSL_CTX_set_options(ssl->ctx, SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS);
-#endif
SSL_CTX_set_options(ssl->ctx, SSL_OP_SINGLE_DH_USE);
@@ -181,6 +179,8 @@
SSL_CTX_set_read_ahead(ssl->ctx, 1);
+ SSL_CTX_set_info_callback(ssl->ctx, ngx_ssl_info_callback);
+
return NGX_OK;
}
@@ -267,6 +267,51 @@
}
+ngx_int_t
+ngx_ssl_crl(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *crl)
+{
+ X509_STORE *store;
+ X509_LOOKUP *lookup;
+
+ if (crl->len == 0) {
+ return NGX_OK;
+ }
+
+ if (ngx_conf_full_name(cf->cycle, crl, 1) != NGX_OK) {
+ return NGX_ERROR;
+ }
+
+ store = SSL_CTX_get_cert_store(ssl->ctx);
+
+ if (store == NULL) {
+ ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
+ "SSL_CTX_get_cert_store() failed");
+ return NGX_ERROR;
+ }
+
+ lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
+
+ if (lookup == NULL) {
+ ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
+ "X509_STORE_add_lookup() failed");
+ return NGX_ERROR;
+ }
+
+ if (X509_LOOKUP_load_file(lookup, (char *) crl->data, X509_FILETYPE_PEM)
+ == 0)
+ {
+ ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
+ "X509_LOOKUP_load_file(\"%s\") failed", crl->data);
+ return NGX_ERROR;
+ }
+
+ X509_STORE_set_flags(store,
+ X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL);
+
+ return NGX_OK;
+}
+
+
static int
ngx_http_ssl_verify_callback(int ok, X509_STORE_CTX *x509_store)
{
@@ -311,6 +356,22 @@
}
+static void
+ngx_ssl_info_callback(const ngx_ssl_conn_t *ssl_conn, int where, int ret)
+{
+ ngx_connection_t *c;
+
+ if (where & SSL_CB_HANDSHAKE_START) {
+ c = ngx_ssl_get_connection((ngx_ssl_conn_t *) ssl_conn);
+
+ if (c->ssl->handshaked) {
+ c->ssl->renegotiation = 1;
+ ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, "SSL renegotiation");
+ }
+ }
+}
+
+
ngx_int_t
ngx_ssl_generate_rsa512_key(ngx_ssl_t *ssl)
{
@@ -500,6 +561,9 @@
#if (NGX_DEBUG)
{
char buf[129], *s, *d;
+#if OPENSSL_VERSION_NUMBER >= 0x1000000fL
+ const
+#endif
SSL_CIPHER *cipher;
cipher = SSL_get_current_cipher(c->ssl->connection);
@@ -548,6 +612,11 @@
c->recv_chain = ngx_ssl_recv_chain;
c->send_chain = ngx_ssl_send_chain;
+ /* initial handshake done, disable renegotiation (CVE-2009-3555) */
+ if (c->ssl->connection->s3) {
+ c->ssl->connection->s3->flags |= SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS;
+ }
+
return NGX_OK;
}
@@ -750,6 +819,21 @@
int sslerr;
ngx_err_t err;
+ if (c->ssl->renegotiation) {
+ /*
+ * disable renegotiation (CVE-2009-3555):
+ * OpenSSL (at least up to 0.9.8l) does not handle disabled
+ * renegotiation gracefully, so drop connection here
+ */
+
+ ngx_log_error(NGX_LOG_NOTICE, c->log, 0, "SSL renegotiation disabled");
+
+ c->ssl->no_wait_shutdown = 1;
+ c->ssl->no_send_shutdown = 1;
+
+ return NGX_ERROR;
+ }
+
if (n > 0) {
if (c->ssl->saved_write_handler) {
@@ -907,7 +991,7 @@
for ( ;; ) {
- while (in && buf->last < buf->end) {
+ while (in && buf->last < buf->end && send < limit) {
if (in->buf->last_buf || in->buf->flush) {
flush = 1;
}
@@ -934,8 +1018,8 @@
ngx_memcpy(buf->last, in->buf->pos, size);
buf->last += size;
-
in->buf->pos += size;
+ send += size;
if (in->buf->pos == in->buf->last) {
in = in->next;
@@ -960,7 +1044,6 @@
}
buf->pos += n;
- send += n;
c->sent += n;
if (n < size) {
@@ -1201,9 +1284,7 @@
if (err == NGX_ECONNRESET
|| err == NGX_EPIPE
|| err == NGX_ENOTCONN
-#if !(NGX_CRIT_ETIMEDOUT)
|| err == NGX_ETIMEDOUT
-#endif
|| err == NGX_ECONNREFUSED
|| err == NGX_ENETDOWN
|| err == NGX_ENETUNREACH
@@ -1232,10 +1313,15 @@
/* handshake failures */
if (n == SSL_R_DIGEST_CHECK_FAILED /* 149 */
+ || n == SSL_R_LENGTH_MISMATCH /* 159 */
|| n == SSL_R_NO_CIPHERS_PASSED /* 182 */
+ || n == SSL_R_NO_CIPHERS_SPECIFIED /* 183 */
|| n == SSL_R_NO_SHARED_CIPHER /* 193 */
+ || n == SSL_R_RECORD_LENGTH_MISMATCH /* 213 */
|| n == SSL_R_UNEXPECTED_MESSAGE /* 244 */
|| n == SSL_R_UNEXPECTED_RECORD /* 245 */
+ || n == SSL_R_UNKNOWN_ALERT_TYPE /* 246 */
+ || n == SSL_R_UNKNOWN_PROTOCOL /* 252 */
|| n == SSL_R_WRONG_VERSION_NUMBER /* 267 */
|| n == SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC /* 281 */
|| n == 1000 /* SSL_R_SSLV3_ALERT_CLOSE_NOTIFY */
@@ -1347,6 +1433,8 @@
return NGX_OK;
}
+ SSL_CTX_set_session_id_context(ssl->ctx, sess_ctx->data, sess_ctx->len);
+
if (builtin_session_cache == NGX_SSL_NONE_SCACHE) {
/*
@@ -1378,8 +1466,6 @@
SSL_CTX_set_session_cache_mode(ssl->ctx, cache_mode);
- SSL_CTX_set_session_id_context(ssl->ctx, sess_ctx->data, sess_ctx->len);
-
if (builtin_session_cache != NGX_SSL_NO_BUILTIN_SCACHE) {
if (builtin_session_cache != NGX_SSL_DFLT_BUILTIN_SCACHE) {
@@ -1551,7 +1637,7 @@
hash = ngx_crc32_short(sess->session_id, sess->session_id_length);
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
- "http ssl new session: %08XD:%d:%d",
+ "ssl new session: %08XD:%d:%d",
hash, sess->session_id_length, len);
sess_id->node.key = hash;
@@ -1614,7 +1700,7 @@
*copy = 0;
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
- "http ssl get session: %08XD:%d", hash, len);
+ "ssl get session: %08XD:%d", hash, len);
shm_zone = SSL_CTX_get_ex_data(SSL_get_SSL_CTX(ssl_conn),
ngx_ssl_session_cache_index);
@@ -1728,7 +1814,7 @@
hash = ngx_crc32_short(id, len);
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ngx_cycle->log, 0,
- "http ssl remove session: %08XD:%uz", hash, len);
+ "ssl remove session: %08XD:%uz", hash, len);
shpool = (ngx_slab_pool_t *) shm_zone->shm.addr;
@@ -1892,6 +1978,40 @@
ngx_int_t
+ngx_ssl_get_session_id(ngx_connection_t *c, ngx_pool_t *pool, ngx_str_t *s)
+{
+ int len;
+ u_char *p, *buf;
+ SSL_SESSION *sess;
+
+ sess = SSL_get0_session(c->ssl->connection);
+
+ len = i2d_SSL_SESSION(sess, NULL);
+
+ buf = ngx_alloc(len, c->log);
+ if (buf == NULL) {
+ return NGX_ERROR;
+ }
+
+ s->len = 2 * len;
+ s->data = ngx_pnalloc(pool, 2 * len);
+ if (s->data == NULL) {
+ ngx_free(buf);
+ return NGX_ERROR;
+ }
+
+ p = buf;
+ i2d_SSL_SESSION(sess, &p);
+
+ ngx_hex_dump(s->data, buf, len);
+
+ ngx_free(buf);
+
+ return NGX_OK;
+}
+
+
+ngx_int_t
ngx_ssl_get_raw_certificate(ngx_connection_t *c, ngx_pool_t *pool, ngx_str_t *s)
{
size_t len;
@@ -1974,7 +2094,7 @@
p = s->data;
- for (i = 0; i < len; i++) {
+ for (i = 0; i < cert.len - 1; i++) {
*p++ = cert.data[i];
if (cert.data[i] == LF) {
*p++ = '\t';
@@ -2108,6 +2228,35 @@
}
+ngx_int_t
+ngx_ssl_get_client_verify(ngx_connection_t *c, ngx_pool_t *pool, ngx_str_t *s)
+{
+ X509 *cert;
+
+ if (SSL_get_verify_result(c->ssl->connection) != X509_V_OK) {
+ s->len = sizeof("FAILED") - 1;
+ s->data = (u_char *) "FAILED";
+
+ return NGX_OK;
+ }
+
+ cert = SSL_get_peer_certificate(c->ssl->connection);
+
+ if (cert) {
+ s->len = sizeof("SUCCESS") - 1;
+ s->data = (u_char *) "SUCCESS";
+
+ } else {
+ s->len = sizeof("NONE") - 1;
+ s->data = (u_char *) "NONE";
+ }
+
+ X509_free(cert);
+
+ return NGX_OK;
+}
+
+
static void *
ngx_openssl_create_conf(ngx_cycle_t *cycle)
{
@@ -2115,7 +2264,7 @@
oscf = ngx_pcalloc(cycle->pool, sizeof(ngx_openssl_conf_t));
if (oscf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
@@ -2131,7 +2280,6 @@
static char *
ngx_openssl_engine(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
-#if (NGX_SSL_ENGINE)
ngx_openssl_conf_t *oscf = conf;
ENGINE *engine;
@@ -2166,23 +2314,12 @@
ENGINE_free(engine);
return NGX_CONF_OK;
-
-#else
-
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "\"ssl_engine\" directive is available only in "
- "OpenSSL 0.9.7 and higher,");
-
- return NGX_CONF_ERROR;
-
-#endif
}
static void
ngx_openssl_exit(ngx_cycle_t *cycle)
{
-#if (NGX_SSL_ENGINE)
+ EVP_cleanup();
ENGINE_cleanup();
-#endif
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/event/ngx_event_openssl.h
^
|
@@ -13,12 +13,9 @@
#include <openssl/ssl.h>
#include <openssl/err.h>
-
-#if OPENSSL_VERSION_NUMBER >= 0x00907000
#include <openssl/conf.h>
#include <openssl/engine.h>
-#define NGX_SSL_ENGINE 1
-#endif
+#include <openssl/evp.h>
#define NGX_SSL_NAME "OpenSSL"
@@ -45,6 +42,7 @@
ngx_event_handler_pt saved_write_handler;
unsigned handshaked:1;
+ unsigned renegotiation:1;
unsigned buffer:1;
unsigned no_wait_shutdown:1;
unsigned no_send_shutdown:1;
@@ -100,6 +98,7 @@
ngx_str_t *cert, ngx_str_t *key);
ngx_int_t ngx_ssl_client_certificate(ngx_conf_t *cf, ngx_ssl_t *ssl,
ngx_str_t *cert, ngx_int_t depth);
+ngx_int_t ngx_ssl_crl(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *crl);
ngx_int_t ngx_ssl_generate_rsa512_key(ngx_ssl_t *ssl);
ngx_int_t ngx_ssl_dhparam(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *file);
ngx_int_t ngx_ssl_session_cache(ngx_ssl_t *ssl, ngx_str_t *sess_ctx,
@@ -121,6 +120,8 @@
ngx_str_t *s);
ngx_int_t ngx_ssl_get_cipher_name(ngx_connection_t *c, ngx_pool_t *pool,
ngx_str_t *s);
+ngx_int_t ngx_ssl_get_session_id(ngx_connection_t *c, ngx_pool_t *pool,
+ ngx_str_t *s);
ngx_int_t ngx_ssl_get_raw_certificate(ngx_connection_t *c, ngx_pool_t *pool,
ngx_str_t *s);
ngx_int_t ngx_ssl_get_certificate(ngx_connection_t *c, ngx_pool_t *pool,
@@ -131,6 +132,8 @@
ngx_str_t *s);
ngx_int_t ngx_ssl_get_serial_number(ngx_connection_t *c, ngx_pool_t *pool,
ngx_str_t *s);
+ngx_int_t ngx_ssl_get_client_verify(ngx_connection_t *c, ngx_pool_t *pool,
+ ngx_str_t *s);
ngx_int_t ngx_ssl_handshake(ngx_connection_t *c);
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_access_module.c
^
|
@@ -201,7 +201,7 @@
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_access_loc_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
return conf;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_addition_filter_module.c
^
|
@@ -45,7 +45,7 @@
offsetof(ngx_http_addition_conf_t, after_body),
NULL },
- { ngx_string("addtion_types"),
+ { ngx_string("addition_types"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
ngx_http_types_slot,
NGX_HTTP_LOC_CONF_OFFSET,
@@ -212,7 +212,7 @@
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_addition_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_auth_basic_module.c
^
|
@@ -372,7 +372,7 @@
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_auth_basic_loc_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
return conf;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_autoindex_module.c
^
|
@@ -145,7 +145,7 @@
ngx_int_t rc, size;
ngx_str_t path;
ngx_dir_t dir;
- ngx_uint_t i, level;
+ ngx_uint_t i, level, utf8;
ngx_pool_t *pool;
ngx_time_t *tp;
ngx_chain_t out;
@@ -160,10 +160,6 @@
return NGX_DECLINED;
}
- if (r->zero_in_uri) {
- return NGX_DECLINED;
- }
-
if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {
return NGX_DECLINED;
}
@@ -252,6 +248,16 @@
filename = path.data;
filename[path.len] = '/';
+ if (r->headers_out.charset.len == 5
+ && ngx_strncasecmp(r->headers_out.charset.data, (u_char *) "utf-8", 5)
+ == 0)
+ {
+ utf8 = 1;
+
+ } else {
+ utf8 = 0;
+ }
+
for ( ;; ) {
ngx_set_errno(0);
@@ -335,7 +341,7 @@
entry->escape = 2 * ngx_escape_uri(NULL, ngx_de_name(&dir), len,
NGX_ESCAPE_HTML);
- if (r->utf8) {
+ if (utf8) {
entry->utf_len = ngx_utf8_length(entry->name.data, entry->name.len);
} else {
entry->utf_len = len;
@@ -622,7 +628,7 @@
conf = ngx_palloc(cf->pool, sizeof(ngx_http_autoindex_loc_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
conf->enable = NGX_CONF_UNSET;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_browser_module.c
^
|
@@ -423,7 +423,7 @@
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_browser_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_charset_filter_module.c
^
|
@@ -9,8 +9,9 @@
#include <ngx_http.h>
-#define NGX_HTTP_NO_CHARSET -2
-#define NGX_HTTP_CHARSET_VAR 0x10000
+#define NGX_HTTP_CHARSET_OFF -2
+#define NGX_HTTP_NO_CHARSET -3
+#define NGX_HTTP_CHARSET_VAR 0x10000
/* 1 byte length and up to 3 bytes for the UTF-8 encoding of the UCS-2 */
#define NGX_UTF_LEN 4
@@ -61,6 +62,7 @@
typedef struct {
u_char *table;
ngx_int_t charset;
+ ngx_str_t charset_name;
ngx_chain_t *busy;
ngx_chain_t *free_bufs;
@@ -82,9 +84,16 @@
} ngx_http_charset_conf_ctx_t;
-static ngx_int_t ngx_http_charset_get_charset(ngx_http_charset_t *charsets,
- ngx_uint_t n, ngx_str_t *charset);
-static ngx_int_t ngx_http_charset_set_charset(ngx_http_request_t *r,
+static ngx_int_t ngx_http_destination_charset(ngx_http_request_t *r,
+ ngx_str_t *name);
+static ngx_int_t ngx_http_main_request_charset(ngx_http_request_t *r,
+ ngx_str_t *name);
+static ngx_int_t ngx_http_source_charset(ngx_http_request_t *r,
+ ngx_str_t *name);
+static ngx_int_t ngx_http_get_charset(ngx_http_request_t *r, ngx_str_t *name);
+static ngx_inline void ngx_http_set_charset(ngx_http_request_t *r,
+ ngx_str_t *charset);
+static ngx_int_t ngx_http_charset_ctx(ngx_http_request_t *r,
ngx_http_charset_t *charsets, ngx_int_t charset, ngx_int_t source_charset);
static ngx_uint_t ngx_http_charset_recode(ngx_buf_t *b, u_char *table);
static ngx_chain_t *ngx_http_charset_recode_from_utf8(ngx_pool_t *pool,
@@ -207,207 +216,264 @@
ngx_http_charset_header_filter(ngx_http_request_t *r)
{
ngx_int_t charset, source_charset;
- ngx_str_t *mc, *from, *to, s;
- ngx_uint_t n;
+ ngx_str_t dst, src;
ngx_http_charset_t *charsets;
- ngx_http_charset_ctx_t *ctx;
- ngx_http_variable_value_t *vv;
- ngx_http_charset_loc_conf_t *lcf, *mlcf;
ngx_http_charset_main_conf_t *mcf;
- mcf = ngx_http_get_module_main_conf(r, ngx_http_charset_filter_module);
+ if (r == r->main) {
+ charset = ngx_http_destination_charset(r, &dst);
- charsets = mcf->charsets.elts;
- n = mcf->charsets.nelts;
+ } else {
+ charset = ngx_http_main_request_charset(r, &dst);
+ }
- /* destination charset */
+ if (charset == NGX_ERROR) {
+ return NGX_ERROR;
+ }
- if (r == r->main) {
+ if (charset == NGX_DECLINED) {
+ return ngx_http_next_header_filter(r);
+ }
+
+ /* charset: charset index or NGX_HTTP_NO_CHARSET */
+
+ source_charset = ngx_http_source_charset(r, &src);
+
+ if (source_charset == NGX_ERROR) {
+ return NGX_ERROR;
+ }
+
+ /*
+ * source_charset: charset index, NGX_HTTP_NO_CHARSET,
+ * or NGX_HTTP_CHARSET_OFF
+ */
+
+ ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+ "charset: \"%V\" > \"%V\"", &src, &dst);
- if (!r->ignore_content_encoding
- && r->headers_out.content_encoding
- && r->headers_out.content_encoding->value.len)
+ if (source_charset == NGX_HTTP_CHARSET_OFF) {
+ ngx_http_set_charset(r, &dst);
+
+ return ngx_http_next_header_filter(r);
+ }
+
+ if (charset == NGX_HTTP_NO_CHARSET
+ || source_charset == NGX_HTTP_NO_CHARSET)
+ {
+ if (source_charset != charset
+ || ngx_strncasecmp(dst.data, src.data, dst.len) != 0)
{
- return ngx_http_next_header_filter(r);
+ goto no_charset_map;
}
- if (r->headers_out.content_type.len == 0) {
- return ngx_http_next_header_filter(r);
- }
+ ngx_http_set_charset(r, &dst);
- if (r->headers_out.override_charset
- && r->headers_out.override_charset->len)
- {
- charset = ngx_http_charset_get_charset(charsets, n,
- r->headers_out.override_charset);
+ return ngx_http_next_header_filter(r);
+ }
- if (charset == NGX_HTTP_NO_CHARSET) {
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "unknown charset \"%V\" to override",
- r->headers_out.override_charset);
+ mcf = ngx_http_get_module_main_conf(r, ngx_http_charset_filter_module);
+ charsets = mcf->charsets.elts;
- return ngx_http_next_header_filter(r);
- }
+ if (source_charset != charset
+ && (charsets[source_charset].tables == NULL
+ || charsets[source_charset].tables[charset] == NULL))
+ {
+ goto no_charset_map;
+ }
- } else {
- mlcf = ngx_http_get_module_loc_conf(r,
- ngx_http_charset_filter_module);
- charset = mlcf->charset;
+ r->headers_out.content_type.len = r->headers_out.content_type_len;
- if (charset == NGX_HTTP_NO_CHARSET) {
- return ngx_http_next_header_filter(r);
- }
+ ngx_http_set_charset(r, &dst);
- if (r->headers_out.charset.len) {
- if (mlcf->override_charset == 0) {
- return ngx_http_next_header_filter(r);
- }
+ if (source_charset != charset) {
+ return ngx_http_charset_ctx(r, charsets, charset, source_charset);
+ }
- } else {
- if (ngx_http_test_content_type(r, &mlcf->types) == NULL) {
- return ngx_http_next_header_filter(r);
- }
- }
+ return ngx_http_next_header_filter(r);
- if (charset >= NGX_HTTP_CHARSET_VAR) {
- vv = ngx_http_get_indexed_variable(r,
- charset - NGX_HTTP_CHARSET_VAR);
+no_charset_map:
- if (vv == NULL || vv->not_found) {
- return NGX_ERROR;
- }
+ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+ "no \"charset_map\" between the charsets \"%V\" and \"%V\"",
+ &src, &dst);
- s.len = vv->len;
- s.data = vv->data;
+ return ngx_http_next_header_filter(r);
+}
- charset = ngx_http_charset_get_charset(charsets, n, &s);
- }
- }
- } else {
- ctx = ngx_http_get_module_ctx(r->main, ngx_http_charset_filter_module);
+static ngx_int_t
+ngx_http_destination_charset(ngx_http_request_t *r, ngx_str_t *name)
+{
+ ngx_int_t charset;
+ ngx_http_charset_t *charsets;
+ ngx_http_variable_value_t *vv;
+ ngx_http_charset_loc_conf_t *mlcf;
+ ngx_http_charset_main_conf_t *mcf;
- if (ctx == NULL) {
+ if (!r->ignore_content_encoding
+ && r->headers_out.content_encoding
+ && r->headers_out.content_encoding->value.len)
+ {
+ return NGX_DECLINED;
+ }
- mc = &r->main->headers_out.charset;
+ if (r->headers_out.content_type.len == 0) {
+ return NGX_DECLINED;
+ }
- if (mc->len == 0) {
- return ngx_http_next_header_filter(r);
- }
+ if (r->headers_out.override_charset
+ && r->headers_out.override_charset->len)
+ {
+ *name = *r->headers_out.override_charset;
- ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_charset_ctx_t));
- if (ctx == NULL) {
- return NGX_ERROR;
- }
+ charset = ngx_http_get_charset(r, name);
- ngx_http_set_ctx(r->main, ctx, ngx_http_charset_filter_module);
+ if (charset != NGX_HTTP_NO_CHARSET) {
+ return charset;
+ }
+
+ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+ "unknown charset \"%V\" to override", name);
+
+ return NGX_DECLINED;
+ }
- charset = ngx_http_charset_get_charset(charsets, n, mc);
+ mlcf = ngx_http_get_module_loc_conf(r, ngx_http_charset_filter_module);
+ charset = mlcf->charset;
- ctx->charset = charset;
+ if (charset == NGX_HTTP_CHARSET_OFF) {
+ return NGX_DECLINED;
+ }
- } else {
- charset = ctx->charset;
+ if (r->headers_out.charset.len) {
+ if (mlcf->override_charset == 0) {
+ return NGX_DECLINED;
+ }
+
+ } else {
+ if (ngx_http_test_content_type(r, &mlcf->types) == NULL) {
+ return NGX_DECLINED;
}
}
- /* source charset */
+ if (charset < NGX_HTTP_CHARSET_VAR) {
+ mcf = ngx_http_get_module_main_conf(r, ngx_http_charset_filter_module);
+ charsets = mcf->charsets.elts;
+ *name = charsets[charset].name;
+ return charset;
+ }
- if (r->headers_out.charset.len == 0) {
- lcf = ngx_http_get_module_loc_conf(r, ngx_http_charset_filter_module);
+ vv = ngx_http_get_indexed_variable(r, charset - NGX_HTTP_CHARSET_VAR);
- source_charset = lcf->source_charset;
+ if (vv == NULL || vv->not_found) {
+ return NGX_ERROR;
+ }
- if (source_charset >= NGX_HTTP_CHARSET_VAR) {
- vv = ngx_http_get_indexed_variable(r,
- source_charset - NGX_HTTP_CHARSET_VAR);
+ name->len = vv->len;
+ name->data = vv->data;
- if (vv == NULL || vv->not_found) {
- return NGX_ERROR;
- }
+ return ngx_http_get_charset(r, name);
+}
- s.len = vv->len;
- s.data = vv->data;
- source_charset = ngx_http_charset_get_charset(charsets, n, &s);
- }
+static ngx_int_t
+ngx_http_main_request_charset(ngx_http_request_t *r, ngx_str_t *src)
+{
+ ngx_int_t charset;
+ ngx_str_t *main_charset;
+ ngx_http_charset_ctx_t *ctx;
- if (charset != NGX_HTTP_NO_CHARSET) {
- return ngx_http_charset_set_charset(r, mcf->charsets.elts, charset,
- source_charset);
- }
+ ctx = ngx_http_get_module_ctx(r->main, ngx_http_charset_filter_module);
- if (source_charset == NGX_CONF_UNSET) {
- return ngx_http_next_header_filter(r);
- }
+ if (ctx) {
+ *src = ctx->charset_name;
+ return ctx->charset;
+ }
- from = &charsets[source_charset].name;
- to = &r->main->headers_out.charset;
+ main_charset = &r->main->headers_out.charset;
- goto no_charset_map;
+ if (main_charset->len == 0) {
+ return NGX_DECLINED;
}
- source_charset = ngx_http_charset_get_charset(charsets, n,
- &r->headers_out.charset);
+ ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_charset_ctx_t));
+ if (ctx == NULL) {
+ return NGX_ERROR;
+ }
- if (charset == NGX_HTTP_NO_CHARSET
- || source_charset == NGX_HTTP_NO_CHARSET)
- {
- if (charset != source_charset
- || ngx_strcasecmp(r->main->headers_out.charset.data,
- r->headers_out.charset.data)
- != 0)
- {
- from = &r->headers_out.charset;
- to = (charset == NGX_HTTP_NO_CHARSET) ?
- &r->main->headers_out.charset:
- &charsets[charset].name;
+ ngx_http_set_ctx(r->main, ctx, ngx_http_charset_filter_module);
- goto no_charset_map;
- }
+ charset = ngx_http_get_charset(r, main_charset);
- return ngx_http_next_header_filter(r);
+ ctx->charset = charset;
+ ctx->charset_name = *main_charset;
+ *src = *main_charset;
+
+ return charset;
+}
+
+
+static ngx_int_t
+ngx_http_source_charset(ngx_http_request_t *r, ngx_str_t *name)
+{
+ ngx_int_t charset;
+ ngx_http_charset_t *charsets;
+ ngx_http_variable_value_t *vv;
+ ngx_http_charset_loc_conf_t *lcf;
+ ngx_http_charset_main_conf_t *mcf;
+
+ if (r->headers_out.charset.len) {
+ *name = r->headers_out.charset;
+ return ngx_http_get_charset(r, name);
}
- if (source_charset != charset
- && (charsets[source_charset].tables == NULL
- || charsets[source_charset].tables[charset] == NULL))
- {
- from = &charsets[source_charset].name;
- to = &charsets[charset].name;
+ lcf = ngx_http_get_module_loc_conf(r, ngx_http_charset_filter_module);
- goto no_charset_map;
+ charset = lcf->source_charset;
+
+ if (charset == NGX_HTTP_CHARSET_OFF) {
+ name->len = 0;
+ return charset;
}
- r->headers_out.content_type.len = r->headers_out.content_type_len;
+ if (charset < NGX_HTTP_CHARSET_VAR) {
+ mcf = ngx_http_get_module_main_conf(r, ngx_http_charset_filter_module);
+ charsets = mcf->charsets.elts;
+ *name = charsets[charset].name;
+ return charset;
+ }
- return ngx_http_charset_set_charset(r, mcf->charsets.elts, charset,
- source_charset);
+ vv = ngx_http_get_indexed_variable(r, charset - NGX_HTTP_CHARSET_VAR);
-no_charset_map:
+ if (vv == NULL || vv->not_found) {
+ return NGX_ERROR;
+ }
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "no \"charset_map\" between the charsets \"%V\" and \"%V\"",
- from, to);
+ name->len = vv->len;
+ name->data = vv->data;
- return ngx_http_next_header_filter(r);
+ return ngx_http_get_charset(r, name);
}
static ngx_int_t
-ngx_http_charset_get_charset(ngx_http_charset_t *charsets, ngx_uint_t n,
- ngx_str_t *charset)
+ngx_http_get_charset(ngx_http_request_t *r, ngx_str_t *name)
{
- ngx_uint_t i;
+ ngx_uint_t i, n;
+ ngx_http_charset_t *charset;
+ ngx_http_charset_main_conf_t *mcf;
+
+ mcf = ngx_http_get_module_main_conf(r, ngx_http_charset_filter_module);
+
+ charset = mcf->charsets.elts;
+ n = mcf->charsets.nelts;
for (i = 0; i < n; i++) {
- if (charsets[i].name.len != charset->len) {
+ if (charset[i].name.len != name->len) {
continue;
}
- if (ngx_strncasecmp(charsets[i].name.data, charset->data, charset->len)
- == 0)
- {
+ if (ngx_strncasecmp(charset[i].name.data, name->data, name->len) == 0) {
return i;
}
}
@@ -416,11 +482,12 @@
}
-static ngx_int_t
-ngx_http_charset_set_charset(ngx_http_request_t *r,
- ngx_http_charset_t *charsets, ngx_int_t charset, ngx_int_t source_charset)
+static ngx_inline void
+ngx_http_set_charset(ngx_http_request_t *r, ngx_str_t *charset)
{
- ngx_http_charset_ctx_t *ctx;
+ if (r != r->main) {
+ return;
+ }
if (r->headers_out.status == NGX_HTTP_MOVED_PERMANENTLY
|| r->headers_out.status == NGX_HTTP_MOVED_TEMPORARILY)
@@ -431,16 +498,18 @@
*/
r->headers_out.charset.len = 0;
-
- return ngx_http_next_header_filter(r);
+ return;
}
- r->headers_out.charset = charsets[charset].name;
- r->utf8 = charsets[charset].utf8;
+ r->headers_out.charset = *charset;
+}
- if (source_charset == NGX_CONF_UNSET || source_charset == charset) {
- return ngx_http_next_header_filter(r);
- }
+
+static ngx_int_t
+ngx_http_charset_ctx(ngx_http_request_t *r, ngx_http_charset_t *charsets,
+ ngx_int_t charset, ngx_int_t source_charset)
+{
+ ngx_http_charset_ctx_t *ctx;
ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_charset_ctx_t));
if (ctx == NULL) {
@@ -451,6 +520,7 @@
ctx->table = charsets[source_charset].tables[charset];
ctx->charset = charset;
+ ctx->charset_name = charsets[charset].name;
ctx->length = charsets[charset].length;
ctx->from_utf8 = charsets[source_charset].utf8;
ctx->to_utf8 = charsets[charset].utf8;
@@ -1338,7 +1408,7 @@
if (cmd->offset == offsetof(ngx_http_charset_loc_conf_t, charset)
&& ngx_strcmp(value[1].data, "off") == 0)
{
- *cp = NGX_HTTP_NO_CHARSET;
+ *cp = NGX_HTTP_CHARSET_OFF;
return NGX_CONF_OK;
}
@@ -1418,27 +1488,27 @@
mcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_charset_main_conf_t));
if (mcf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
if (ngx_array_init(&mcf->charsets, cf->pool, 2, sizeof(ngx_http_charset_t))
!= NGX_OK)
{
- return NGX_CONF_ERROR;
+ return NULL;
}
if (ngx_array_init(&mcf->tables, cf->pool, 1,
sizeof(ngx_http_charset_tables_t))
!= NGX_OK)
{
- return NGX_CONF_ERROR;
+ return NULL;
}
if (ngx_array_init(&mcf->recodes, cf->pool, 2,
sizeof(ngx_http_charset_recode_t))
!= NGX_OK)
{
- return NGX_CONF_ERROR;
+ return NULL;
}
return mcf;
@@ -1452,7 +1522,7 @@
lcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_charset_loc_conf_t));
if (lcf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
@@ -1489,14 +1559,12 @@
}
ngx_conf_merge_value(conf->override_charset, prev->override_charset, 0);
- ngx_conf_merge_value(conf->charset, prev->charset, NGX_HTTP_NO_CHARSET);
-
- if (conf->source_charset == NGX_CONF_UNSET) {
- conf->source_charset = prev->source_charset;
- }
+ ngx_conf_merge_value(conf->charset, prev->charset, NGX_HTTP_CHARSET_OFF);
+ ngx_conf_merge_value(conf->source_charset, prev->source_charset,
+ NGX_HTTP_CHARSET_OFF);
- if (conf->charset == NGX_HTTP_NO_CHARSET
- || conf->source_charset == NGX_CONF_UNSET
+ if (conf->charset == NGX_HTTP_CHARSET_OFF
+ || conf->source_charset == NGX_HTTP_CHARSET_OFF
|| conf->charset == conf->source_charset)
{
return NGX_CONF_OK;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_chunked_filter_module.c
^
|
@@ -50,9 +50,10 @@
static ngx_int_t
ngx_http_chunked_header_filter(ngx_http_request_t *r)
{
+ ngx_http_core_loc_conf_t *clcf;
+
if (r->headers_out.status == NGX_HTTP_NOT_MODIFIED
|| r->headers_out.status == NGX_HTTP_NO_CONTENT
- || r->headers_out.status == NGX_HTTP_CREATED
|| r != r->main
|| (r->method & NGX_HTTP_HEAD))
{
@@ -64,7 +65,14 @@
r->keepalive = 0;
} else {
- r->chunked = 1;
+ clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
+
+ if (clcf->chunked_transfer_encoding) {
+ r->chunked = 1;
+
+ } else {
+ r->keepalive = 0;
+ }
}
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_dav_module.c
^
|
@@ -53,8 +53,6 @@
ngx_str_t *path);
static ngx_int_t ngx_http_dav_copy_tree_file(ngx_tree_ctx_t *ctx,
ngx_str_t *path);
-static ngx_int_t ngx_http_dav_copy_file(ngx_tree_ctx_t *ctx, u_char *from,
- u_char *to);
static ngx_int_t ngx_http_dav_depth(ngx_http_request_t *r, ngx_int_t dflt);
static ngx_int_t ngx_http_dav_error(ngx_log_t *log, ngx_err_t err,
@@ -148,10 +146,6 @@
ngx_int_t rc;
ngx_http_dav_loc_conf_t *dlcf;
- if (r->zero_in_uri) {
- return NGX_DECLINED;
- }
-
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_module);
if (!(r->method & dlcf->methods)) {
@@ -216,6 +210,8 @@
ngx_http_map_uri_to_path(r, &path, &root, 0);
+ path.len--;
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http put filename: \"%s\"", path.data);
@@ -249,7 +245,6 @@
ext.time = -1;
ext.create_path = dlcf->create_full_put_path;
ext.delete_file = 1;
- ext.log_rename_error = 1;
ext.log = r->connection->log;
if (r->headers_in.date) {
@@ -326,13 +321,13 @@
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http delete filename: \"%s\"", path.data);
- if (ngx_file_info(path.data, &fi) == NGX_FILE_ERROR) {
+ if (ngx_link_info(path.data, &fi) == NGX_FILE_ERROR) {
err = ngx_errno;
rc = (err == NGX_ENOTDIR) ? NGX_HTTP_CONFLICT : NGX_HTTP_NOT_FOUND;
return ngx_http_dav_error(r->connection->log, err,
- rc, ngx_file_info_n, path.data);
+ rc, ngx_link_info_n, path.data);
}
if (ngx_is_dir(&fi)) {
@@ -359,7 +354,7 @@
/*
* we do not need to test (r->uri.data[r->uri.len - 1] == '/')
- * because ngx_file_info("/file/") returned NGX_ENOTDIR above
+ * because ngx_link_info("/file/") returned NGX_ENOTDIR above
*/
depth = ngx_http_dav_depth(r, 0);
@@ -491,6 +486,7 @@
p = ngx_http_map_uri_to_path(r, &path, &root, 0);
*(p - 1) = '\0';
+ r->uri.len--;
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http mkcol path: \"%s\"", path.data);
@@ -517,9 +513,10 @@
size_t len, root;
ngx_err_t err;
ngx_int_t rc, depth;
- ngx_uint_t overwrite, slash, dir;
- ngx_str_t path, uri;
+ ngx_uint_t overwrite, slash, dir, flags;
+ ngx_str_t path, uri, duri, args;
ngx_tree_ctx_t tree;
+ ngx_copy_file_t cf;
ngx_file_info_t fi;
ngx_table_elt_t *dest, *over;
ngx_ext_rename_file_t ext;
@@ -594,6 +591,14 @@
destination_done:
+ duri.len = last - p;
+ duri.data = p;
+ flags = 0;
+
+ if (ngx_http_parse_unsafe_uri(r, &duri, &args, &flags) != NGX_OK) {
+ goto invalid_destination;
+ }
+
if ((r->uri.data[r->uri.len - 1] == '/' && *(last - 1) != '/')
|| (r->uri.data[r->uri.len - 1] != '/' && *(last - 1) == '/'))
{
@@ -656,9 +661,7 @@
"http copy from: \"%s\"", path.data);
uri = r->uri;
-
- r->uri.len = last - p;
- r->uri.data = p;
+ r->uri = duri;
ngx_http_map_uri_to_path(r, ©.path, &root, 0);
@@ -678,12 +681,12 @@
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http copy to: \"%s\"", copy.path.data);
- if (ngx_file_info(copy.path.data, &fi) == NGX_FILE_ERROR) {
+ if (ngx_link_info(copy.path.data, &fi) == NGX_FILE_ERROR) {
err = ngx_errno;
if (err != NGX_ENOENT) {
return ngx_http_dav_error(r->connection->log, err,
- NGX_HTTP_NOT_FOUND, ngx_file_info_n,
+ NGX_HTTP_NOT_FOUND, ngx_link_info_n,
copy.path.data);
}
@@ -712,9 +715,9 @@
dir = ngx_is_dir(&fi);
}
- if (ngx_file_info(path.data, &fi) == NGX_FILE_ERROR) {
+ if (ngx_link_info(path.data, &fi) == NGX_FILE_ERROR) {
return ngx_http_dav_error(r->connection->log, ngx_errno,
- NGX_HTTP_NOT_FOUND, ngx_file_info_n,
+ NGX_HTTP_NOT_FOUND, ngx_link_info_n,
path.data);
}
@@ -791,43 +794,24 @@
ext.time = -1;
ext.create_path = 1;
ext.delete_file = 0;
- ext.log_rename_error = 0;
ext.log = r->connection->log;
if (ngx_ext_rename_file(&path, ©.path, &ext) == NGX_OK) {
return NGX_HTTP_NO_CONTENT;
}
- if (ext.rename_error != NGX_EXDEV) {
-
- if (ext.rename_error) {
- ngx_log_error(NGX_LOG_CRIT, r->connection->log,
- ext.rename_error,
- ngx_rename_file_n " \"%s\" to \"%s\" failed",
- path.data, copy.path.data);
- }
-
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
+ return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_module);
- tree.size = ngx_file_size(&fi);
- tree.mtime = ngx_file_mtime(&fi);
- tree.access = dlcf->access;
- tree.log = r->connection->log;
-
- if (ngx_http_dav_copy_file(&tree, path.data, copy.path.data) == NGX_OK)
- {
- if (r->method == NGX_HTTP_MOVE) {
- rc = ngx_http_dav_delete_path(r, &path, 0);
-
- if (rc != NGX_OK) {
- return rc;
- }
- }
+ cf.size = ngx_file_size(&fi);
+ cf.buf_size = 0;
+ cf.access = dlcf->access;
+ cf.time = ngx_file_mtime(&fi);
+ cf.log = r->connection->log;
+ if (ngx_copy_file(path.data, copy.path.data, &cf) == NGX_OK) {
return NGX_HTTP_NO_CONTENT;
}
}
@@ -941,6 +925,7 @@
{
u_char *p, *file;
size_t len;
+ ngx_copy_file_t cf;
ngx_http_dav_copy_ctx_t *copy;
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ctx->log, 0,
@@ -961,7 +946,13 @@
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ctx->log, 0,
"http copy file to: \"%s\"", file);
- (void) ngx_http_dav_copy_file(ctx, path->data, file);
+ cf.size = ctx->size;
+ cf.buf_size = 0;
+ cf.access = ctx->access;
+ cf.time = ctx->mtime;
+ cf.log = ctx->log;
+
+ (void) ngx_copy_file(path->data, file, &cf);
ngx_free(file);
@@ -970,75 +961,6 @@
static ngx_int_t
-ngx_http_dav_copy_file(ngx_tree_ctx_t *ctx, u_char *from, u_char *to)
-{
- off_t size;
- ssize_t n;
- ngx_fd_t fd, cfd;
- ngx_int_t rc;
- u_char buf[NGX_HTTP_DAV_COPY_BLOCK];
-
- fd = ngx_open_file(from, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
-
- if (fd == NGX_INVALID_FILE) {
- (void) ngx_http_dav_error(ctx->log, ngx_errno, 0, ngx_open_file_n,
- from);
- return NGX_ERROR;
- }
-
- cfd = ngx_open_file(to, NGX_FILE_WRONLY, NGX_FILE_CREATE_OR_OPEN,
- ctx->access);
-
- rc = NGX_ERROR;
-
- if (cfd == NGX_INVALID_FILE) {
- (void) ngx_http_dav_error(ctx->log, ngx_errno, 0, ngx_open_file_n, to);
- goto failed;
- }
-
- for (size = ctx->size; size > 0; size -= n) {
-
- n = ngx_read_fd(fd, buf, NGX_HTTP_DAV_COPY_BLOCK);
-
- if (n == NGX_FILE_ERROR) {
- ngx_log_error(NGX_LOG_ALERT, ctx->log, ngx_errno,
- ngx_read_fd_n " \"%s\" failed", from);
- goto failed;
- }
-
- if (ngx_write_fd(cfd, buf, n) == NGX_FILE_ERROR) {
- ngx_log_error(NGX_LOG_ALERT, ctx->log, ngx_errno,
- ngx_write_fd_n " \"%s\" failed", to);
- goto failed;
- }
- }
-
- if (ngx_set_file_time(to, cfd, ctx->mtime) != NGX_OK) {
- ngx_log_error(NGX_LOG_ALERT, ctx->log, ngx_errno,
- ngx_set_file_time_n " \"%s\" failed", to);
- goto failed;
- }
-
- if (ngx_close_file(cfd) == NGX_FILE_ERROR) {
- ngx_log_error(NGX_LOG_ALERT, ctx->log, ngx_errno,
- ngx_close_file_n " \"%s\" failed", to);
- goto failed;
- }
-
- rc = NGX_OK;
-
-failed:
-
- if (ngx_close_file(fd) == NGX_FILE_ERROR) {
- ngx_log_error(NGX_LOG_ALERT, ctx->log, ngx_errno,
- ngx_close_file_n " \"%s\" failed", from);
- }
-
- return rc;
-}
-
-
-static ngx_int_t
ngx_http_dav_depth(ngx_http_request_t *r, ngx_int_t dflt)
{
ngx_table_elt_t *depth;
@@ -1154,7 +1076,7 @@
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_dav_loc_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_fastcgi_module.c
^
|
@@ -333,6 +333,13 @@
0,
&ngx_http_fastcgi_module },
+ { ngx_string("fastcgi_no_cache"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
+ ngx_http_no_cache_set_slot,
+ NGX_HTTP_LOC_CONF_OFFSET,
+ offsetof(ngx_http_fastcgi_loc_conf_t, upstream.no_cache),
+ NULL },
+
{ ngx_string("fastcgi_cache_valid"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
ngx_http_file_cache_valid_set_slot,
@@ -523,6 +530,23 @@
};
+#if (NGX_HTTP_CACHE)
+
+static ngx_str_t ngx_http_fastcgi_hide_cache_headers[] = {
+ ngx_string("Status"),
+ ngx_string("X-Accel-Expires"),
+ ngx_string("X-Accel-Redirect"),
+ ngx_string("X-Accel-Limit-Rate"),
+ ngx_string("X-Accel-Buffering"),
+ ngx_string("X-Accel-Charset"),
+ ngx_string("Set-Cookie"),
+ ngx_string("P3P"),
+ ngx_null_string
+};
+
+#endif
+
+
static ngx_path_init_t ngx_http_fastcgi_temp_path = {
ngx_string(NGX_HTTP_FASTCGI_TEMP_PATH), { 1, 2, 0 }
};
@@ -543,19 +567,16 @@
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
- f = ngx_pcalloc(r->pool, sizeof(ngx_http_fastcgi_ctx_t));
- if (f == NULL) {
- return NGX_ERROR;
+ if (ngx_http_upstream_create(r) != NGX_OK) {
+ return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
- ngx_http_set_ctx(r, f, ngx_http_fastcgi_module);
-
- u = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_t));
- if (u == NULL) {
+ f = ngx_pcalloc(r->pool, sizeof(ngx_http_fastcgi_ctx_t));
+ if (f == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
- r->upstream = u;
+ ngx_http_set_ctx(r, f, ngx_http_fastcgi_module);
flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module);
@@ -565,15 +586,11 @@
}
}
+ u = r->upstream;
+
u->schema.len = sizeof("fastcgi://") - 1;
u->schema.data = (u_char *) "fastcgi://";
- u->peer.log = r->connection->log;
- u->peer.log_error = NGX_ERROR_ERR;
-#if (NGX_THREADS)
- u->peer.lock = &r->connection->lock;
-#endif
-
u->output.tag = (ngx_buf_tag_t) &ngx_http_fastcgi_module;
u->conf = &flcf->upstream;
@@ -1072,9 +1089,10 @@
static ngx_int_t
ngx_http_fastcgi_process_header(ngx_http_request_t *r)
{
- u_char *p, *start, *last, *part_start;
+ u_char *p, *msg, *start, *last,
+ *part_start, *part_end;
size_t size;
- ngx_str_t *status_line, line, *pattern;
+ ngx_str_t *status_line, *pattern;
ngx_int_t rc, status;
ngx_buf_t buf;
ngx_uint_t i;
@@ -1158,40 +1176,39 @@
if (f->type == NGX_HTTP_FASTCGI_STDERR) {
if (f->length) {
- line.data = u->buffer.pos;
+ msg = u->buffer.pos;
if (u->buffer.pos + f->length <= u->buffer.last) {
- line.len = f->length;
u->buffer.pos += f->length;
f->length = 0;
f->state = ngx_http_fastcgi_st_padding;
} else {
- line.len = u->buffer.last - u->buffer.pos;
f->length -= u->buffer.last - u->buffer.pos;
u->buffer.pos = u->buffer.last;
}
- while (line.data[line.len - 1] == LF
- || line.data[line.len - 1] == CR
- || line.data[line.len - 1] == '.'
- || line.data[line.len - 1] == ' ')
- {
- line.len--;
+ for (p = u->buffer.pos - 1; msg < p; p--) {
+ if (*p != LF && *p != CR && *p != '.' && *p != ' ') {
+ break;
+ }
}
+ p++;
+
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "FastCGI sent in stderr: \"%V\"", &line);
+ "FastCGI sent in stderr: \"%*s\"", p - msg, msg);
flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module);
if (flcf->catch_stderr) {
pattern = flcf->catch_stderr->elts;
- line.data[line.len - 1] = '\0';
-
for (i = 0; i < flcf->catch_stderr->nelts; i++) {
- if (ngx_strstr(line.data, pattern[i].data)) {
+ if (ngx_strnstr(msg, (char *) pattern[i].data,
+ p - msg)
+ != NULL)
+ {
return NGX_HTTP_UPSTREAM_INVALID_HEADER;
}
}
@@ -1244,6 +1261,7 @@
for ( ;; ) {
part_start = u->buffer.pos;
+ part_end = u->buffer.last;
rc = ngx_http_parse_header_line(r, &u->buffer, 1);
@@ -1444,7 +1462,11 @@
part = ngx_array_push(f->split_parts);
part->start = part_start;
- part->end = u->buffer.last;
+ part->end = part_end;
+
+ if (u->buffer.pos < u->buffer.last) {
+ continue;
+ }
return NGX_AGAIN;
}
@@ -1454,9 +1476,9 @@
static ngx_int_t
ngx_http_fastcgi_input_filter(ngx_event_pipe_t *p, ngx_buf_t *buf)
{
+ u_char *m, *msg;
ngx_int_t rc;
ngx_buf_t *b, **prev;
- ngx_str_t line;
ngx_chain_t *cl;
ngx_http_request_t *r;
ngx_http_fastcgi_ctx_t *f;
@@ -1540,30 +1562,27 @@
break;
}
- line.data = f->pos;
+ msg = f->pos;
if (f->pos + f->length <= f->last) {
- line.len = f->length;
f->pos += f->length;
f->length = 0;
f->state = ngx_http_fastcgi_st_padding;
} else {
- line.len = f->last - f->pos;
f->length -= f->last - f->pos;
f->pos = f->last;
}
- while (line.data[line.len - 1] == LF
- || line.data[line.len - 1] == CR
- || line.data[line.len - 1] == '.'
- || line.data[line.len - 1] == ' ')
- {
- line.len--;
+ for (m = f->pos - 1; msg < m; m--) {
+ if (*m != LF && *m != CR && *m != '.' && *m != ' ') {
+ break;
+ }
}
ngx_log_error(NGX_LOG_ERR, p->log, 0,
- "FastCGI sent in stderr: \"%V\"", &line);
+ "FastCGI sent in stderr: \"%*s\"",
+ m + 1 - msg, msg);
if (f->pos == f->last) {
break;
@@ -1834,7 +1853,7 @@
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_fastcgi_loc_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
@@ -1878,6 +1897,7 @@
#if (NGX_HTTP_CACHE)
conf->upstream.cache = NGX_CONF_UNSET_PTR;
conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT;
+ conf->upstream.no_cache = NGX_CONF_UNSET_PTR;
conf->upstream.cache_valid = NGX_CONF_UNSET_PTR;
#endif
@@ -1904,6 +1924,7 @@
u_char *p;
size_t size;
uintptr_t *code;
+ ngx_str_t *h;
ngx_uint_t i;
ngx_keyval_t *src;
ngx_hash_init_t hash;
@@ -2098,6 +2119,9 @@
conf->upstream.cache_methods |= NGX_HTTP_GET|NGX_HTTP_HEAD;
+ ngx_conf_merge_ptr_value(conf->upstream.no_cache,
+ prev->upstream.no_cache, NULL);
+
ngx_conf_merge_ptr_value(conf->upstream.cache_valid,
prev->upstream.cache_valid, NULL);
@@ -2124,10 +2148,18 @@
hash.bucket_size = ngx_align(64, ngx_cacheline_size);
hash.name = "fastcgi_hide_headers_hash";
+#if (NGX_HTTP_CACHE)
+
+ h = conf->upstream.cache ? ngx_http_fastcgi_hide_cache_headers:
+ ngx_http_fastcgi_hide_headers;
+#else
+
+ h = ngx_http_fastcgi_hide_headers;
+
+#endif
+
if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream,
- &prev->upstream,
- ngx_http_fastcgi_hide_headers,
- &hash)
+ &prev->upstream, h, &hash)
!= NGX_OK)
{
return NGX_CONF_ERROR;
@@ -2438,8 +2470,13 @@
}
clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
+
clcf->handler = ngx_http_fastcgi_handler;
+ if (clcf->name.data[clcf->name.len - 1] == '/') {
+ clcf->auto_redirect = 1;
+ }
+
value = cf->args->elts;
url = &value[1];
@@ -2475,10 +2512,6 @@
return NGX_CONF_ERROR;
}
- if (clcf->name.data[clcf->name.len - 1] == '/') {
- clcf->auto_redirect = 1;
- }
-
return NGX_CONF_OK;
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_flv_module.c
^
|
@@ -80,10 +80,6 @@
return NGX_DECLINED;
}
- if (r->zero_in_uri) {
- return NGX_DECLINED;
- }
-
rc = ngx_http_discard_request_body(r);
if (rc != NGX_OK) {
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_geo_module.c
^
|
@@ -35,6 +35,7 @@
ngx_radix_tree_t *tree;
ngx_rbtree_t rbtree;
ngx_rbtree_node_t sentinel;
+ ngx_array_t *proxies;
ngx_pool_t *pool;
ngx_pool_t *temp_pool;
} ngx_http_geo_conf_ctx_t;
@@ -46,12 +47,16 @@
ngx_http_geo_high_ranges_t *high;
} u;
+ ngx_array_t *proxies;
+
ngx_int_t index;
} ngx_http_geo_ctx_t;
static in_addr_t ngx_http_geo_addr(ngx_http_request_t *r,
ngx_http_geo_ctx_t *ctx);
+static in_addr_t ngx_http_geo_real_addr(ngx_http_request_t *r,
+ ngx_http_geo_ctx_t *ctx);
static char *ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
static char *ngx_http_geo(ngx_conf_t *cf, ngx_command_t *dummy, void *conf);
static char *ngx_http_geo_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx,
@@ -64,6 +69,10 @@
ngx_str_t *value);
static ngx_http_variable_value_t *ngx_http_geo_value(ngx_conf_t *cf,
ngx_http_geo_conf_ctx_t *ctx, ngx_str_t *value);
+static char *ngx_http_geo_add_proxy(ngx_conf_t *cf,
+ ngx_http_geo_conf_ctx_t *ctx, ngx_cidr_t *cidr);
+static ngx_int_t ngx_http_geo_cidr_value(ngx_conf_t *cf, ngx_str_t *net,
+ ngx_cidr_t *cidr);
static ngx_command_t ngx_http_geo_commands[] = {
@@ -168,6 +177,50 @@
static in_addr_t
ngx_http_geo_addr(ngx_http_request_t *r, ngx_http_geo_ctx_t *ctx)
{
+ u_char *p, *ip;
+ size_t len;
+ in_addr_t addr;
+ ngx_uint_t i, n;
+ ngx_in_cidr_t *proxies;
+ ngx_table_elt_t *xfwd;
+
+ addr = ngx_http_geo_real_addr(r, ctx);
+
+ xfwd = r->headers_in.x_forwarded_for;
+
+ if (xfwd == NULL || ctx->proxies == NULL) {
+ return addr;
+ }
+
+ proxies = ctx->proxies->elts;
+ n = ctx->proxies->nelts;
+
+ for (i = 0; i < n; i++) {
+ if ((addr & proxies[i].mask) == proxies[i].addr) {
+
+ len = xfwd->value.len;
+ ip = xfwd->value.data;
+
+ for (p = ip + len - 1; p > ip; p--) {
+ if (*p == ' ' || *p == ',') {
+ p++;
+ len -= p - ip;
+ ip = p;
+ break;
+ }
+ }
+
+ return ntohl(ngx_inet_addr(ip, len));
+ }
+ }
+
+ return addr;
+}
+
+
+static in_addr_t
+ngx_http_geo_real_addr(ngx_http_request_t *r, ngx_http_geo_ctx_t *ctx)
+{
struct sockaddr_in *sin;
ngx_http_variable_value_t *v;
@@ -259,6 +312,7 @@
ctx.high = NULL;
ctx.tree = NULL;
+ ctx.proxies = NULL;
ctx.pool = cf->pool;
save = *cf;
@@ -271,6 +325,8 @@
*cf = save;
+ geo->proxies = ctx.proxies;
+
if (ctx.high) {
for (i = 0; i < 0x10000; i++) {
@@ -341,6 +397,7 @@
{
char *rv;
ngx_str_t *value, file;
+ ngx_cidr_t cidr;
ngx_http_geo_conf_ctx_t *ctx;
ctx = cf->ctx;
@@ -394,6 +451,16 @@
rv = ngx_conf_parse(cf, &file);
goto done;
+
+ } else if (ngx_strcmp(value[0].data, "proxy") == 0) {
+
+ if (ngx_http_geo_cidr_value(cf, &value[1], &cidr) != NGX_OK) {
+ goto failed;
+ }
+
+ rv = ngx_http_geo_add_proxy(cf, ctx, &cidr);
+
+ goto done;
}
if (ctx->high) {
@@ -522,7 +589,7 @@
ngx_array_t *a;
ngx_http_geo_range_t *range;
- for (n = start; n <= end; n += 0x10000) {
+ for (n = start; n <= end; n = (n + 0x10000) & 0xffff0000) {
h = n >> 16;
@@ -803,33 +870,8 @@
del = 0;
}
- if (ngx_strcmp(net->data, "255.255.255.255") == 0) {
- cidr.u.in.addr = 0xffffffff;
- cidr.u.in.mask = 0xffffffff;
-
- } else {
- rc = ngx_ptocidr(net, &cidr);
-
- if (rc == NGX_ERROR) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "invalid network \"%V\"", net);
- return NGX_CONF_ERROR;
- }
-
- if (cidr.family != AF_INET) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "\"geo\" supports IPv4 only");
- return NGX_CONF_ERROR;
- }
-
- if (rc == NGX_DONE) {
- ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
- "low address bits of %V are meaningless",
- net);
- }
-
- cidr.u.in.addr = ntohl(cidr.u.in.addr);
- cidr.u.in.mask = ntohl(cidr.u.in.mask);
+ if (ngx_http_geo_cidr_value(cf, net, &cidr) != NGX_OK) {
+ return NGX_CONF_ERROR;
}
if (del) {
@@ -864,7 +906,7 @@
/* rc == NGX_BUSY */
- old = (ngx_http_variable_value_t *)
+ old = (ngx_http_variable_value_t *)
ngx_radix32tree_find(ctx->tree, cidr.u.in.addr & cidr.u.in.mask);
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
@@ -927,3 +969,64 @@
return val;
}
+
+
+static char *
+ngx_http_geo_add_proxy(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx,
+ ngx_cidr_t *cidr)
+{
+ ngx_in_cidr_t *c;
+
+ if (ctx->proxies == NULL) {
+ ctx->proxies = ngx_array_create(ctx->pool, 4, sizeof(ngx_in_cidr_t));
+ if (ctx->proxies == NULL) {
+ return NGX_CONF_ERROR;
+ }
+ }
+
+ c = ngx_array_push(ctx->proxies);
+ if (c == NULL) {
+ return NGX_CONF_ERROR;
+ }
+
+ c->addr = cidr->u.in.addr;
+ c->mask = cidr->u.in.mask;
+
+ return NGX_CONF_OK;
+}
+
+
+static ngx_int_t
+ngx_http_geo_cidr_value(ngx_conf_t *cf, ngx_str_t *net, ngx_cidr_t *cidr)
+{
+ ngx_int_t rc;
+
+ if (ngx_strcmp(net->data, "255.255.255.255") == 0) {
+ cidr->u.in.addr = 0xffffffff;
+ cidr->u.in.mask = 0xffffffff;
+
+ return NGX_OK;
+ }
+
+ rc = ngx_ptocidr(net, cidr);
+
+ if (rc == NGX_ERROR) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid network \"%V\"", net);
+ return NGX_ERROR;
+ }
+
+ if (cidr->family != AF_INET) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "\"geo\" supports IPv4 only");
+ return NGX_ERROR;
+ }
+
+ if (rc == NGX_DONE) {
+ ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
+ "low address bits of %V are meaningless", net);
+ }
+
+ cidr->u.in.addr = ntohl(cidr->u.in.addr);
+ cidr->u.in.mask = ntohl(cidr->u.in.mask);
+
+ return NGX_OK;
+}
|
[-]
[+]
|
Added |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_geoip_module.c
^
|
@@ -0,0 +1,428 @@
+
+/*
+ * Copyright (C) Igor Sysoev
+ */
+
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+#include <ngx_http.h>
+
+#include <GeoIP.h>
+#include <GeoIPCity.h>
+
+
+typedef struct {
+ GeoIP *country;
+ GeoIP *city;
+} ngx_http_geoip_conf_t;
+
+
+typedef struct {
+ ngx_str_t *name;
+ uintptr_t data;
+} ngx_http_geoip_var_t;
+
+
+typedef const char *(*ngx_http_geoip_variable_handler_pt)(GeoIP *, u_long addr);
+
+static ngx_int_t ngx_http_geoip_country_variable(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_geoip_city_variable(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_geoip_city_float_variable(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
+static GeoIPRecord *ngx_http_geoip_get_city_record(ngx_http_request_t *r);
+
+static ngx_int_t ngx_http_geoip_add_variables(ngx_conf_t *cf);
+static void *ngx_http_geoip_create_conf(ngx_conf_t *cf);
+static char *ngx_http_geoip_country(ngx_conf_t *cf, ngx_command_t *cmd,
+ void *conf);
+static char *ngx_http_geoip_city(ngx_conf_t *cf, ngx_command_t *cmd,
+ void *conf);
+static void ngx_http_geoip_cleanup(void *data);
+
+
+static ngx_command_t ngx_http_geoip_commands[] = {
+
+ { ngx_string("geoip_country"),
+ NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
+ ngx_http_geoip_country,
+ NGX_HTTP_MAIN_CONF_OFFSET,
+ 0,
+ NULL },
+
+ { ngx_string("geoip_city"),
+ NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
+ ngx_http_geoip_city,
+ NGX_HTTP_MAIN_CONF_OFFSET,
+ 0,
+ NULL },
+
+ ngx_null_command
+};
+
+
+static ngx_http_module_t ngx_http_geoip_module_ctx = {
+ ngx_http_geoip_add_variables, /* preconfiguration */
+ NULL, /* postconfiguration */
+
+ ngx_http_geoip_create_conf, /* create main configuration */
+ NULL, /* init main configuration */
+
+ NULL, /* create server configuration */
+ NULL, /* merge server configuration */
+
+ NULL, /* create location configuration */
+ NULL /* merge location configuration */
+};
+
+
+ngx_module_t ngx_http_geoip_module = {
+ NGX_MODULE_V1,
+ &ngx_http_geoip_module_ctx, /* module context */
+ ngx_http_geoip_commands, /* module directives */
+ NGX_HTTP_MODULE, /* module type */
+ NULL, /* init master */
+ NULL, /* init module */
+ NULL, /* init process */
+ NULL, /* init thread */
+ NULL, /* exit thread */
+ NULL, /* exit process */
+ NULL, /* exit master */
+ NGX_MODULE_V1_PADDING
+};
+
+
+static ngx_http_variable_t ngx_http_geoip_vars[] = {
+
+ { ngx_string("geoip_country_code"), NULL,
+ ngx_http_geoip_country_variable,
+ (uintptr_t) GeoIP_country_code_by_ipnum, 0, 0 },
+
+ { ngx_string("geoip_country_code3"), NULL,
+ ngx_http_geoip_country_variable,
+ (uintptr_t) GeoIP_country_code3_by_ipnum, 0, 0 },
+
+ { ngx_string("geoip_country_name"), NULL,
+ ngx_http_geoip_country_variable,
+ (uintptr_t) GeoIP_country_name_by_ipnum, 0, 0 },
+
+ { ngx_string("geoip_city_continent_code"), NULL,
+ ngx_http_geoip_city_variable,
+ offsetof(GeoIPRecord, continent_code), 0, 0 },
+
+ { ngx_string("geoip_city_country_code"), NULL,
+ ngx_http_geoip_city_variable,
+ offsetof(GeoIPRecord, country_code), 0, 0 },
+
+ { ngx_string("geoip_city_country_code3"), NULL,
+ ngx_http_geoip_city_variable,
+ offsetof(GeoIPRecord, country_code3), 0, 0 },
+
+ { ngx_string("geoip_city_country_name"), NULL,
+ ngx_http_geoip_city_variable,
+ offsetof(GeoIPRecord, country_name), 0, 0 },
+
+ { ngx_string("geoip_region"), NULL,
+ ngx_http_geoip_city_variable,
+ offsetof(GeoIPRecord, region), 0, 0 },
+
+ { ngx_string("geoip_city"), NULL,
+ ngx_http_geoip_city_variable,
+ offsetof(GeoIPRecord, city), 0, 0 },
+
+ { ngx_string("geoip_postal_code"), NULL,
+ ngx_http_geoip_city_variable,
+ offsetof(GeoIPRecord, postal_code), 0, 0 },
+
+ { ngx_string("geoip_latitude"), NULL,
+ ngx_http_geoip_city_float_variable,
+ offsetof(GeoIPRecord, latitude), 0, 0 },
+
+ { ngx_string("geoip_longitude"), NULL,
+ ngx_http_geoip_city_float_variable,
+ offsetof(GeoIPRecord, longitude), 0, 0 },
+
+ { ngx_null_string, NULL, NULL, 0, 0, 0 }
+};
+
+
+static ngx_int_t
+ngx_http_geoip_country_variable(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data)
+{
+ ngx_http_geoip_variable_handler_pt handler =
+ (ngx_http_geoip_variable_handler_pt) data;
+
+ u_long addr;
+ const char *val;
+ struct sockaddr_in *sin;
+ ngx_http_geoip_conf_t *gcf;
+
+ gcf = ngx_http_get_module_main_conf(r, ngx_http_geoip_module);
+
+ if (gcf->country == NULL) {
+ goto not_found;
+ }
+
+ if (r->connection->sockaddr->sa_family != AF_INET) {
+ goto not_found;
+ }
+
+ sin = (struct sockaddr_in *) r->connection->sockaddr;
+ addr = ntohl(sin->sin_addr.s_addr);
+
+ val = handler(gcf->country, addr);
+
+ if (val == NULL) {
+ goto not_found;
+ }
+
+ v->len = ngx_strlen(val);
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
+ v->data = (u_char *) val;
+
+ return NGX_OK;
+
+not_found:
+
+ v->not_found = 1;
+
+ return NGX_OK;
+}
+
+
+static ngx_int_t
+ngx_http_geoip_city_variable(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data)
+{
+ char *val;
+ size_t len;
+ GeoIPRecord *gr;
+
+ gr = ngx_http_geoip_get_city_record(r);
+ if (gr == NULL) {
+ goto not_found;
+ }
+
+ val = *(char **) ((char *) gr + data);
+ if (val == NULL) {
+ goto no_value;
+ }
+
+ len = ngx_strlen(val);
+ v->data = ngx_pnalloc(r->pool, len);
+
+ if (v->data == NULL) {
+ GeoIPRecord_delete(gr);
+ return NGX_ERROR;
+ }
+
+ ngx_memcpy(v->data, val, len);
+
+ v->len = len;
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
+
+ GeoIPRecord_delete(gr);
+
+ return NGX_OK;
+
+no_value:
+
+ GeoIPRecord_delete(gr);
+
+not_found:
+
+ v->not_found = 1;
+
+ return NGX_OK;
+}
+
+
+static ngx_int_t
+ngx_http_geoip_city_float_variable(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data)
+{
+ float val;
+ GeoIPRecord *gr;
+
+ gr = ngx_http_geoip_get_city_record(r);
+ if (gr == NULL) {
+ v->not_found = 1;
+ return NGX_OK;
+ }
+
+ v->data = ngx_pnalloc(r->pool, NGX_INT64_LEN + 5);
+ if (v->data == NULL) {
+ GeoIPRecord_delete(gr);
+ return NGX_ERROR;
+ }
+
+ val = *(float *) ((char *) gr + data);
+
+ v->len = ngx_sprintf(v->data, "%.4f", val) - v->data;
+
+ GeoIPRecord_delete(gr);
+
+ return NGX_OK;
+}
+
+
+static GeoIPRecord *
+ngx_http_geoip_get_city_record(ngx_http_request_t *r)
+{
+ u_long addr;
+ struct sockaddr_in *sin;
+ ngx_http_geoip_conf_t *gcf;
+
+ gcf = ngx_http_get_module_main_conf(r, ngx_http_geoip_module);
+
+ if (gcf->city && r->connection->sockaddr->sa_family == AF_INET) {
+
+ sin = (struct sockaddr_in *) r->connection->sockaddr;
+ addr = ntohl(sin->sin_addr.s_addr);
+
+ return GeoIP_record_by_ipnum(gcf->city, addr);
+ }
+
+ return NULL;
+}
+
+
+static ngx_int_t
+ngx_http_geoip_add_variables(ngx_conf_t *cf)
+{
+ ngx_http_variable_t *var, *v;
+
+ for (v = ngx_http_geoip_vars; v->name.len; v++) {
+ var = ngx_http_add_variable(cf, &v->name, v->flags);
+ if (var == NULL) {
+ return NGX_ERROR;
+ }
+
+ var->get_handler = v->get_handler;
+ var->data = v->data;
+ }
+
+ return NGX_OK;
+}
+
+
+static void *
+ngx_http_geoip_create_conf(ngx_conf_t *cf)
+{
+ ngx_pool_cleanup_t *cln;
+ ngx_http_geoip_conf_t *conf;
+
+ conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_geoip_conf_t));
+ if (conf == NULL) {
+ return NULL;
+ }
+
+ cln = ngx_pool_cleanup_add(cf->pool, 0);
+ if (cln == NULL) {
+ return NULL;
+ }
+
+ cln->handler = ngx_http_geoip_cleanup;
+ cln->data = conf;
+
+ return conf;
+}
+
+
+static char *
+ngx_http_geoip_country(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+{
+ ngx_http_geoip_conf_t *gcf = conf;
+
+ ngx_str_t *value;
+
+ if (gcf->country) {
+ return "is duplicate";
+ }
+
+ value = cf->args->elts;
+
+ gcf->country = GeoIP_open((char *) value[1].data, GEOIP_MEMORY_CACHE);
+
+ if (gcf->country == NULL) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "GeoIO_open(\"%V\") failed", &value[1]);
+
+ return NGX_CONF_ERROR;
+ }
+
+ switch (gcf->country->databaseType) {
+
+ case GEOIP_COUNTRY_EDITION:
+ case GEOIP_PROXY_EDITION:
+ case GEOIP_NETSPEED_EDITION:
+
+ return NGX_CONF_OK;
+
+ default:
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "invalid GeoIP database \"%V\" type:%d",
+ &value[1], gcf->country->databaseType);
+ return NGX_CONF_ERROR;
+ }
+}
+
+
+static char *
+ngx_http_geoip_city(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+{
+ ngx_http_geoip_conf_t *gcf = conf;
+
+ ngx_str_t *value;
+
+ if (gcf->city) {
+ return "is duplicate";
+ }
+
+ value = cf->args->elts;
+
+ gcf->city = GeoIP_open((char *) value[1].data, GEOIP_MEMORY_CACHE);
+
+ if (gcf->city == NULL) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "GeoIO_open(\"%V\") failed", &value[1]);
+
+ return NGX_CONF_ERROR;
+ }
+
+ switch (gcf->city->databaseType) {
+
+ case GEOIP_CITY_EDITION_REV0:
+ case GEOIP_CITY_EDITION_REV1:
+
+ return NGX_CONF_OK;
+
+ default:
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "invalid GeoIP City database \"%V\" type:%d",
+ &value[1], gcf->city->databaseType);
+ return NGX_CONF_ERROR;
+ }
+}
+
+
+static void
+ngx_http_geoip_cleanup(void *data)
+{
+ ngx_http_geoip_conf_t *gcf = data;
+
+ if (gcf->country) {
+ GeoIP_delete(gcf->country);
+ }
+
+ if (gcf->city) {
+ GeoIP_delete(gcf->city);
+ }
+}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_gzip_filter_module.c
^
|
@@ -246,17 +246,27 @@
|| (r->headers_out.status != NGX_HTTP_OK
&& r->headers_out.status != NGX_HTTP_FORBIDDEN
&& r->headers_out.status != NGX_HTTP_NOT_FOUND)
- || r->header_only
|| (r->headers_out.content_encoding
&& r->headers_out.content_encoding->value.len)
|| (r->headers_out.content_length_n != -1
&& r->headers_out.content_length_n < conf->min_length)
|| ngx_http_test_content_type(r, &conf->types) == NULL
- || ngx_http_gzip_ok(r) != NGX_OK)
+ || r->header_only)
{
return ngx_http_next_header_filter(r);
}
+ r->gzip_vary = 1;
+
+ if (!r->gzip_tested) {
+ if (ngx_http_gzip_ok(r) != NGX_OK) {
+ return ngx_http_next_header_filter(r);
+ }
+
+ } else if (!r->gzip_ok) {
+ return ngx_http_next_header_filter(r);
+ }
+
ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_gzip_ctx_t));
if (ctx == NULL) {
return NGX_ERROR;
@@ -1069,7 +1079,7 @@
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_gzip_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_gzip_static_module.c
^
|
@@ -89,13 +89,17 @@
return NGX_DECLINED;
}
- if (r->zero_in_uri) {
+ gzcf = ngx_http_get_module_loc_conf(r, ngx_http_gzip_static_module);
+
+ if (!gzcf->enable) {
return NGX_DECLINED;
}
- gzcf = ngx_http_get_module_loc_conf(r, ngx_http_gzip_static_module);
+ rc = ngx_http_gzip_ok(r);
- if (!gzcf->enable || ngx_http_gzip_ok(r) != NGX_OK) {
+ clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
+
+ if (!clcf->gzip_vary && rc != NGX_OK) {
return NGX_DECLINED;
}
@@ -116,8 +120,6 @@
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0,
"http filename: \"%s\"", path.data);
- clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
-
ngx_memzero(&of, sizeof(ngx_open_file_info_t));
of.directio = clcf->directio;
@@ -157,6 +159,12 @@
return NGX_DECLINED;
}
+ r->gzip_vary = 1;
+
+ if (rc != NGX_OK) {
+ return NGX_DECLINED;
+ }
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "http static fd: %d", of.fd);
if (of.is_dir) {
@@ -167,7 +175,7 @@
#if !(NGX_WIN32) /* the not regular files are probably Unix specific */
if (!of.is_file) {
- ngx_log_error(NGX_LOG_CRIT, log, ngx_errno,
+ ngx_log_error(NGX_LOG_CRIT, log, 0,
"\"%s\" is not a regular file", path.data);
return NGX_HTTP_NOT_FOUND;
@@ -251,7 +259,7 @@
conf = ngx_palloc(cf->pool, sizeof(ngx_http_gzip_static_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
conf->enable = NGX_CONF_UNSET;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_image_filter_module.c
^
|
@@ -40,6 +40,11 @@
ngx_uint_t height;
ngx_int_t jpeg_quality;
+ ngx_flag_t transparency;
+
+ ngx_http_complex_value_t *wcv;
+ ngx_http_complex_value_t *hcv;
+
size_t buffer_size;
} ngx_http_image_filter_conf_t;
@@ -53,8 +58,12 @@
ngx_uint_t width;
ngx_uint_t height;
+ ngx_uint_t max_width;
+ ngx_uint_t max_height;
+
ngx_uint_t phase;
ngx_uint_t type;
+ ngx_uint_t force;
} ngx_http_image_filter_ctx_t;
@@ -80,6 +89,9 @@
static u_char *ngx_http_image_out(ngx_http_request_t *r, ngx_uint_t type,
gdImagePtr img, int *size);
static void ngx_http_image_cleanup(void *data);
+static ngx_uint_t ngx_http_image_filter_get_value(ngx_http_request_t *r,
+ ngx_http_complex_value_t *cv, ngx_uint_t v);
+static ngx_uint_t ngx_http_image_filter_value(ngx_str_t *value);
static void *ngx_http_image_filter_create_conf(ngx_conf_t *cf);
@@ -106,6 +118,13 @@
offsetof(ngx_http_image_filter_conf_t, jpeg_quality),
NULL },
+ { ngx_string("image_filter_transparency"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
+ ngx_conf_set_flag_slot,
+ NGX_HTTP_LOC_CONF_OFFSET,
+ offsetof(ngx_http_image_filter_conf_t, transparency),
+ NULL },
+
{ ngx_string("image_filter_buffer"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_conf_set_size_slot,
@@ -454,7 +473,6 @@
static ngx_buf_t *
ngx_http_image_process(ngx_http_request_t *r)
{
- ngx_buf_t *b;
ngx_int_t rc;
ngx_http_image_filter_ctx_t *ctx;
ngx_http_image_filter_conf_t *conf;
@@ -468,20 +486,29 @@
conf = ngx_http_get_module_loc_conf(r, ngx_http_image_filter_module);
if (conf->filter == NGX_HTTP_IMAGE_SIZE) {
+ return ngx_http_image_json(r, rc == NGX_OK ? ctx : NULL);
+ }
- b = ngx_http_image_json(r, rc == NGX_OK ? ctx : NULL);
+ ctx->max_width = ngx_http_image_filter_get_value(r, conf->wcv, conf->width);
+ if (ctx->max_width == 0) {
+ return NULL;
+ }
- } else if (rc == NGX_OK
- && ctx->width <= conf->width
- && ctx->height <= conf->height)
- {
- b = ngx_http_image_asis(r, ctx);
+ ctx->max_height = ngx_http_image_filter_get_value(r, conf->hcv,
+ conf->height);
+ if (ctx->max_height == 0) {
+ return NULL;
+ }
- } else {
- b = ngx_http_image_resize(r, ctx);
+ if (rc == NGX_OK
+ && ctx->width <= ctx->max_width
+ && ctx->height <= ctx->max_height
+ && !ctx->force)
+ {
+ return ngx_http_image_asis(r, ctx);
}
- return b;
+ return ngx_http_image_resize(r, ctx);
}
@@ -576,6 +603,7 @@
ngx_http_image_size(ngx_http_request_t *r, ngx_http_image_filter_ctx_t *ctx)
{
u_char *p, *last;
+ size_t len, app;
ngx_uint_t width, height;
p = ctx->image;
@@ -586,26 +614,38 @@
p += 2;
last = ctx->image + ctx->length - 10;
+ width = 0;
+ height = 0;
+ app = 0;
while (p < last) {
if (p[0] == 0xff && p[1] != 0xff) {
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "JPEG: %02xd %02xd", *p, *(p + 1));
+ "JPEG: %02xd %02xd", p[0], p[1]);
p++;
- if (*p == 0xc0 || *p == 0xc1 || *p == 0xc2 || *p == 0xc3
- || *p == 0xc9 || *p == 0xca || *p == 0xcb)
+ if ((*p == 0xc0 || *p == 0xc1 || *p == 0xc2 || *p == 0xc3
+ || *p == 0xc9 || *p == 0xca || *p == 0xcb)
+ && (width == 0 || height == 0))
{
- goto found;
+ width = p[6] * 256 + p[7];
+ height = p[4] * 256 + p[5];
}
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"JPEG: %02xd %02xd", p[1], p[2]);
- p += p[1] * 256 + p[2];
+ len = p[1] * 256 + p[2];
+
+ if (*p >= 0xe1 && *p <= 0xef) {
+ /* application data, e.g., EXIF, Adobe XMP, etc. */
+ app += len;
+ }
+
+ p += len;
continue;
}
@@ -613,12 +653,16 @@
p++;
}
- return NGX_DECLINED;
-
- found:
+ if (width == 0 || height == 0) {
+ return NGX_DECLINED;
+ }
- width = p[6] * 256 + p[7];
- height = p[4] * 256 + p[5];
+ if (ctx->length / 20 < app) {
+ /* force conversion if application data consume more than 5% */
+ ctx->force = 1;
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+ "app data size: %uz", app);
+ }
break;
@@ -662,8 +706,9 @@
static ngx_buf_t *
ngx_http_image_resize(ngx_http_request_t *r, ngx_http_image_filter_ctx_t *ctx)
{
- int sx, sy, dx, dy, ox, oy,
- colors, transparent, size;
+ int sx, sy, dx, dy, ox, oy, size,
+ colors, palette, transparent,
+ red, green, blue;
u_char *out;
ngx_buf_t *b;
ngx_uint_t resize;
@@ -682,29 +727,54 @@
conf = ngx_http_get_module_loc_conf(r, ngx_http_image_filter_module);
- if ((ngx_uint_t) sx <= conf->width && (ngx_uint_t) sy <= conf->height) {
+ if (!ctx->force
+ && (ngx_uint_t) sx <= ctx->max_width
+ && (ngx_uint_t) sy <= ctx->max_height)
+ {
gdImageDestroy(src);
return ngx_http_image_asis(r, ctx);
}
colors = gdImageColorsTotal(src);
- transparent = gdImageGetTransparent(src);
+
+ if (colors && conf->transparency) {
+ transparent = gdImageGetTransparent(src);
+
+ if (transparent != -1) {
+ palette = colors;
+ red = gdImageRed(src, transparent);
+ green = gdImageGreen(src, transparent);
+ blue = gdImageBlue(src, transparent);
+
+ goto transparent;
+ }
+ }
+
+ palette = 0;
+ transparent = -1;
+ red = 0;
+ green = 0;
+ blue = 0;
+
+transparent:
+
+ gdImageColorTransparent(src, -1);
dx = sx;
dy = sy;
if (conf->filter == NGX_HTTP_IMAGE_RESIZE) {
- if ((ngx_uint_t) dx > conf->width) {
- dy = dy * conf->width / dx;
+ if ((ngx_uint_t) dx > ctx->max_width) {
+ dy = dy * ctx->max_width / dx;
dy = dy ? dy : 1;
- dx = conf->width;
+ dx = ctx->max_width;
}
- if ((ngx_uint_t) dy > conf->height) {
- dx = dx * conf->height / dy;
+ if ((ngx_uint_t) dy > ctx->max_height) {
+ dx = dx * ctx->max_height / dy;
dx = dx ? dx : 1;
- dy = conf->height;
+ dy = ctx->max_height;
}
resize = 1;
@@ -713,34 +783,44 @@
resize = 0;
- if ((ngx_uint_t) (dx * 100 / dy) < conf->width * 100 / conf->height) {
-
- if ((ngx_uint_t) dx > conf->width) {
- dy = dy * conf->width / dx;
+ if ((ngx_uint_t) (dx * 100 / dy)
+ < ctx->max_width * 100 / ctx->max_height)
+ {
+ if ((ngx_uint_t) dx > ctx->max_width) {
+ dy = dy * ctx->max_width / dx;
dy = dy ? dy : 1;
- dx = conf->width;
+ dx = ctx->max_width;
resize = 1;
}
} else {
- if ((ngx_uint_t) dy > conf->height) {
- dx = dx * conf->height / dy;
+ if ((ngx_uint_t) dy > ctx->max_height) {
+ dx = dx * ctx->max_height / dy;
dx = dx ? dx : 1;
- dy = conf->height;
+ dy = ctx->max_height;
resize = 1;
}
}
}
if (resize) {
- dst = ngx_http_image_new(r, dx, dy, colors);
+ dst = ngx_http_image_new(r, dx, dy, palette);
if (dst == NULL) {
gdImageDestroy(src);
return NULL;
}
+ if (colors == 0) {
+ gdImageSaveAlpha(dst, 1);
+ gdImageAlphaBlending(dst, 0);
+ }
+
gdImageCopyResampled(dst, src, 0, 0, 0, 0, dx, dy, sx, sy);
+ if (colors) {
+ gdImageTrueColorToPalette(dst, 1, 256);
+ }
+
gdImageDestroy(src);
} else {
@@ -751,15 +831,15 @@
src = dst;
- if ((ngx_uint_t) dx > conf->width) {
- ox = dx - conf->width;
+ if ((ngx_uint_t) dx > ctx->max_width) {
+ ox = dx - ctx->max_width;
} else {
ox = 0;
}
- if ((ngx_uint_t) dy > conf->height) {
- oy = dy - conf->height;
+ if ((ngx_uint_t) dy > ctx->max_height) {
+ oy = dy - ctx->max_height;
} else {
oy = 0;
@@ -781,13 +861,24 @@
"image crop: %d x %d @ %d x %d",
dx, dy, ox, oy);
+ if (colors == 0) {
+ gdImageSaveAlpha(dst, 1);
+ gdImageAlphaBlending(dst, 0);
+ }
+
gdImageCopy(dst, src, 0, 0, ox, oy, dx - ox, dy - oy);
+ if (colors) {
+ gdImageTrueColorToPalette(dst, 1, 256);
+ }
+
gdImageDestroy(src);
}
}
- gdImageColorTransparent(dst, transparent);
+ if (transparent != -1 && colors) {
+ gdImageColorTransparent(dst, gdImageColorExact(dst, red, green, blue));
+ }
out = ngx_http_image_out(r, ctx->type, dst, &size);
@@ -941,6 +1032,43 @@
}
+static ngx_uint_t
+ngx_http_image_filter_get_value(ngx_http_request_t *r,
+ ngx_http_complex_value_t *cv, ngx_uint_t v)
+{
+ ngx_str_t val;
+
+ if (cv == NULL) {
+ return v;
+ }
+
+ if (ngx_http_complex_value(r, cv, &val) != NGX_OK) {
+ return 0;
+ }
+
+ return ngx_http_image_filter_value(&val);
+}
+
+
+static ngx_uint_t
+ngx_http_image_filter_value(ngx_str_t *value)
+{
+ ngx_int_t n;
+
+ if (value->len == 1 && value->data[0] == '-') {
+ return (ngx_uint_t) -1;
+ }
+
+ n = ngx_atoi(value->data, value->len);
+
+ if (n > 0) {
+ return (ngx_uint_t) n;
+ }
+
+ return 0;
+}
+
+
static void *
ngx_http_image_filter_create_conf(ngx_conf_t *cf)
{
@@ -948,11 +1076,12 @@
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_image_filter_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
conf->filter = NGX_CONF_UNSET_UINT;
conf->jpeg_quality = NGX_CONF_UNSET;
+ conf->transparency = NGX_CONF_UNSET;
conf->buffer_size = NGX_CONF_UNSET_SIZE;
return conf;
@@ -974,12 +1103,16 @@
conf->filter = prev->filter;
conf->width = prev->width;
conf->height = prev->height;
+ conf->wcv = prev->wcv;
+ conf->hcv = prev->hcv;
}
}
/* 75 is libjpeg default quality */
ngx_conf_merge_value(conf->jpeg_quality, prev->jpeg_quality, 75);
+ ngx_conf_merge_value(conf->transparency, prev->transparency, 1);
+
ngx_conf_merge_size_value(conf->buffer_size, prev->buffer_size,
1 * 1024 * 1024);
@@ -992,9 +1125,11 @@
{
ngx_http_image_filter_conf_t *imcf = conf;
- ngx_str_t *value;
- ngx_int_t n;
- ngx_uint_t i;
+ ngx_str_t *value;
+ ngx_int_t n;
+ ngx_uint_t i;
+ ngx_http_complex_value_t cv;
+ ngx_http_compile_complex_value_t ccv;
value = cf->args->elts;
@@ -1027,32 +1162,60 @@
goto failed;
}
- i++;
+ ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
- if (value[i].len == 1 && value[i].data[0] == '-') {
- imcf->width = (ngx_uint_t) -1;
+ ccv.cf = cf;
+ ccv.value = &value[++i];
+ ccv.complex_value = &cv;
- } else {
- n = ngx_atoi(value[i].data, value[i].len);
- if (n == NGX_ERROR) {
+ if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
+ return NGX_CONF_ERROR;
+ }
+
+ if (cv.lengths == NULL) {
+ n = ngx_http_image_filter_value(&value[i]);
+
+ if (n == 0) {
goto failed;
}
imcf->width = (ngx_uint_t) n;
+
+ } else {
+ imcf->wcv = ngx_palloc(cf->pool, sizeof(ngx_http_complex_value_t));
+ if (imcf->wcv == NULL) {
+ return NGX_CONF_ERROR;
+ }
+
+ *imcf->wcv = cv;
}
- i++;
+ ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
- if (value[i].len == 1 && value[i].data[0] == '-') {
- imcf->height = (ngx_uint_t) -1;
+ ccv.cf = cf;
+ ccv.value = &value[++i];
+ ccv.complex_value = &cv;
- } else {
- n = ngx_atoi(value[i].data, value[i].len);
- if (n == NGX_ERROR) {
+ if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
+ return NGX_CONF_ERROR;
+ }
+
+ if (cv.lengths == NULL) {
+ n = ngx_http_image_filter_value(&value[i]);
+
+ if (n == 0) {
goto failed;
}
imcf->height = (ngx_uint_t) n;
+
+ } else {
+ imcf->hcv = ngx_palloc(cf->pool, sizeof(ngx_http_complex_value_t));
+ if (imcf->hcv == NULL) {
+ return NGX_CONF_ERROR;
+ }
+
+ *imcf->hcv = cv;
}
return NGX_CONF_OK;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_index_module.c
^
|
@@ -116,10 +116,6 @@
return NGX_DECLINED;
}
- if (r->zero_in_uri) {
- return NGX_DECLINED;
- }
-
ilcf = ngx_http_get_module_loc_conf(r, ngx_http_index_module);
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
@@ -222,7 +218,10 @@
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
- if (of.err == NGX_ENOTDIR || of.err == NGX_EACCES) {
+ if (of.err == NGX_ENOTDIR
+ || of.err == NGX_ENAMETOOLONG
+ || of.err == NGX_EACCES)
+ {
return ngx_http_index_error(r, clcf, path.data, of.err);
}
@@ -366,7 +365,7 @@
conf = ngx_palloc(cf->pool, sizeof(ngx_http_index_loc_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
conf->indices = NULL;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_limit_req_module.c
^
|
@@ -42,7 +42,10 @@
ngx_shm_zone_t *shm_zone;
/* integer value, 1 corresponds to 0.001 r/s */
ngx_uint_t burst;
- ngx_uint_t nodelay;/* unsigned nodelay:1 */
+ ngx_uint_t limit_log_level;
+ ngx_uint_t delay_log_level;
+
+ ngx_uint_t nodelay; /* unsigned nodelay:1 */
} ngx_http_limit_req_conf_t;
@@ -62,6 +65,15 @@
static ngx_int_t ngx_http_limit_req_init(ngx_conf_t *cf);
+static ngx_conf_enum_t ngx_http_limit_req_log_levels[] = {
+ { ngx_string("info"), NGX_LOG_INFO },
+ { ngx_string("notice"), NGX_LOG_NOTICE },
+ { ngx_string("warn"), NGX_LOG_WARN },
+ { ngx_string("error"), NGX_LOG_ERR },
+ { ngx_null_string, 0 }
+};
+
+
static ngx_command_t ngx_http_limit_req_commands[] = {
{ ngx_string("limit_req_zone"),
@@ -78,6 +90,13 @@
0,
NULL },
+ { ngx_string("limit_req_log_level"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+ ngx_conf_set_enum_slot,
+ NGX_HTTP_LOC_CONF_OFFSET,
+ offsetof(ngx_http_limit_req_conf_t, limit_log_level),
+ &ngx_http_limit_req_log_levels },
+
ngx_null_command
};
@@ -181,12 +200,12 @@
}
ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "limit_req: %i %ui.%03ui", rc, excess / 1000, excess % 1000);
+ "limit_req: %i %ui.%03ui", rc, excess / 1000, excess % 1000);
if (rc == NGX_BUSY) {
ngx_shmtx_unlock(&ctx->shpool->mutex);
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+ ngx_log_error(lrcf->limit_log_level, r->connection->log, 0,
"limiting requests, excess: %ui.%03ui by zone \"%V\"",
excess / 1000, excess % 1000, &lrcf->shm_zone->shm.name);
@@ -200,7 +219,7 @@
return NGX_DECLINED;
}
- ngx_log_error(NGX_LOG_WARN, r->connection->log, 0,
+ ngx_log_error(lrcf->delay_log_level, r->connection->log, 0,
"delaying request, excess: %ui.%03ui, by zone \"%V\"",
excess / 1000, excess % 1000, &lrcf->shm_zone->shm.name);
@@ -263,8 +282,23 @@
static void
ngx_http_limit_req_delay(ngx_http_request_t *r)
{
+ ngx_event_t *wev;
+
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "limit_req delay");
+ "limit_req delay");
+
+ wev = r->connection->write;
+
+ if (!wev->timedout) {
+
+ if (ngx_handle_write_event(wev, 0) != NGX_OK) {
+ ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+ }
+
+ return;
+ }
+
+ wev->timedout = 0;
if (ngx_handle_read_event(r->connection->read, 0) != NGX_OK) {
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
@@ -368,15 +402,16 @@
excess = 0;
}
+ if ((ngx_uint_t) excess > lrcf->burst) {
+ *lrp = lr;
+ return NGX_BUSY;
+ }
+
lr->excess = excess;
lr->last = now;
*lrp = lr;
- if ((ngx_uint_t) excess > lrcf->burst) {
- return NGX_BUSY;
- }
-
if (excess) {
return NGX_AGAIN;
}
@@ -522,7 +557,7 @@
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_limit_req_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
@@ -533,6 +568,8 @@
* conf->nodelay = 0;
*/
+ conf->limit_log_level = NGX_CONF_UNSET_UINT;
+
return conf;
}
@@ -547,6 +584,12 @@
*conf = *prev;
}
+ ngx_conf_merge_uint_value(conf->limit_log_level, prev->limit_log_level,
+ NGX_LOG_ERR);
+
+ conf->delay_log_level = (conf->limit_log_level == NGX_LOG_INFO) ?
+ NGX_LOG_INFO : conf->limit_log_level + 1;
+
return NGX_CONF_OK;
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_limit_zone_module.c
^
|
@@ -33,6 +33,7 @@
typedef struct {
ngx_shm_zone_t *shm_zone;
ngx_uint_t conn;
+ ngx_uint_t log_level;
} ngx_http_limit_zone_conf_t;
@@ -48,6 +49,15 @@
static ngx_int_t ngx_http_limit_zone_init(ngx_conf_t *cf);
+static ngx_conf_enum_t ngx_http_limit_conn_log_levels[] = {
+ { ngx_string("info"), NGX_LOG_INFO },
+ { ngx_string("notice"), NGX_LOG_NOTICE },
+ { ngx_string("warn"), NGX_LOG_WARN },
+ { ngx_string("error"), NGX_LOG_ERR },
+ { ngx_null_string, 0 }
+};
+
+
static ngx_command_t ngx_http_limit_zone_commands[] = {
{ ngx_string("limit_zone"),
@@ -64,6 +74,13 @@
0,
NULL },
+ { ngx_string("limit_conn_log_level"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+ ngx_conf_set_enum_slot,
+ NGX_HTTP_LOC_CONF_OFFSET,
+ offsetof(ngx_http_limit_zone_conf_t, log_level),
+ &ngx_http_limit_conn_log_levels },
+
ngx_null_command
};
@@ -189,7 +206,7 @@
ngx_shmtx_unlock(&shpool->mutex);
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+ ngx_log_error(lzcf->log_level, r->connection->log, 0,
"limiting connections by zone \"%V\"",
&lzcf->shm_zone->shm.name);
@@ -381,7 +398,7 @@
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_limit_zone_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
@@ -391,6 +408,8 @@
* conf->conn = 0;
*/
+ conf->log_level = NGX_CONF_UNSET_UINT;
+
return conf;
}
@@ -405,6 +424,8 @@
*conf = *prev;
}
+ ngx_conf_merge_uint_value(conf->log_level, prev->log_level, NGX_LOG_ERR);
+
return NGX_CONF_OK;
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_log_module.c
^
|
@@ -542,8 +542,25 @@
static u_char *
ngx_http_log_status(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op)
{
- return ngx_sprintf(buf, "%ui",
- r->err_status ? r->err_status : r->headers_out.status);
+ ngx_uint_t status;
+
+ if (r->err_status) {
+ status = r->err_status;
+
+ } else if (r->headers_out.status) {
+ status = r->headers_out.status;
+
+ } else if (r->http_version == NGX_HTTP_VERSION_9) {
+ *buf++ = '0';
+ *buf++ = '0';
+ *buf++ = '9';
+ return buf;
+
+ } else {
+ status = 0;
+ }
+
+ return ngx_sprintf(buf, "%ui", status);
}
@@ -676,7 +693,7 @@
/* find the number of the characters to be escaped */
- n = 0;
+ n = 0;
for (i = 0; i < size; i++) {
if (escape[*src >> 5] & (1 << (*src & 0x1f))) {
@@ -714,18 +731,18 @@
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_log_main_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
if (ngx_array_init(&conf->formats, cf->pool, 4, sizeof(ngx_http_log_fmt_t))
!= NGX_OK)
{
- return NGX_CONF_ERROR;
+ return NULL;
}
fmt = ngx_array_push(&conf->formats);
if (fmt == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
fmt->name.len = sizeof("combined") - 1;
@@ -735,7 +752,7 @@
fmt->ops = ngx_array_create(cf->pool, 16, sizeof(ngx_http_log_op_t));
if (fmt->ops == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
return conf;
@@ -749,7 +766,7 @@
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_log_loc_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
conf->open_file_cache = NGX_CONF_UNSET_PTR;
@@ -837,7 +854,13 @@
if (ngx_strcmp(value[1].data, "off") == 0) {
llcf->off = 1;
- return NGX_CONF_OK;
+ if (cf->args->nelts == 2) {
+ return NGX_CONF_OK;
+ }
+
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "invalid parameter \"%V\"", &value[2]);
+ return NGX_CONF_ERROR;
}
if (llcf->logs == NULL) {
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_map_module.c
^
|
@@ -160,7 +160,7 @@
mcf = ngx_palloc(cf->pool, sizeof(ngx_http_map_conf_t));
if (mcf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
mcf->hash_max_size = NGX_CONF_UNSET_UINT;
@@ -337,7 +337,7 @@
first = (ngx_hash_key_t *) one;
second = (ngx_hash_key_t *) two;
- return ngx_strcmp(first->key.data, second->key.data);
+ return ngx_dns_strcmp(first->key.data, second->key.data);
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_memcached_module.c
^
|
@@ -176,24 +176,19 @@
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
- mlcf = ngx_http_get_module_loc_conf(r, ngx_http_memcached_module);
-
- u = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_t));
- if (u == NULL) {
+ if (ngx_http_upstream_create(r) != NGX_OK) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
+ u = r->upstream;
+
u->schema.len = sizeof("memcached://") - 1;
u->schema.data = (u_char *) "memcached://";
- u->peer.log = r->connection->log;
- u->peer.log_error = NGX_ERROR_ERR;
-#if (NGX_THREADS)
- u->peer.lock = &r->connection->lock;
-#endif
-
u->output.tag = (ngx_buf_tag_t) &ngx_http_memcached_module;
+ mlcf = ngx_http_get_module_loc_conf(r, ngx_http_memcached_module);
+
u->conf = &mlcf->upstream;
u->create_request = ngx_http_memcached_create_request;
@@ -202,8 +197,6 @@
u->abort_request = ngx_http_memcached_abort_request;
u->finalize_request = ngx_http_memcached_finalize_request;
- r->upstream = u;
-
ctx = ngx_palloc(r->pool, sizeof(ngx_http_memcached_ctx_t));
if (ctx == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
@@ -430,15 +423,20 @@
if (ngx_strncmp(b->last,
ngx_http_memcached_end + NGX_HTTP_MEMCACHED_END - ctx->rest,
- ctx->rest)
+ bytes)
!= 0)
{
ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0,
"memcached sent invalid trailer");
+
+ u->length = 0;
+ ctx->rest = 0;
+
+ return NGX_OK;
}
- u->length = 0;
- ctx->rest = 0;
+ u->length -= bytes;
+ ctx->rest -= bytes;
return NGX_OK;
}
@@ -513,7 +511,7 @@
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_memcached_loc_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_not_modified_filter_module.c
^
|
@@ -88,6 +88,11 @@
ngx_http_clear_content_length(r);
ngx_http_clear_accept_ranges(r);
+ if (r->headers_out.content_encoding) {
+ r->headers_out.content_encoding->hash = 0;
+ r->headers_out.content_encoding = NULL;
+ }
+
return ngx_http_next_header_filter(r);
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_proxy_module.c
^
|
@@ -357,6 +357,13 @@
0,
&ngx_http_proxy_module },
+ { ngx_string("proxy_no_cache"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
+ ngx_http_no_cache_set_slot,
+ NGX_HTTP_LOC_CONF_OFFSET,
+ offsetof(ngx_http_proxy_loc_conf_t, upstream.no_cache),
+ NULL },
+
{ ngx_string("proxy_cache_valid"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
ngx_http_file_cache_valid_set_slot,
@@ -530,7 +537,7 @@
{ ngx_string("Expect"), ngx_string("") },
{ ngx_string("If-Modified-Since"), ngx_string("") },
{ ngx_string("If-Unmodified-Since"), ngx_string("") },
- { ngx_string("If-Match-None"), ngx_string("") },
+ { ngx_string("If-None-Match"), ngx_string("") },
{ ngx_string("If-Match"), ngx_string("") },
{ ngx_string("Range"), ngx_string("") },
{ ngx_string("If-Range"), ngx_string("") },
@@ -590,13 +597,10 @@
ngx_http_proxy_ctx_t *ctx;
ngx_http_proxy_loc_conf_t *plcf;
- u = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_t));
- if (u == NULL) {
+ if (ngx_http_upstream_create(r) != NGX_OK) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
- r->upstream = u;
-
ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_proxy_ctx_t));
if (ctx == NULL) {
return NGX_ERROR;
@@ -606,6 +610,8 @@
plcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module);
+ u = r->upstream;
+
if (plcf->proxy_lengths == 0) {
ctx->vars = plcf->vars;
u->schema = plcf->vars.schema;
@@ -619,12 +625,6 @@
}
}
- u->peer.log = r->connection->log;
- u->peer.log_error = NGX_ERROR_ERR;
-#if (NGX_THREADS)
- u->peer.lock = &r->connection->lock;
-#endif
-
u->output.tag = (ngx_buf_tag_t) &ngx_http_proxy_module;
u->conf = &plcf->upstream;
@@ -637,6 +637,7 @@
u->process_header = ngx_http_proxy_process_status_line;
u->abort_request = ngx_http_proxy_abort_request;
u->finalize_request = ngx_http_proxy_finalize_request;
+ r->state = 0;
if (plcf->redirects) {
u->rewrite_redirect = ngx_http_proxy_rewrite_redirect;
@@ -724,17 +725,22 @@
return NGX_ERROR;
}
- if (url.uri.len && url.uri.data[0] == '?') {
- p = ngx_pnalloc(r->pool, url.uri.len + 1);
- if (p == NULL) {
- return NGX_ERROR;
- }
+ if (url.uri.len) {
+ if (url.uri.data[0] == '?') {
+ p = ngx_pnalloc(r->pool, url.uri.len + 1);
+ if (p == NULL) {
+ return NGX_ERROR;
+ }
- *p++ = '/';
- ngx_memcpy(p, url.uri.data, url.uri.len);
+ *p++ = '/';
+ ngx_memcpy(p, url.uri.data, url.uri.len);
- url.uri.len++;
- url.uri.data = p - 1;
+ url.uri.len++;
+ url.uri.data = p - 1;
+ }
+
+ } else {
+ url.uri = r->unparsed_uri;
}
ctx->vars.key_start = u->schema;
@@ -1193,6 +1199,7 @@
ctx->status_end = NULL;
r->upstream->process_header = ngx_http_proxy_process_status_line;
+ r->state = 0;
return NGX_OK;
}
@@ -1225,7 +1232,6 @@
if (r->cache) {
r->http_version = NGX_HTTP_VERSION_9;
- u->headers_in.status_n = NGX_HTTP_OK;
return NGX_OK;
}
@@ -1241,7 +1247,6 @@
#endif
r->http_version = NGX_HTTP_VERSION_9;
- u->headers_in.status_n = NGX_HTTP_OK;
u->state->status = NGX_HTTP_OK;
return NGX_OK;
@@ -1884,7 +1889,7 @@
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_proxy_loc_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
@@ -1910,7 +1915,7 @@
* conf->body_set_len = NULL;
* conf->body_set = NULL;
* conf->body_source = { 0, NULL };
- * conf->rewrite_locations = NULL;
+ * conf->redirects = NULL;
*/
conf->upstream.store = NGX_CONF_UNSET;
@@ -1935,6 +1940,7 @@
#if (NGX_HTTP_CACHE)
conf->upstream.cache = NGX_CONF_UNSET_PTR;
conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT;
+ conf->upstream.no_cache = NGX_CONF_UNSET_PTR;
conf->upstream.cache_valid = NGX_CONF_UNSET_PTR;
#endif
@@ -2159,6 +2165,9 @@
|NGX_HTTP_UPSTREAM_FT_OFF;
}
+ ngx_conf_merge_ptr_value(conf->upstream.no_cache,
+ prev->upstream.no_cache, NULL);
+
ngx_conf_merge_ptr_value(conf->upstream.cache_valid,
prev->upstream.cache_valid, NULL);
@@ -2592,6 +2601,12 @@
clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
+ clcf->handler = ngx_http_proxy_handler;
+
+ if (clcf->name.data[clcf->name.len - 1] == '/') {
+ clcf->auto_redirect = 1;
+ }
+
value = cf->args->elts;
url = &value[1];
@@ -2620,8 +2635,6 @@
}
#endif
- clcf->handler = ngx_http_proxy_handler;
-
return NGX_CONF_OK;
}
@@ -2668,8 +2681,6 @@
ngx_http_proxy_set_vars(&u, &plcf->vars);
- clcf->handler = ngx_http_proxy_handler;
-
plcf->location = clcf->name;
if (clcf->named
@@ -2693,10 +2704,6 @@
plcf->url = *url;
- if (clcf->name.data[clcf->name.len - 1] == '/') {
- clcf->auto_redirect = 1;
- }
-
return NGX_CONF_OK;
}
@@ -2753,9 +2760,16 @@
}
if (ngx_strcmp(value[1].data, "default") == 0) {
+ if (plcf->proxy_lengths) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "\"proxy_redirect default\" may not be used "
+ "with \"proxy_pass\" directive with variables");
+ return NGX_CONF_ERROR;
+ }
+
if (plcf->url.data == NULL) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "\"proxy_rewrite_location default\" must go "
+ "\"proxy_redirect default\" must go "
"after the \"proxy_pass\" directive");
return NGX_CONF_ERROR;
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_random_index_module.c
^
|
@@ -86,10 +86,6 @@
return NGX_DECLINED;
}
- if (r->zero_in_uri) {
- return NGX_DECLINED;
- }
-
if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD|NGX_HTTP_POST))) {
return NGX_DECLINED;
}
@@ -175,7 +171,7 @@
len = ngx_de_namelen(&dir);
- if (!dir.valid_type) {
+ if (dir.type == 0 || ngx_de_is_link(&dir)) {
/* 1 byte for '/' and 1 byte for terminating '\0' */
@@ -280,7 +276,7 @@
conf = ngx_palloc(cf->pool, sizeof(ngx_http_random_index_loc_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
conf->enable = NGX_CONF_UNSET;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_realip_module.c
^
|
@@ -360,7 +360,7 @@
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_realip_loc_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_referer_module.c
^
|
@@ -124,18 +124,27 @@
len = r->headers_in.referer->value.len;
ref = r->headers_in.referer->value.data;
- if (len < sizeof("http://i.ru") - 1
- || (ngx_strncasecmp(ref, (u_char *) "http://", 7) != 0))
- {
- if (rlcf->blocked_referer) {
- goto valid;
+ if (len >= sizeof("http://i.ru") - 1) {
+ last = ref + len;
+
+ if (ngx_strncasecmp(ref, (u_char *) "http://", 7) == 0) {
+ ref += 7;
+ goto valid_scheme;
+
+ } else if (ngx_strncasecmp(ref, (u_char *) "https://", 8) == 0) {
+ ref += 8;
+ goto valid_scheme;
}
+ }
- goto invalid;
+ if (rlcf->blocked_referer) {
+ goto valid;
}
- last = ref + len;
- ref += 7;
+ goto invalid;
+
+valid_scheme:
+
i = 0;
key = 0;
@@ -221,7 +230,7 @@
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_referer_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
#if (NGX_PCRE)
@@ -506,6 +515,11 @@
ngx_regex_elt_t *re;
u_char errstr[NGX_MAX_CONF_ERRSTR];
+ if (name->len == 1) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "empty regex in \"%V\"", name);
+ return NGX_CONF_ERROR;
+ }
+
if (rlcf->regex == NGX_CONF_UNSET_PTR) {
rlcf->regex = ngx_array_create(cf->pool, 2, sizeof(ngx_regex_elt_t));
if (rlcf->regex == NULL) {
@@ -562,5 +576,5 @@
first = (ngx_hash_key_t *) one;
second = (ngx_hash_key_t *) two;
- return ngx_strcmp(first->key.data, second->key.data);
+ return ngx_dns_strcmp(first->key.data, second->key.data);
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_rewrite_module.c
^
|
@@ -220,7 +220,7 @@
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_rewrite_loc_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
conf->stack_size = NGX_CONF_UNSET_UINT;
@@ -340,13 +340,10 @@
last = 0;
- if (ngx_strncmp(value[2].data, "http://", sizeof("http://") - 1) == 0) {
- regex->status = NGX_HTTP_MOVED_TEMPORARILY;
- regex->redirect = 1;
- last = 1;
- }
-
- if (ngx_strncmp(value[2].data, "https://", sizeof("https://") - 1) == 0) {
+ if (ngx_strncmp(value[2].data, "http://", sizeof("http://") - 1) == 0
+ || ngx_strncmp(value[2].data, "https://", sizeof("https://") - 1) == 0
+ || ngx_strncmp(value[2].data, "$scheme", sizeof("$scheme") - 1) == 0)
+ {
regex->status = NGX_HTTP_MOVED_TEMPORARILY;
regex->redirect = 1;
last = 1;
@@ -446,7 +443,7 @@
return NGX_CONF_ERROR;
}
- *code = (uintptr_t) NULL;
+ *code = NULL;
}
regex->next = (u_char *) lcf->codes->elts + lcf->codes->nelts
@@ -568,7 +565,7 @@
if_code = ngx_array_push_n(lcf->codes, sizeof(ngx_http_script_if_code_t));
if (if_code == NULL) {
- return NULL;
+ return NGX_CONF_ERROR;
}
if_code->code = ngx_http_script_if_code;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_secure_link_module.c
^
|
@@ -152,7 +152,7 @@
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_secure_link_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_ssi_filter_module.c
^
|
@@ -14,7 +14,6 @@
#define NGX_HTTP_SSI_ADD_PREFIX 1
#define NGX_HTTP_SSI_ADD_ZERO 2
-#define NGX_HTTP_SSI_EXPR_TEST 4
typedef struct {
@@ -71,6 +70,8 @@
static ngx_int_t ngx_http_ssi_output(ngx_http_request_t *r,
ngx_http_ssi_ctx_t *ctx);
+static void ngx_http_ssi_buffered(ngx_http_request_t *r,
+ ngx_http_ssi_ctx_t *ctx);
static ngx_int_t ngx_http_ssi_parse(ngx_http_request_t *r,
ngx_http_ssi_ctx_t *ctx);
static ngx_str_t *ngx_http_ssi_get_variable(ngx_http_request_t *r,
@@ -360,6 +361,7 @@
if (r == r->main) {
ngx_http_clear_content_length(r);
ngx_http_clear_last_modified(r);
+ ngx_http_clear_accept_ranges(r);
}
return ngx_http_next_header_filter(r);
@@ -797,6 +799,7 @@
}
if (rc == NGX_DONE || rc == NGX_AGAIN || rc == NGX_ERROR) {
+ ngx_http_ssi_buffered(r, ctx);
return rc;
}
}
@@ -949,14 +952,21 @@
}
}
+ ngx_http_ssi_buffered(r, ctx);
+
+ return rc;
+}
+
+
+static void
+ngx_http_ssi_buffered(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx)
+{
if (ctx->in || ctx->buf) {
r->buffered |= NGX_HTTP_SSI_BUFFERED;
} else {
r->buffered &= ~NGX_HTTP_SSI_BUFFERED;
}
-
- return rc;
}
@@ -1700,8 +1710,7 @@
val = ngx_http_ssi_get_variable(r, &var, key);
if (val == NULL) {
- vv = ngx_http_get_variable(r, &var, key,
- flags & NGX_HTTP_SSI_EXPR_TEST);
+ vv = ngx_http_get_variable(r, &var, key);
if (vv == NULL) {
return NGX_ERROR;
}
@@ -1907,7 +1916,7 @@
args.len = 0;
args.data = NULL;
- flags = 0;
+ flags = NGX_HTTP_LOG_UNSAFE;
if (ngx_http_parse_unsafe_uri(r, uri, &args, &flags) != NGX_OK) {
return NGX_HTTP_SSI_ERROR;
@@ -2060,9 +2069,9 @@
out = data;
if (!r->header_sent) {
- if (ngx_http_set_content_type(r) != NGX_OK) {
- return NGX_ERROR;
- }
+ r->headers_out.content_type_len =
+ r->parent->headers_out.content_type_len;
+ r->headers_out.content_type = r->parent->headers_out.content_type;
if (ngx_http_send_header(r) == NGX_ERROR) {
return NGX_ERROR;
@@ -2109,7 +2118,7 @@
value = ngx_http_ssi_get_variable(r, var, key);
if (value == NULL) {
- vv = ngx_http_get_variable(r, var, key, 1);
+ vv = ngx_http_get_variable(r, var, key);
if (vv == NULL) {
return NGX_HTTP_SSI_ERROR;
@@ -2160,10 +2169,9 @@
}
}
- switch (ctx->encoding) {
+ p = value->data;
- case NGX_HTTP_SSI_NO_ENCODING:
- break;
+ switch (ctx->encoding) {
case NGX_HTTP_SSI_URL_ENCODING:
len = 2 * ngx_escape_uri(NULL, value->data, value->len,
@@ -2176,11 +2184,9 @@
}
(void) ngx_escape_uri(p, value->data, value->len, NGX_ESCAPE_HTML);
-
- value->len += len;
- value->data = p;
}
+ len += value->len;
break;
case NGX_HTTP_SSI_ENTITY_ENCODING:
@@ -2193,11 +2199,13 @@
}
(void) ngx_escape_html(p, value->data, value->len);
-
- value->len += len;
- value->data = p;
}
+ len += value->len;
+ break;
+
+ default: /* NGX_HTTP_SSI_NO_ENCODING */
+ len = value->len;
break;
}
@@ -2212,8 +2220,8 @@
}
b->memory = 1;
- b->pos = value->data;
- b->last = value->data + value->len;
+ b->pos = p;
+ b->last = p + len;
cl->buf = b;
cl->next = NULL;
@@ -2361,7 +2369,7 @@
p++;
}
- flags = (p == last) ? NGX_HTTP_SSI_EXPR_TEST : 0;
+ flags = 0;
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"left: \"%V\"", &left);
@@ -2613,8 +2621,7 @@
return NGX_ERROR;
}
- v->len = ngx_sprintf(v->data, "%T", tp->sec + (gmt ? 0 : tp->gmtoff))
- - v->data;
+ v->len = ngx_sprintf(v->data, "%T", tp->sec) - v->data;
return NGX_OK;
}
@@ -2689,14 +2696,14 @@
smcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_ssi_main_conf_t));
if (smcf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
smcf->commands.pool = cf->pool;
smcf->commands.temp_pool = cf->temp_pool;
if (ngx_hash_keys_array_init(&smcf->commands, NGX_HASH_SMALL) != NGX_OK) {
- return NGX_CONF_ERROR;
+ return NULL;
}
return smcf;
@@ -2736,7 +2743,7 @@
slcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_ssi_loc_conf_t));
if (slcf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_ssl_module.c
^
|
@@ -13,7 +13,7 @@
ngx_pool_t *pool, ngx_str_t *s);
-#define NGX_DEFAULT_CIPHERS "ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP"
+#define NGX_DEFAULT_CIPHERS "HIGH:!ADH:!MD5"
static ngx_int_t ngx_http_ssl_static_variable(ngx_http_request_t *r,
@@ -31,15 +31,6 @@
static char *ngx_http_ssl_session_cache(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
-#if !defined (SSL_OP_CIPHER_SERVER_PREFERENCE)
-
-static char *ngx_http_ssl_nosupported(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf);
-
-static char ngx_http_ssl_openssl097[] = "OpenSSL 0.9.7 and higher";
-
-#endif
-
static ngx_conf_bitmask_t ngx_http_ssl_protocols[] = {
{ ngx_string("SSLv2"), NGX_SSL_SSLv2 },
@@ -52,7 +43,7 @@
static ngx_conf_enum_t ngx_http_ssl_verify[] = {
{ ngx_string("off"), 0 },
{ ngx_string("on"), 1 },
- { ngx_string("ask"), 2 },
+ { ngx_string("optional"), 2 },
{ ngx_null_string, 0 }
};
@@ -124,14 +115,10 @@
{ ngx_string("ssl_prefer_server_ciphers"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG,
-#ifdef SSL_OP_CIPHER_SERVER_PREFERENCE
ngx_conf_set_flag_slot,
NGX_HTTP_SRV_CONF_OFFSET,
offsetof(ngx_http_ssl_srv_conf_t, prefer_server_ciphers),
NULL },
-#else
- ngx_http_ssl_nosupported, 0, 0, ngx_http_ssl_openssl097 },
-#endif
{ ngx_string("ssl_session_cache"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE12,
@@ -147,6 +134,13 @@
offsetof(ngx_http_ssl_srv_conf_t, session_timeout),
NULL },
+ { ngx_string("ssl_crl"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
+ ngx_conf_set_str_slot,
+ NGX_HTTP_SRV_CONF_OFFSET,
+ offsetof(ngx_http_ssl_srv_conf_t, crl),
+ NULL },
+
ngx_null_command
};
@@ -190,6 +184,9 @@
{ ngx_string("ssl_cipher"), NULL, ngx_http_ssl_static_variable,
(uintptr_t) ngx_ssl_get_cipher_name, NGX_HTTP_VAR_CHANGEABLE, 0 },
+ { ngx_string("ssl_session_id"), NULL, ngx_http_ssl_variable,
+ (uintptr_t) ngx_ssl_get_session_id, NGX_HTTP_VAR_CHANGEABLE, 0 },
+
{ ngx_string("ssl_client_cert"), NULL, ngx_http_ssl_variable,
(uintptr_t) ngx_ssl_get_certificate, NGX_HTTP_VAR_CHANGEABLE, 0 },
@@ -206,6 +203,9 @@
{ ngx_string("ssl_client_serial"), NULL, ngx_http_ssl_variable,
(uintptr_t) ngx_ssl_get_serial_number, NGX_HTTP_VAR_CHANGEABLE, 0 },
+ { ngx_string("ssl_client_verify"), NULL, ngx_http_ssl_variable,
+ (uintptr_t) ngx_ssl_get_client_verify, NGX_HTTP_VAR_CHANGEABLE, 0 },
+
{ ngx_null_string, NULL, NULL, 0, 0, 0 }
};
@@ -302,7 +302,7 @@
sscf = ngx_pcalloc(cf->pool, sizeof(ngx_http_ssl_srv_conf_t));
if (sscf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
@@ -313,6 +313,7 @@
* sscf->certificate_key = { 0, NULL };
* sscf->dhparam = { 0, NULL };
* sscf->client_certificate = { 0, NULL };
+ * sscf->crl = { 0, NULL };
* sscf->ciphers.len = 0;
* sscf->ciphers.data = NULL;
* sscf->shm_zone = NULL;
@@ -346,8 +347,7 @@
prev->prefer_server_ciphers, 0);
ngx_conf_merge_bitmask_value(conf->protocols, prev->protocols,
- (NGX_CONF_BITMASK_SET
- |NGX_SSL_SSLv2|NGX_SSL_SSLv3|NGX_SSL_TLSv1));
+ (NGX_CONF_BITMASK_SET|NGX_SSL_SSLv3|NGX_SSL_TLSv1));
ngx_conf_merge_uint_value(conf->verify, prev->verify, 0);
ngx_conf_merge_uint_value(conf->verify_depth, prev->verify_depth, 1);
@@ -359,6 +359,7 @@
ngx_conf_merge_str_value(conf->client_certificate, prev->client_certificate,
"");
+ ngx_conf_merge_str_value(conf->crl, prev->crl, "");
ngx_conf_merge_str_value(conf->ciphers, prev->ciphers, NGX_DEFAULT_CIPHERS);
@@ -407,9 +408,10 @@
ngx_http_ssl_servername)
== 0)
{
- ngx_ssl_error(NGX_LOG_EMERG, cf->log, 0,
- "SSL_CTX_set_tlsext_servername_callback() failed");
- return NGX_CONF_ERROR;
+ ngx_log_error(NGX_LOG_WARN, cf->log, 0,
+ "nginx was built with SNI support, however, now it is linked "
+ "dynamically to an OpenSSL library which has no tlsext support, "
+ "therefore SNI is not available");
}
#endif
@@ -453,16 +455,16 @@
{
return NGX_CONF_ERROR;
}
- }
-#ifdef SSL_OP_CIPHER_SERVER_PREFERENCE
+ if (ngx_ssl_crl(cf, &conf->ssl, &conf->crl) != NGX_OK) {
+ return NGX_CONF_ERROR;
+ }
+ }
if (conf->prefer_server_ciphers) {
SSL_CTX_set_options(conf->ssl.ctx, SSL_OP_CIPHER_SERVER_PREFERENCE);
}
-#endif
-
/* a temporary 512-bit RSA key is required for export versions of MSIE */
if (ngx_ssl_generate_rsa512_key(&conf->ssl) != NGX_OK) {
return NGX_CONF_ERROR;
@@ -620,18 +622,3 @@
return NGX_CONF_ERROR;
}
-
-
-#if !defined (SSL_OP_CIPHER_SERVER_PREFERENCE)
-
-static char *
-ngx_http_ssl_nosupported(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
-{
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "\"%V\" directive is available only in %s,",
- &cmd->name, cmd->post);
-
- return NGX_CONF_ERROR;
-}
-
-#endif
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_ssl_module.h
^
|
@@ -33,6 +33,7 @@
ngx_str_t certificate_key;
ngx_str_t dhparam;
ngx_str_t client_certificate;
+ ngx_str_t crl;
ngx_str_t ciphers;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_static_module.c
^
|
@@ -66,10 +66,6 @@
return NGX_DECLINED;
}
- if (r->zero_in_uri) {
- return NGX_DECLINED;
- }
-
log = r->connection->log;
/*
@@ -188,7 +184,7 @@
#if !(NGX_WIN32) /* the not regular files are probably Unix specific */
if (!of.is_file) {
- ngx_log_error(NGX_LOG_CRIT, log, ngx_errno,
+ ngx_log_error(NGX_LOG_CRIT, log, 0,
"\"%s\" is not a regular file", path.data);
return NGX_HTTP_NOT_FOUND;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_sub_filter_module.c
^
|
@@ -29,6 +29,8 @@
typedef struct {
ngx_str_t match;
+ ngx_str_t saved;
+ ngx_str_t looked;
ngx_uint_t once; /* unsigned once:1 */
@@ -47,8 +49,6 @@
ngx_str_t sub;
ngx_uint_t state;
- size_t saved;
- size_t looked;
} ngx_http_sub_ctx_t;
@@ -147,6 +147,16 @@
return NGX_ERROR;
}
+ ctx->saved.data = ngx_pnalloc(r->pool, slcf->match.len);
+ if (ctx->saved.data == NULL) {
+ return NGX_ERROR;
+ }
+
+ ctx->looked.data = ngx_pnalloc(r->pool, slcf->match.len);
+ if (ctx->looked.data == NULL) {
+ return NGX_ERROR;
+ }
+
ngx_http_set_ctx(r, ctx, ngx_http_sub_filter_module);
ctx->match = slcf->match;
@@ -226,13 +236,13 @@
while (ctx->pos < ctx->buf->last) {
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "saved: %d state: %d", ctx->saved, ctx->state);
+ "saved: \"%V\" state: %d", &ctx->saved, ctx->state);
rc = ngx_http_sub_parse(r, ctx);
ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "parse: %d, looked: %d %p-%p",
- rc, ctx->looked, ctx->copy_start, ctx->copy_end);
+ "parse: %d, looked: \"%V\" %p-%p",
+ rc, &ctx->looked, ctx->copy_start, ctx->copy_end);
if (rc == NGX_ERROR) {
return rc;
@@ -241,9 +251,9 @@
if (ctx->copy_start != ctx->copy_end) {
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "saved: %d", ctx->saved);
+ "saved: \"%V\"", &ctx->saved);
- if (ctx->saved) {
+ if (ctx->saved.len) {
if (ctx->free) {
cl = ctx->free;
@@ -265,14 +275,19 @@
cl->buf = b;
}
+ b->pos = ngx_pnalloc(r->pool, ctx->saved.len);
+ if (b->pos == NULL) {
+ return NGX_ERROR;
+ }
+
+ ngx_memcpy(b->pos, ctx->saved.data, ctx->saved.len);
+ b->last = b->pos + ctx->saved.len;
b->memory = 1;
- b->pos = ctx->match.data;
- b->last = ctx->match.data + ctx->saved;
*ctx->last_out = cl;
ctx->last_out = &cl->next;
- ctx->saved = 0;
+ ctx->saved.len = 0;
}
if (ctx->free) {
@@ -405,7 +420,8 @@
ctx->buf = NULL;
- ctx->saved = ctx->looked;
+ ctx->saved.len = ctx->looked.len;
+ ngx_memcpy(ctx->saved.data, ctx->looked.data, ctx->looked.len);
}
if (ctx->out == NULL && ctx->busy == NULL) {
@@ -496,7 +512,7 @@
ctx->copy_start = ctx->pos;
ctx->copy_end = ctx->buf->last;
ctx->pos = ctx->buf->last;
- ctx->looked = 0;
+ ctx->looked.len = 0;
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "once");
@@ -504,7 +520,7 @@
}
state = ctx->state;
- looked = ctx->looked;
+ looked = ctx->looked.len;
last = ctx->buf->last;
copy_end = ctx->copy_end;
@@ -522,6 +538,7 @@
for ( ;; ) {
if (ch == match) {
copy_end = p;
+ ctx->looked.data[0] = *p;
looked = 1;
state = sub_match_state;
@@ -538,7 +555,7 @@
ctx->state = state;
ctx->pos = p;
- ctx->looked = looked;
+ ctx->looked.len = looked;
ctx->copy_end = p;
if (ctx->copy_start == NULL) {
@@ -555,16 +572,17 @@
/* state == sub_match_state */
if (ch == ctx->match.data[looked]) {
+ ctx->looked.data[looked] = *p;
looked++;
if (looked == ctx->match.len) {
if ((size_t) (p - ctx->pos) < looked) {
- ctx->saved = 0;
+ ctx->saved.len = 0;
}
ctx->state = sub_start_state;
ctx->pos = p + 1;
- ctx->looked = 0;
+ ctx->looked.len = 0;
ctx->copy_end = copy_end;
if (ctx->copy_start == NULL && copy_end) {
@@ -576,6 +594,7 @@
} else if (ch == ctx->match.data[0]) {
copy_end = p;
+ ctx->looked.data[0] = *p;
looked = 1;
} else {
@@ -587,7 +606,7 @@
ctx->state = state;
ctx->pos = p;
- ctx->looked = looked;
+ ctx->looked.len = looked;
ctx->copy_end = (state == sub_start_state) ? p : copy_end;
@@ -638,7 +657,7 @@
slcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_sub_loc_conf_t));
if (slcf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_userid_filter_module.c
^
|
@@ -545,7 +545,7 @@
{
ngx_http_variable_t *var;
- var = ngx_http_add_variable(cf, &ngx_http_userid_got, NGX_HTTP_VAR_NOHASH);
+ var = ngx_http_add_variable(cf, &ngx_http_userid_got, 0);
if (var == NULL) {
return NGX_ERROR;
}
@@ -570,7 +570,7 @@
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_userid_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/ngx_http_xslt_filter_module.c
^
|
@@ -194,7 +194,7 @@
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
- ngx_http_xslt_filter_exit, /* exit process */
+ ngx_http_xslt_filter_exit, /* exit process */
ngx_http_xslt_filter_exit, /* exit master */
NGX_MODULE_V1_PADDING
};
@@ -247,6 +247,7 @@
static ngx_int_t
ngx_http_xslt_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
{
+ int wellFormed;
ngx_chain_t *cl;
ngx_http_xslt_filter_ctx_t *ctx;
@@ -288,9 +289,11 @@
ctx->doc->extSubset = NULL;
#endif
+ wellFormed = ctx->ctxt->wellFormed;
+
xmlFreeParserCtxt(ctx->ctxt);
- if (ctx->ctxt->wellFormed) {
+ if (wellFormed) {
return ngx_http_xslt_send(r, ctx,
ngx_http_xslt_apply_stylesheet(r, ctx));
}
@@ -401,7 +404,7 @@
sax->endElementNs = ngx_http_xslt_sax_end_element;
sax->characters = ngx_http_xslt_sax_characters;
- sax->ignorableWhitespace = ngx_http_xslt_sax_characters;
+ sax->ignorableWhitespace = ngx_http_xslt_sax_characters;
sax->cdataBlock = ngx_http_xslt_sax_cdata_block;
sax->getEntity = ngx_http_xslt_sax_get_entity;
sax->resolveEntity = ngx_http_xslt_sax_resolve_entity;
@@ -717,7 +720,7 @@
while (--n && (buf[n] == CR || buf[n] == LF)) { /* void */ }
ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0,
- "libxml2 error: \"%*s\"", n, buf);
+ "libxml2 error: \"%*s\"", n + 1, buf);
}
@@ -1169,7 +1172,7 @@
conf = ngx_palloc(cf->pool, sizeof(ngx_http_xslt_filter_main_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
if (ngx_array_init(&conf->dtd_files, cf->pool, 1,
@@ -1197,7 +1200,7 @@
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_xslt_filter_loc_conf_t));
if (conf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/perl/nginx.pm
^
|
@@ -47,7 +47,7 @@
HTTP_INSUFFICIENT_STORAGE
);
-our $VERSION = '0.7.61';
+our $VERSION = '0.7.69';
require XSLoader;
XSLoader::load('nginx', $VERSION);
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/perl/nginx.xs
^
|
@@ -847,7 +847,7 @@
#endif
- vv = ngx_http_get_variable(r, &var, hash, 1);
+ vv = ngx_http_get_variable(r, &var, hash);
if (vv == NULL) {
XSRETURN_UNDEF;
}
@@ -901,9 +901,6 @@
XSRETURN_UNDEF;
}
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "variable \"%V\" not found", &var);
-
XSRETURN_UNDEF;
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/modules/perl/ngx_http_perl_module.c
^
|
@@ -13,8 +13,8 @@
typedef struct {
PerlInterpreter *perl;
HV *nginx;
- ngx_str_t modules;
- ngx_array_t requires;
+ ngx_array_t *modules;
+ ngx_array_t *requires;
} ngx_http_perl_main_conf_t;
@@ -30,12 +30,6 @@
} ngx_http_perl_variable_t;
-typedef struct {
- SV *sv;
- PerlInterpreter *perl;
-} ngx_http_perl_cleanup_t;
-
-
#if (NGX_HTTP_SSI)
static ngx_int_t ngx_http_perl_ssi(ngx_http_request_t *r,
ngx_http_ssi_ctx_t *ssi_ctx, ngx_str_t **params);
@@ -57,8 +51,6 @@
static void *ngx_http_perl_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_perl_merge_loc_conf(ngx_conf_t *cf, void *parent,
void *child);
-static char *ngx_http_perl_require(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf);
static char *ngx_http_perl(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
static char *ngx_http_perl_set(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
@@ -74,16 +66,16 @@
{ ngx_string("perl_modules"),
NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_str_slot,
+ ngx_conf_set_str_array_slot,
NGX_HTTP_MAIN_CONF_OFFSET,
offsetof(ngx_http_perl_main_conf_t, modules),
NULL },
{ ngx_string("perl_require"),
NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
- ngx_http_perl_require,
+ ngx_conf_set_str_array_slot,
NGX_HTTP_MAIN_CONF_OFFSET,
- 0,
+ offsetof(ngx_http_perl_main_conf_t, requires),
NULL },
{ ngx_string("perl"),
@@ -154,12 +146,13 @@
#endif
-static ngx_str_t ngx_null_name = ngx_null_string;
-
-static HV *nginx_stash;
+static ngx_str_t ngx_null_name = ngx_null_string;
+static HV *nginx_stash;
#if (NGX_HAVE_PERL_MULTIPLICITY)
-static ngx_uint_t ngx_perl_term;
+static ngx_uint_t ngx_perl_term;
+#else
+static PerlInterpreter *perl;
#endif
@@ -175,10 +168,6 @@
static ngx_int_t
ngx_http_perl_handler(ngx_http_request_t *r)
{
- if (r->zero_in_uri) {
- return NGX_HTTP_NOT_FOUND;
- }
-
ngx_http_perl_handle_request(r);
return NGX_DONE;
@@ -458,27 +447,42 @@
static char *
ngx_http_perl_init_interpreter(ngx_conf_t *cf, ngx_http_perl_main_conf_t *pmcf)
{
+ ngx_str_t *m;
+ ngx_uint_t i;
#if (NGX_HAVE_PERL_MULTIPLICITY)
- ngx_pool_cleanup_t *cln;
+ ngx_pool_cleanup_t *cln;
cln = ngx_pool_cleanup_add(cf->pool, 0);
if (cln == NULL) {
return NGX_CONF_ERROR;
}
-#else
- static PerlInterpreter *perl;
#endif
#ifdef NGX_PERL_MODULES
- if (pmcf->modules.data == NULL) {
- pmcf->modules.data = NGX_PERL_MODULES;
+ if (pmcf->modules == NGX_CONF_UNSET_PTR) {
+
+ pmcf->modules = ngx_array_create(cf->pool, 1, sizeof(ngx_str_t));
+ if (pmcf->modules == NULL) {
+ return NGX_CONF_ERROR;
+ }
+
+ m = ngx_array_push(pmcf->modules);
+ if (m == NULL) {
+ return NGX_CONF_ERROR;
+ }
+
+ m->len = sizeof(NGX_PERL_MODULES) - 1;
+ m->data = NGX_PERL_MODULES;
}
#endif
- if (pmcf->modules.data) {
- if (ngx_conf_full_name(cf->cycle, &pmcf->modules, 0) != NGX_OK) {
- return NGX_CONF_ERROR;
+ if (pmcf->modules != NGX_CONF_UNSET_PTR) {
+ m = pmcf->modules->elts;
+ for (i = 0; i < pmcf->modules->nelts; i++) {
+ if (ngx_conf_full_name(cf->cycle, &m[i], 0) != NGX_OK) {
+ return NGX_CONF_ERROR;
+ }
}
}
@@ -490,7 +494,7 @@
return NGX_CONF_ERROR;
}
- if (ngx_http_perl_run_requires(aTHX_ &pmcf->requires, cf->log)
+ if (ngx_http_perl_run_requires(aTHX_ pmcf->requires, cf->log)
!= NGX_OK)
{
return NGX_CONF_ERROR;
@@ -538,7 +542,9 @@
int n;
STRLEN len;
SV *sv;
- char *ver, *embedding[6];
+ char *ver, **embedding;
+ ngx_str_t *m;
+ ngx_uint_t i;
PerlInterpreter *perl;
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, cf->log, 0, "create perl interpreter");
@@ -564,15 +570,21 @@
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
#endif
- embedding[0] = "";
+ n = (pmcf->modules != NGX_CONF_UNSET_PTR) ? pmcf->modules->nelts * 2 : 0;
+
+ embedding = ngx_palloc(cf->pool, (4 + n) * sizeof(char *));
+ if (embedding == NULL) {
+ goto fail;
+ }
- if (pmcf->modules.data) {
- embedding[1] = "-I";
- embedding[2] = (char *) pmcf->modules.data;
- n = 3;
+ embedding[0] = "";
- } else {
- n = 1;
+ if (n++) {
+ m = pmcf->modules->elts;
+ for (i = 0; i < pmcf->modules->nelts; i++) {
+ embedding[2 * i + 1] = "-I";
+ embedding[2 * i + 2] = (char *) m[i].data;
+ }
}
embedding[n++] = "-Mnginx";
@@ -596,7 +608,7 @@
goto fail;
}
- if (ngx_http_perl_run_requires(aTHX_ &pmcf->requires, cf->log) != NGX_OK) {
+ if (ngx_http_perl_run_requires(aTHX_ pmcf->requires, cf->log) != NGX_OK) {
goto fail;
}
@@ -617,26 +629,28 @@
static ngx_int_t
ngx_http_perl_run_requires(pTHX_ ngx_array_t *requires, ngx_log_t *log)
{
- char **script;
+ u_char *err;
STRLEN len;
- ngx_str_t err;
+ ngx_str_t *script;
ngx_uint_t i;
+ if (requires == NGX_CONF_UNSET_PTR) {
+ return NGX_OK;
+ }
+
script = requires->elts;
for (i = 0; i < requires->nelts; i++) {
- require_pv(script[i]);
+ require_pv((char *) script[i].data);
if (SvTRUE(ERRSV)) {
- err.data = (u_char *) SvPV(ERRSV, len);
- for (len--; err.data[len] == LF || err.data[len] == CR; len--) {
- /* void */
- }
- err.len = len + 1;
+ err = (u_char *) SvPV(ERRSV, len);
+ while (--len && (err[len] == CR || err[len] == LF)) { /* void */ }
ngx_log_error(NGX_LOG_EMERG, log, 0,
- "require_pv(\"%s\") failed: \"%V\"", script[i], &err);
+ "require_pv(\"%s\") failed: \"%*s\"",
+ script[i].data, len + 1, err);
return NGX_ERROR;
}
@@ -653,8 +667,8 @@
SV *sv;
int n, status;
char *line;
+ u_char *err;
STRLEN len, n_a;
- ngx_str_t err;
ngx_uint_t i;
ngx_connection_t *c;
@@ -724,14 +738,11 @@
if (SvTRUE(ERRSV)) {
- err.data = (u_char *) SvPV(ERRSV, len);
- for (len--; err.data[len] == LF || err.data[len] == CR; len--) {
- /* void */
- }
- err.len = len + 1;
+ err = (u_char *) SvPV(ERRSV, len);
+ while (--len && (err[len] == CR || err[len] == LF)) { /* void */ }
ngx_log_error(NGX_LOG_ERR, c->log, 0,
- "call_sv(\"%V\") failed: \"%V\"", handler, &err);
+ "call_sv(\"%V\") failed: \"%*s\"", handler, len + 1, err);
if (rv) {
return NGX_ERROR;
@@ -765,7 +776,10 @@
}
}
- if (ngx_strncmp(p, "sub ", 4) == 0 || ngx_strncmp(p, "use ", 4) == 0) {
+ if (ngx_strncmp(p, "sub ", 4) == 0
+ || ngx_strncmp(p, "sub{", 4) == 0
+ || ngx_strncmp(p, "use ", 4) == 0)
+ {
*sv = eval_pv((char *) p, FALSE);
/* eval_pv() does not set ERRSV on failure */
@@ -784,15 +798,12 @@
pmcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_perl_main_conf_t));
if (pmcf == NULL) {
- return NGX_CONF_ERROR;
- }
-
- if (ngx_array_init(&pmcf->requires, cf->pool, 1, sizeof(u_char *))
- != NGX_OK)
- {
return NULL;
}
+ pmcf->modules = NGX_CONF_UNSET_PTR;
+ pmcf->requires = NGX_CONF_UNSET_PTR;
+
return pmcf;
}
@@ -869,7 +880,7 @@
plcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_perl_loc_conf_t));
if (plcf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
@@ -898,28 +909,6 @@
static char *
-ngx_http_perl_require(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
-{
- ngx_http_perl_main_conf_t *pmcf = conf;
-
- u_char **p;
- ngx_str_t *value;
-
- value = cf->args->elts;
-
- p = ngx_array_push(&pmcf->requires);
-
- if (p == NULL) {
- return NGX_CONF_ERROR;
- }
-
- *p = value[1].data;
-
- return NGX_CONF_OK;
-}
-
-
-static char *
ngx_http_perl(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
ngx_http_perl_loc_conf_t *plcf = conf;
@@ -1068,19 +1057,21 @@
{
#if (NGX_HAVE_PERL_MULTIPLICITY)
+ /*
+ * the master exit hook is run before global pool cleanup,
+ * therefore just set flag here
+ */
+
ngx_perl_term = 1;
#else
- ngx_http_perl_main_conf_t *pmcf;
-
- pmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_perl_module);
- if (pmcf && nginx_stash) {
+ if (nginx_stash) {
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, cycle->log, 0, "perl term");
- (void) perl_destruct(pmcf->perl);
+ (void) perl_destruct(perl);
- perl_free(pmcf->perl);
+ perl_free(perl);
PERL_SYS_TERM();
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/ngx_http.c
^
|
@@ -1601,7 +1601,7 @@
first = (ngx_hash_key_t *) one;
second = (ngx_hash_key_t *) two;
- return ngx_strcmp(first->key.data, second->key.data);
+ return ngx_dns_strcmp(first->key.data, second->key.data);
}
@@ -1831,8 +1831,12 @@
if (addr[i].hash.buckets == NULL
&& (addr[i].wc_head == NULL
|| addr[i].wc_head->hash.buckets == NULL)
- && (addr[i].wc_head == NULL
- || addr[i].wc_head->hash.buckets == NULL))
+ && (addr[i].wc_tail == NULL
+ || addr[i].wc_tail->hash.buckets == NULL)
+#if (NGX_PCRE)
+ && addr[i].nregex == 0
+#endif
+ )
{
continue;
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/ngx_http_cache.h
^
|
@@ -13,8 +13,11 @@
#include <ngx_http.h>
-#define NGX_HTTP_CACHE_STALE 1
-#define NGX_HTTP_CACHE_UPDATING 2
+#define NGX_HTTP_CACHE_MISS 1
+#define NGX_HTTP_CACHE_EXPIRED 2
+#define NGX_HTTP_CACHE_STALE 3
+#define NGX_HTTP_CACHE_UPDATING 4
+#define NGX_HTTP_CACHE_HIT 5
#define NGX_HTTP_CACHE_KEY_LEN 16
@@ -94,6 +97,7 @@
ngx_rbtree_node_t sentinel;
ngx_queue_t queue;
ngx_atomic_t cold;
+ ngx_atomic_t loading;
off_t size;
} ngx_http_file_cache_sh_t;
@@ -124,11 +128,17 @@
void ngx_http_file_cache_free(ngx_http_request_t *r, ngx_temp_file_t *tf);
time_t ngx_http_file_cache_valid(ngx_array_t *cache_valid, ngx_uint_t status);
-
char *ngx_http_file_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
char *ngx_http_file_cache_valid_set_slot(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
+ngx_int_t ngx_http_cache(ngx_http_request_t *r, ngx_array_t *no_cache);
+char *ngx_http_no_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd,
+ void *conf);
+
+
+extern ngx_str_t ngx_http_cache_status[];
+
#endif /* _NGX_HTTP_CACHE_H_INCLUDED_ */
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/ngx_http_copy_filter_module.c
^
|
@@ -104,7 +104,9 @@
ctx->output_filter = (ngx_output_chain_filter_pt) ngx_http_next_filter;
ctx->filter_ctx = r;
- r->request_output = 1;
+ if (in && in->buf && ngx_buf_size(in->buf)) {
+ r->request_output = 1;
+ }
}
rc = ngx_output_chain(ctx, in);
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/ngx_http_core_module.c
^
|
@@ -433,6 +433,14 @@
offsetof(ngx_http_core_loc_conf_t, limit_rate),
NULL },
+ { ngx_string("limit_rate_after"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
+ |NGX_CONF_TAKE1,
+ ngx_conf_set_size_slot,
+ NGX_HTTP_LOC_CONF_OFFSET,
+ offsetof(ngx_http_core_loc_conf_t, limit_rate_after),
+ NULL },
+
{ ngx_string("keepalive_timeout"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE12,
ngx_http_core_keepalive,
@@ -552,6 +560,13 @@
offsetof(ngx_http_core_loc_conf_t, if_modified_since),
&ngx_http_core_if_modified_since },
+ { ngx_string("chunked_transfer_encoding"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+ ngx_conf_set_flag_slot,
+ NGX_HTTP_LOC_CONF_OFFSET,
+ offsetof(ngx_http_core_loc_conf_t, chunked_transfer_encoding),
+ NULL },
+
{ ngx_string("error_page"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
|NGX_CONF_2MORE,
@@ -736,14 +751,24 @@
break;
}
- if (r->keepalive && r->headers_in.msie && r->method == NGX_HTTP_POST) {
+ if (r->keepalive) {
- /*
- * MSIE may wait for some time if an response for
- * a POST request was sent over a keepalive connection
- */
+ if (r->headers_in.msie6) {
+ if (r->method == NGX_HTTP_POST) {
+ /*
+ * MSIE may wait for some time if an response for
+ * a POST request was sent over a keepalive connection
+ */
+ r->keepalive = 0;
+ }
- r->keepalive = 0;
+ } else if (r->headers_in.safari) {
+ /*
+ * Safari may send a POST request to a closed keepalive
+ * connection and stalls for some time
+ */
+ r->keepalive = 0;
+ }
}
if (r->headers_in.content_length_n > 0) {
@@ -760,12 +785,12 @@
r->phase_handler = cmcf->phase_engine.server_rewrite_index;
}
- if (r->unparsed_uri.len) {
- r->valid_unparsed_uri = 1;
- }
-
r->valid_location = 1;
- r->gzip = 0;
+#if (NGX_HTTP_GZIP)
+ r->gzip_tested = 0;
+ r->gzip_ok = 0;
+ r->gzip_vary = 0;
+#endif
r->write_event_handler = ngx_http_core_run_phases;
ngx_http_core_run_phases(r);
@@ -877,6 +902,7 @@
"client intended to send too large body: %O bytes",
r->headers_in.content_length_n);
+ (void) ngx_http_discard_request_body(r);
ngx_http_finalize_request(r, NGX_HTTP_REQUEST_ENTITY_TOO_LARGE);
return NGX_OK;
}
@@ -1190,7 +1216,10 @@
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
!= NGX_OK)
{
- if (of.err != NGX_ENOENT && of.err != NGX_ENOTDIR) {
+ if (of.err != NGX_ENOENT
+ && of.err != NGX_ENOTDIR
+ && of.err != NGX_ENAMETOOLONG)
+ {
ngx_log_error(NGX_LOG_CRIT, r->connection->log, of.err,
"%s \"%s\" failed", of.failed, path.data);
}
@@ -1220,10 +1249,7 @@
ngx_memcpy(p, name, path.len);
}
- if (ngx_http_set_exten(r) != NGX_OK) {
- ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
- return NGX_OK;
- }
+ ngx_http_set_exten(r);
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"try file uri: \"%V\"", &r->uri);
@@ -1275,7 +1301,7 @@
/* no content handler was found */
- if (r->uri.data[r->uri.len - 1] == '/' && !r->zero_in_uri) {
+ if (r->uri.data[r->uri.len - 1] == '/') {
if (ngx_http_map_uri_to_path(r, &path, &root, 0) != NULL) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
@@ -1633,7 +1659,7 @@
}
-ngx_int_t
+void
ngx_http_set_exten(ngx_http_request_t *r)
{
ngx_int_t i;
@@ -1647,14 +1673,14 @@
r->exten.len = r->uri.len - i - 1;
r->exten.data = &r->uri.data[i + 1];
- break;
+ return;
} else if (r->uri.data[i] == '/') {
- break;
+ return;
}
}
- return NGX_OK;
+ return;
}
@@ -1851,15 +1877,7 @@
ngx_table_elt_t *e, *d;
ngx_http_core_loc_conf_t *clcf;
- if (r->gzip == 1) {
- return NGX_OK;
- }
-
- if (r->gzip == 2) {
- return NGX_DECLINED;
- }
-
- r->gzip = 2;
+ r->gzip_tested = 1;
if (r != r->main
|| r->headers_in.accept_encoding == NULL
@@ -1994,7 +2012,7 @@
#endif
- r->gzip = 1;
+ r->gzip_ok = 1;
return NGX_OK;
}
@@ -2071,7 +2089,6 @@
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
"http subrequest \"%V?%V\"", uri, &sr->args);
- sr->zero_in_uri = (flags & NGX_HTTP_ZERO_IN_URI) != 0;
sr->subrequest_in_memory = (flags & NGX_HTTP_SUBREQUEST_IN_MEMORY) != 0;
sr->waited = (flags & NGX_HTTP_SUBREQUEST_WAITED) != 0;
@@ -2079,9 +2096,7 @@
sr->method_name = ngx_http_core_get_method;
sr->http_protocol = r->http_protocol;
- if (ngx_http_set_exten(sr) != NGX_OK) {
- return NGX_ERROR;
- }
+ ngx_http_set_exten(sr);
sr->main = r->main;
sr->parent = r;
@@ -2160,10 +2175,7 @@
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"internal redirect: \"%V?%V\"", uri, &r->args);
- if (ngx_http_set_exten(r) != NGX_OK) {
- ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
- return NGX_DONE;
- }
+ ngx_http_set_exten(r);
/* clear the modules contexts */
ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module);
@@ -2566,6 +2578,10 @@
err.len = NGX_MAX_CONF_ERRSTR;
err.data = errstr;
+#if (NGX_HAVE_CASELESS_FILESYSTEM)
+ caseless = 1;
+#endif
+
clcf->regex = ngx_regex_compile(regex, caseless ? NGX_REGEX_CASELESS: 0,
cf->pool, &err);
@@ -2695,14 +2711,14 @@
cmcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_main_conf_t));
if (cmcf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
if (ngx_array_init(&cmcf->servers, cf->pool, 4,
sizeof(ngx_http_core_srv_conf_t *))
!= NGX_OK)
{
- return NGX_CONF_ERROR;
+ return NULL;
}
cmcf->server_names_hash_max_size = NGX_CONF_UNSET_UINT;
@@ -2754,7 +2770,7 @@
cscf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_srv_conf_t));
if (cscf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
@@ -2767,14 +2783,14 @@
sizeof(ngx_http_listen_t))
!= NGX_OK)
{
- return NGX_CONF_ERROR;
+ return NULL;
}
if (ngx_array_init(&cscf->server_names, cf->temp_pool, 4,
sizeof(ngx_http_server_name_t))
!= NGX_OK)
{
- return NGX_CONF_ERROR;
+ return NULL;
}
cscf->connection_pool_size = NGX_CONF_UNSET_SIZE;
@@ -2857,7 +2873,7 @@
prev->client_header_buffer_size, 1024);
ngx_conf_merge_bufs_value(conf->large_client_header_buffers,
prev->large_client_header_buffers,
- 4, ngx_pagesize);
+ 4, 8192);
if (conf->large_client_header_buffers.size < conf->connection_pool_size) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
@@ -2885,7 +2901,7 @@
lcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_loc_conf_t));
if (lcf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
@@ -2924,6 +2940,7 @@
lcf->send_lowat = NGX_CONF_UNSET_SIZE;
lcf->postpone_output = NGX_CONF_UNSET_SIZE;
lcf->limit_rate = NGX_CONF_UNSET_SIZE;
+ lcf->limit_rate_after = NGX_CONF_UNSET_SIZE;
lcf->keepalive_timeout = NGX_CONF_UNSET_MSEC;
lcf->keepalive_header = NGX_CONF_UNSET;
lcf->keepalive_requests = NGX_CONF_UNSET_UINT;
@@ -2939,6 +2956,7 @@
lcf->log_subrequest = NGX_CONF_UNSET;
lcf->recursive_error_pages = NGX_CONF_UNSET;
lcf->server_tokens = NGX_CONF_UNSET;
+ lcf->chunked_transfer_encoding = NGX_CONF_UNSET;
lcf->types_hash_max_size = NGX_CONF_UNSET_UINT;
lcf->types_hash_bucket_size = NGX_CONF_UNSET_UINT;
@@ -3123,6 +3141,8 @@
ngx_conf_merge_size_value(conf->postpone_output, prev->postpone_output,
1460);
ngx_conf_merge_size_value(conf->limit_rate, prev->limit_rate, 0);
+ ngx_conf_merge_size_value(conf->limit_rate_after, prev->limit_rate_after,
+ 0);
ngx_conf_merge_msec_value(conf->keepalive_timeout,
prev->keepalive_timeout, 75000);
ngx_conf_merge_sec_value(conf->keepalive_header,
@@ -3174,6 +3194,8 @@
ngx_conf_merge_value(conf->recursive_error_pages,
prev->recursive_error_pages, 0);
ngx_conf_merge_value(conf->server_tokens, prev->server_tokens, 1);
+ ngx_conf_merge_value(conf->chunked_transfer_encoding,
+ prev->chunked_transfer_encoding, 1);
ngx_conf_merge_ptr_value(conf->open_file_cache,
prev->open_file_cache, NULL);
@@ -3504,6 +3526,12 @@
ngx_str_t err;
u_char errstr[NGX_MAX_CONF_ERRSTR];
+ if (value[i].len == 1) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "empty regex in server name \"%V\"", &value[i]);
+ return NGX_CONF_ERROR;
+ }
+
err.len = NGX_MAX_CONF_ERRSTR;
err.data = errstr;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/ngx_http_core_module.h
^
|
@@ -324,6 +324,7 @@
size_t send_lowat; /* send_lowat */
size_t postpone_output; /* postpone_output */
size_t limit_rate; /* limit_rate */
+ size_t limit_rate_after; /* limit_rate_after */
size_t sendfile_max_chunk; /* sendfile_max_chunk */
ngx_msec_t client_body_timeout; /* client_body_timeout */
@@ -357,6 +358,7 @@
ngx_flag_t log_subrequest; /* log_subrequest */
ngx_flag_t recursive_error_pages; /* recursive_error_pages */
ngx_flag_t server_tokens; /* server_tokens */
+ ngx_flag_t chunked_transfer_encoding; /* chunked_transfer_encoding */
#if (NGX_HTTP_GZIP)
ngx_flag_t gzip_vary; /* gzip_vary */
@@ -437,7 +439,7 @@
void *ngx_http_test_content_type(ngx_http_request_t *r, ngx_hash_t *types_hash);
ngx_int_t ngx_http_set_content_type(ngx_http_request_t *r);
-ngx_int_t ngx_http_set_exten(ngx_http_request_t *r);
+void ngx_http_set_exten(ngx_http_request_t *r);
u_char *ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *name,
size_t *root_length, size_t reserved);
ngx_int_t ngx_http_auth_basic_user(ngx_http_request_t *r);
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/ngx_http_file_cache.c
^
|
@@ -35,6 +35,15 @@
ngx_str_t *path);
+ngx_str_t ngx_http_cache_status[] = {
+ ngx_string("MISS"),
+ ngx_string("EXPIRED"),
+ ngx_string("STALE"),
+ ngx_string("UPDATING"),
+ ngx_string("HIT")
+};
+
+
static u_char ngx_http_file_cache_key[] = { LF, 'K', 'E', 'Y', ':', ' ' };
@@ -44,6 +53,7 @@
ngx_http_file_cache_t *ocache = data;
size_t len;
+ ngx_uint_t n;
ngx_http_file_cache_t *cache;
cache = shm_zone->data;
@@ -59,6 +69,15 @@
return NGX_ERROR;
}
+ for (n = 0; n < 3; n++) {
+ if (cache->path->level[n] != ocache->path->level[n]) {
+ ngx_log_error(NGX_LOG_EMERG, shm_zone->shm.log, 0,
+ "cache \"%V\" had previously different levels",
+ &shm_zone->shm.name);
+ return NGX_ERROR;
+ }
+ }
+
cache->sh = ocache->sh;
cache->shpool = ocache->shpool;
@@ -66,6 +85,10 @@
cache->max_size /= cache->bsize;
+ if (!cache->sh->cold || cache->sh->loading) {
+ cache->path->loader = NULL;
+ }
+
return NGX_OK;
}
@@ -91,6 +114,7 @@
ngx_queue_init(&cache->sh->queue);
cache->sh->cold = 1;
+ cache->sh->loading = 0;
cache->sh->size = 0;
cache->bsize = ngx_fs_bsize(cache->path->name.data);
@@ -287,7 +311,7 @@
return n;
}
- if ((size_t) n <= c->header_start) {
+ if ((size_t) n < c->header_start) {
ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
"cache file \"%s\" is too small", c->file.name.data);
return NGX_ERROR;
@@ -594,7 +618,7 @@
void
ngx_http_file_cache_update(ngx_http_request_t *r, ngx_temp_file_t *tf)
{
- off_t size;
+ off_t size, length;
ngx_int_t rc;
ngx_file_uniq_t uniq;
ngx_file_info_t fi;
@@ -616,6 +640,7 @@
cache = c->file_cache;
uniq = 0;
+ length = 0;
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http file cache rename: \"%s\" to \"%s\"",
@@ -626,7 +651,6 @@
ext.time = -1;
ext.create_path = 1;
ext.delete_file = 1;
- ext.log_rename_error = 1;
ext.log = r->connection->log;
rc = ngx_ext_rename_file(&tf->file.name, &c->file.name, &ext);
@@ -641,10 +665,11 @@
} else {
uniq = ngx_file_uniq(&fi);
+ length = ngx_file_size(&fi);
}
}
- size = (c->length + cache->bsize - 1) / cache->bsize;
+ size = (length + cache->bsize - 1) / cache->bsize;
ngx_shmtx_lock(&cache->shpool->mutex);
@@ -654,7 +679,7 @@
size = size - (c->node->length + cache->bsize - 1) / cache->bsize;
- c->node->length = c->length;
+ c->node->length = length;
cache->sh->size += size;
@@ -693,6 +718,8 @@
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
+ r->header_only = (c->length - c->body_start) == 0;
+
rc = ngx_http_send_header(r);
if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
@@ -702,7 +729,7 @@
b->file_pos = c->body_start;
b->file_last = c->length;
- b->in_file = (c->length - c->body_start) ? 1: 0;
+ b->in_file = 1;
b->last_buf = (r == r->main) ? 1: 0;
b->last_in_chain = 1;
@@ -1017,39 +1044,8 @@
{
ngx_http_file_cache_t *cache = data;
- off_t size;
- time_t next;
- ngx_tree_ctx_t tree;
-
- if (cache->sh->cold) {
-
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
- "http file cache manager update");
-
- tree.init_handler = NULL;
- tree.file_handler = ngx_http_file_cache_manage_file;
- tree.pre_tree_handler = ngx_http_file_cache_noop;
- tree.post_tree_handler = ngx_http_file_cache_noop;
- tree.spec_handler = ngx_http_file_cache_delete_file;
- tree.data = cache;
- tree.alloc = 0;
- tree.log = ngx_cycle->log;
-
- cache->last = ngx_current_msec;
- cache->files = 0;
-
- if (ngx_walk_tree(&tree, &cache->path->name) == NGX_ABORT) {
- return 10;
- }
-
- cache->sh->cold = 0;
-
- ngx_log_error(NGX_LOG_NOTICE, ngx_cycle->log, 0,
- "http file cache: %V %.3fM, bsize: %uz",
- &cache->path->name,
- ((double) cache->sh->size * cache->bsize) / (1024 * 1024),
- cache->bsize);
- }
+ off_t size;
+ time_t next;
next = ngx_http_file_cache_expire(cache);
@@ -1079,6 +1075,52 @@
}
+static void
+ngx_http_file_cache_loader(void *data)
+{
+ ngx_http_file_cache_t *cache = data;
+
+ ngx_tree_ctx_t tree;
+
+ if (!cache->sh->cold || cache->sh->loading) {
+ return;
+ }
+
+ if (!ngx_atomic_cmp_set(&cache->sh->loading, 0, ngx_pid)) {
+ return;
+ }
+
+ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
+ "http file cache loader");
+
+ tree.init_handler = NULL;
+ tree.file_handler = ngx_http_file_cache_manage_file;
+ tree.pre_tree_handler = ngx_http_file_cache_noop;
+ tree.post_tree_handler = ngx_http_file_cache_noop;
+ tree.spec_handler = ngx_http_file_cache_delete_file;
+ tree.data = cache;
+ tree.alloc = 0;
+ tree.log = ngx_cycle->log;
+
+ cache->last = ngx_current_msec;
+ cache->files = 0;
+
+ if (ngx_walk_tree(&tree, &cache->path->name) == NGX_ABORT) {
+ cache->sh->loading = 0;
+ return;
+ }
+
+ cache->sh->cold = 0;
+ cache->sh->loading = 0;
+
+ ngx_log_error(NGX_LOG_NOTICE, ngx_cycle->log, 0,
+ "http file cache: %V %.3fM, bsize: %uz",
+ &cache->path->name,
+ ((double) cache->sh->size * cache->bsize) / (1024 * 1024),
+ cache->bsize);
+}
+
+
static ngx_int_t
ngx_http_file_cache_manager_sleep(ngx_http_file_cache_t *cache)
{
@@ -1086,7 +1128,7 @@
if (cache->files++ > 100) {
- ngx_time_update(0, 0);
+ ngx_time_update();
elapsed = ngx_abs((ngx_msec_int_t) (ngx_current_msec - cache->last));
@@ -1103,7 +1145,7 @@
ngx_msleep(200);
- ngx_time_update(0, 0);
+ ngx_time_update();
}
cache->last = ngx_current_msec;
@@ -1459,6 +1501,7 @@
}
cache->path->manager = ngx_http_file_cache_manager;
+ cache->path->loader = ngx_http_file_cache_loader;
cache->path->data = cache;
if (ngx_add_path(cf, &cache->path) != NGX_OK) {
@@ -1560,4 +1603,70 @@
}
return NGX_CONF_OK;
+}
+
+
+ngx_int_t
+ngx_http_cache(ngx_http_request_t *r, ngx_array_t *no_cache)
+{
+ ngx_str_t val;
+ ngx_uint_t i;
+ ngx_http_complex_value_t *cv;
+
+ cv = no_cache->elts;
+
+ for (i = 0; i < no_cache->nelts; i++) {
+ if (ngx_http_complex_value(r, &cv[i], &val) != NGX_OK) {
+ return NGX_ERROR;
+ }
+
+ if (val.len && val.data[0] != '0') {
+ return NGX_DECLINED;
+ }
+ }
+
+ return NGX_OK;
+}
+
+
+char *
+ngx_http_no_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+{
+ char *p = conf;
+
+ ngx_str_t *value;
+ ngx_uint_t i;
+ ngx_array_t **a;
+ ngx_http_complex_value_t *cv;
+ ngx_http_compile_complex_value_t ccv;
+
+ a = (ngx_array_t **) (p + cmd->offset);
+
+ if (*a == NGX_CONF_UNSET_PTR) {
+ *a = ngx_array_create(cf->pool, 1, sizeof(ngx_http_complex_value_t));
+ if (*a == NULL) {
+ return NGX_CONF_ERROR;
+ }
+ }
+
+ value = cf->args->elts;
+
+ for (i = 1; i < cf->args->nelts; i++) {
+ cv = ngx_array_push(*a);
+ if (cv == NULL) {
+ return NGX_CONF_ERROR;
+ }
+
+ ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
+
+ ccv.cf = cf;
+ ccv.value = &value[i];
+ ccv.complex_value = cv;
+
+ if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
+ return NGX_CONF_ERROR;
+ }
+ }
+
+ return NGX_CONF_OK;
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/ngx_http_parse.c
^
|
@@ -143,7 +143,7 @@
break;
}
- if (ch < 'A' || ch > 'Z') {
+ if ((ch < 'A' || ch > 'Z') && ch != '_') {
return NGX_HTTP_PARSE_INVALID_METHOD;
}
@@ -257,7 +257,7 @@
break;
}
- if (ch < 'A' || ch > 'Z') {
+ if ((ch < 'A' || ch > 'Z') && ch != '_') {
return NGX_HTTP_PARSE_INVALID_METHOD;
}
@@ -438,8 +438,7 @@
r->plus_in_uri = 1;
break;
case '\0':
- r->zero_in_uri = 1;
- break;
+ return NGX_HTTP_PARSE_INVALID_REQUEST;
default:
state = sw_check_uri;
break;
@@ -496,8 +495,7 @@
r->plus_in_uri = 1;
break;
case '\0':
- r->zero_in_uri = 1;
- break;
+ return NGX_HTTP_PARSE_INVALID_REQUEST;
}
break;
@@ -526,8 +524,7 @@
r->complex_uri = 1;
break;
case '\0':
- r->zero_in_uri = 1;
- break;
+ return NGX_HTTP_PARSE_INVALID_REQUEST;
}
break;
@@ -739,6 +736,7 @@
/* first char */
case sw_start:
+ r->header_name_start = p;
r->invalid_header = 0;
switch (ch) {
@@ -751,7 +749,6 @@
goto header_done;
default:
state = sw_name;
- r->header_name_start = p;
c = lowcase[ch];
@@ -950,9 +947,6 @@
sw_slash,
sw_dot,
sw_dot_dot,
-#if (NGX_WIN32)
- sw_dot_dot_dot,
-#endif
sw_quoted,
sw_quoted_second
} state, quoted_state;
@@ -1137,65 +1131,15 @@
#endif
case '/':
state = sw_slash;
- u -= 4;
- if (u < r->uri.data) {
- return NGX_HTTP_PARSE_INVALID_REQUEST;
- }
- while (*(u - 1) != '/') {
- u--;
- }
- break;
- case '%':
- quoted_state = state;
- state = sw_quoted;
- break;
- case '?':
- r->args_start = p;
- goto args;
- case '#':
- goto done;
-#if (NGX_WIN32)
- case '.':
- state = sw_dot_dot_dot;
- *u++ = ch;
- break;
-#endif
- case '+':
- r->plus_in_uri = 1;
- default:
- state = sw_usual;
- *u++ = ch;
- break;
- }
-
- ch = *p++;
- break;
-
-#if (NGX_WIN32)
- case sw_dot_dot_dot:
-
- if (usual[ch >> 5] & (1 << (ch & 0x1f))) {
- state = sw_usual;
- *u++ = ch;
- ch = *p++;
- break;
- }
-
- switch(ch) {
- case '\\':
- case '/':
- state = sw_slash;
u -= 5;
- if (u < r->uri.data) {
- return NGX_HTTP_PARSE_INVALID_REQUEST;
- }
- while (*u != '/') {
- u--;
- }
- if (u < r->uri.data) {
- return NGX_HTTP_PARSE_INVALID_REQUEST;
- }
- while (*(u - 1) != '/') {
+ for ( ;; ) {
+ if (u < r->uri.data) {
+ return NGX_HTTP_PARSE_INVALID_REQUEST;
+ }
+ if (*u == '/') {
+ u++;
+ break;
+ }
u--;
}
break;
@@ -1218,7 +1162,6 @@
ch = *p++;
break;
-#endif
case sw_quoted:
r->quoted_uri = 1;
@@ -1256,7 +1199,7 @@
ch = *p++;
} else if (ch == '\0') {
- r->zero_in_uri = 1;
+ return NGX_HTTP_PARSE_INVALID_REQUEST;
}
state = quoted_state;
@@ -1358,8 +1301,7 @@
}
if (ch == '\0') {
- *flags |= NGX_HTTP_ZERO_IN_URI;
- continue;
+ goto unsafe;
}
if (ngx_path_separator(ch) && len > 2) {
@@ -1369,20 +1311,6 @@
if (p[0] == '.' && p[1] == '.' && ngx_path_separator(p[2])) {
goto unsafe;
}
-
-#if (NGX_WIN32)
-
- if (len > 3) {
-
- /* detect "/.../" */
-
- if (p[0] == '.' && p[1] == '.' && p[2] == '.'
- && ngx_path_separator(p[3]))
- {
- goto unsafe;
- }
- }
-#endif
}
}
@@ -1390,8 +1318,10 @@
unsafe:
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "unsafe URI \"%V\" was detected", uri);
+ if (*flags & NGX_HTTP_LOG_UNSAFE) {
+ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+ "unsafe URI \"%V\" was detected", uri);
+ }
return NGX_ERROR;
}
@@ -1515,34 +1445,19 @@
void
ngx_http_split_args(ngx_http_request_t *r, ngx_str_t *uri, ngx_str_t *args)
{
- u_char ch, *p, *last;
-
- p = uri->data;
-
- last = p + uri->len;
-
- args->len = 0;
-
- while (p < last) {
-
- ch = *p++;
+ u_char *p, *last;
- if (ch == '?') {
- args->len = last - p;
- args->data = p;
+ last = uri->data + uri->len;
- uri->len = p - 1 - uri->data;
+ p = ngx_strlchr(uri->data, last, '?');
- if (ngx_strlchr(p, last, '\0') != NULL) {
- r->zero_in_uri = 1;
- }
+ if (p) {
+ uri->len = p - uri->data;
+ p++;
+ args->len = last - p;
+ args->data = p;
- return;
- }
-
- if (ch == '\0') {
- r->zero_in_uri = 1;
- continue;
- }
+ } else {
+ args->len = 0;
}
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/ngx_http_parse_time.c
^
|
@@ -8,13 +8,15 @@
#include <ngx_core.h>
-static int mday[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+static ngx_uint_t mday[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
time_t
ngx_http_parse_time(u_char *value, size_t len)
{
- u_char *p, *end;
- int day, month, year, hour, min, sec;
+ u_char *p, *end;
+ ngx_int_t month;
+ ngx_uint_t day, year, hour, min, sec;
+ uint64_t time;
enum {
no = 0,
rfc822, /* Tue, 10 Nov 2002 23:50:13 */
@@ -229,14 +231,6 @@
return NGX_ERROR;
}
-#if (NGX_TIME_T_SIZE <= 4)
-
- if (year >= 2038) {
- return NGX_ERROR;
- }
-
-#endif
-
/*
* shift new year to March 1 and start months from 1 (not 0),
* it is needed for Gauss' formula
@@ -249,7 +243,7 @@
/* Gauss' formula for Grigorian days since March 1, 1 BC */
- return (
+ time = (uint64_t) (
/* days in years including leap years since March 1, 1 BC */
365 * year + year / 4 - year / 100 + year / 400
@@ -268,4 +262,14 @@
*/
- 719527 + 31 + 28) * 86400 + hour * 3600 + min * 60 + sec;
+
+#if (NGX_TIME_T_SIZE <= 4)
+
+ if (time > 0x7fffffff) {
+ return NGX_ERROR;
+ }
+
+#endif
+
+ return (time_t) time;
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/ngx_http_request.c
^
|
@@ -31,7 +31,8 @@
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 ssize_t ngx_http_validate_host(u_char *host, size_t len);
+static ssize_t ngx_http_validate_host(ngx_http_request_t *r, u_char **host,
+ size_t len, ngx_uint_t alloc);
static ngx_int_t ngx_http_find_virtual_server(ngx_http_request_t *r,
u_char *host, size_t len);
@@ -129,7 +130,7 @@
{ ngx_string("Keep-Alive"), offsetof(ngx_http_headers_in_t, keep_alive),
ngx_http_process_header_line },
-#if (NGX_HTTP_PROXY || NGX_HTTP_REALIP)
+#if (NGX_HTTP_PROXY || NGX_HTTP_REALIP || NGX_HTTP_GEO)
{ ngx_string("X-Forwarded-For"),
offsetof(ngx_http_headers_in_t, x_forwarded_for),
ngx_http_process_header_line },
@@ -384,6 +385,7 @@
r->loc_conf = cscf->ctx->loc_conf;
rev->handler = ngx_http_process_request_line;
+ r->read_event_handler = ngx_http_block_reading;
#if (NGX_HTTP_SSL)
@@ -451,13 +453,15 @@
sizeof(ngx_table_elt_t))
!= NGX_OK)
{
- ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+ ngx_destroy_pool(r->pool);
+ ngx_http_close_connection(c);
return;
}
r->ctx = ngx_pcalloc(r->pool, sizeof(void *) * ngx_http_max_module);
if (r->ctx == NULL) {
- ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+ ngx_destroy_pool(r->pool);
+ ngx_http_close_connection(c);
return;
}
@@ -466,7 +470,8 @@
r->variables = ngx_pcalloc(r->pool, cmcf->variables.nelts
* sizeof(ngx_http_variable_value_t));
if (r->variables == NULL) {
- ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+ ngx_destroy_pool(r->pool);
+ ngx_http_close_connection(c);
return;
}
@@ -546,7 +551,7 @@
}
if (n == 1) {
- if (buf[0] == 0x80 /* SSLv2 */ || buf[0] == 0x16 /* SSLv3/TLSv1 */) {
+ if (buf[0] & 0x80 /* SSLv2 */ || buf[0] == 0x16 /* SSLv3/TLSv1 */) {
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, rev->log, 0,
"https ssl handshake: 0x%02Xd", buf[0]);
@@ -619,6 +624,7 @@
ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg)
{
size_t len;
+ u_char *host;
const char *servername;
ngx_connection_t *c;
ngx_http_request_t *r;
@@ -643,7 +649,15 @@
r = c->data;
- if (ngx_http_find_virtual_server(r, (u_char *) servername, len) != NGX_OK) {
+ host = (u_char *) servername;
+
+ len = ngx_http_validate_host(r, &host, len, 1);
+
+ if (len <= 0) {
+ return SSL_TLSEXT_ERR_NOACK;
+ }
+
+ if (ngx_http_find_virtual_server(r, host, len) != NGX_OK) {
return SSL_TLSEXT_ERR_NOACK;
}
@@ -662,6 +676,7 @@
static void
ngx_http_process_request_line(ngx_event_t *rev)
{
+ u_char *host;
ssize_t n;
ngx_int_t rc, rv;
ngx_connection_t *c;
@@ -737,6 +752,7 @@
r->unparsed_uri.len = r->uri_end - r->uri_start;
r->unparsed_uri.data = r->uri_start;
+ r->valid_unparsed_uri = 1;
r->method_name.len = r->method_end - r->request_start + 1;
r->method_name.data = r->request_line.data;
@@ -763,6 +779,39 @@
r->args.data = r->args_start;
}
+#if (NGX_WIN32)
+ {
+ u_char *p;
+
+ p = r->uri.data + r->uri.len - 1;
+
+ while (p > r->uri.data) {
+
+ if (*p == ' ') {
+ p--;
+ continue;
+ }
+
+ if (*p == '.') {
+ p--;
+ continue;
+ }
+
+ if (ngx_strncasecmp(p - 6, (u_char *) "::$data", 7) == 0) {
+ p -= 7;
+ continue;
+ }
+
+ break;
+ }
+
+ if (p != r->uri.data + r->uri.len - 1) {
+ r->uri.len = p + 1 - r->uri.data;
+ ngx_http_set_exten(r);
+ }
+
+ }
+#endif
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
"http request line: \"%V\"", &r->request_line);
@@ -777,18 +826,25 @@
"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) {
+ host = r->host_start;
+ n = ngx_http_validate_host(r, &host,
+ r->host_end - r->host_start, 0);
+
+ 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;
}
+ if (n < 0) {
+ ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+ return;
+ }
+
r->headers_in.server.len = n;
- r->headers_in.server.data = r->host_start;
+ r->headers_in.server.data = host;
}
if (r->http_version < NGX_HTTP_VERSION_10) {
@@ -869,9 +925,10 @@
static void
ngx_http_process_request_headers(ngx_event_t *rev)
{
+ u_char *p;
+ size_t len;
ssize_t n;
ngx_int_t rc, rv;
- ngx_str_t header;
ngx_table_elt_t *h;
ngx_connection_t *c;
ngx_http_header_t *hh;
@@ -911,19 +968,25 @@
}
if (rv == NGX_DECLINED) {
- header.len = r->header_in->end - r->header_name_start;
- header.data = r->header_name_start;
+ p = r->header_name_start;
+
+ if (p == NULL) {
+ ngx_log_error(NGX_LOG_INFO, c->log, 0,
+ "client sent too large request");
+ ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
+ return;
+ }
+
+ len = r->header_in->end - p;
- if (header.len > NGX_MAX_ERROR_STR - 300) {
- header.len = NGX_MAX_ERROR_STR - 300;
- header.data[header.len++] = '.';
- header.data[header.len++] = '.';
- header.data[header.len++] = '.';
+ if (len > NGX_MAX_ERROR_STR - 300) {
+ len = NGX_MAX_ERROR_STR - 300;
+ p[len++] = '.'; p[len++] = '.'; p[len++] = '.';
}
ngx_log_error(NGX_LOG_INFO, c->log, 0,
- "client sent too long header line: \"%V\"",
- &header);
+ "client sent too long header line: \"%*s\"",
+ len, r->header_name_start);
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
return;
}
@@ -945,12 +1008,10 @@
/* there was error while a header line parsing */
- header.len = r->header_end - r->header_name_start;
- header.data = r->header_name_start;
-
ngx_log_error(NGX_LOG_INFO, c->log, 0,
- "client sent invalid header line: \"%V\"",
- &header);
+ "client sent invalid header line: \"%*s\"",
+ r->header_end - r->header_name_start,
+ r->header_name_start);
continue;
}
@@ -1030,11 +1091,10 @@
/* rc == NGX_HTTP_PARSE_INVALID_HEADER: "\r" is not followed by "\n" */
- header.len = r->header_end - r->header_name_start;
- header.data = r->header_name_start;
ngx_log_error(NGX_LOG_INFO, c->log, 0,
- "client sent invalid header line: \"%V\\r...\"",
- &header);
+ "client sent invalid header line: \"%*s\\r...\"",
+ r->header_end - r->header_name_start,
+ r->header_name_start);
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
return;
}
@@ -1292,27 +1352,34 @@
ngx_http_process_host(ngx_http_request_t *r, ngx_table_elt_t *h,
ngx_uint_t offset)
{
- ssize_t len;
+ u_char *host;
+ 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);
+ host = h->value.data;
+ len = ngx_http_validate_host(r, &host, h->value.len, 0);
- if (len <= 0) {
+ 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 (len < 0) {
+ ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+ 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;
+ r->headers_in.server.data = host;
return NGX_OK;
}
@@ -1362,8 +1429,13 @@
r->headers_in.msie4 = 1;
/* fall through */
case '5':
- case '6':
r->headers_in.msie6 = 1;
+ break;
+ case '6':
+ if (ngx_strstrn(msie + 8, "SV1", 3 - 1) == NULL) {
+ r->headers_in.msie6 = 1;
+ }
+ break;
}
}
@@ -1387,6 +1459,12 @@
if (ngx_strstrn(user_agent, "Gecko/", 6 - 1)) {
r->headers_in.gecko = 1;
+ } else if (ngx_strstrn(user_agent, "Chrome/", 7 - 1)) {
+ r->headers_in.chrome = 1;
+
+ } else if (ngx_strstrn(user_agent, "Safari/", 7 - 1)) {
+ r->headers_in.safari = 1;
+
} else if (ngx_strstrn(user_agent, "Konqueror", 9 - 1)) {
r->headers_in.konqueror = 1;
}
@@ -1505,7 +1583,7 @@
sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module);
- if (sscf->verify == 1) {
+ if (sscf->verify) {
rc = SSL_get_verify_result(c->ssl->connection);
if (rc != X509_V_OK) {
@@ -1520,20 +1598,22 @@
return;
}
- cert = SSL_get_peer_certificate(c->ssl->connection);
+ if (sscf->verify == 1) {
+ cert = SSL_get_peer_certificate(c->ssl->connection);
- if (cert == NULL) {
- ngx_log_error(NGX_LOG_INFO, c->log, 0,
- "client sent no required SSL certificate");
+ if (cert == NULL) {
+ ngx_log_error(NGX_LOG_INFO, c->log, 0,
+ "client sent no required SSL certificate");
- ngx_ssl_remove_cached_session(sscf->ssl.ctx,
+ ngx_ssl_remove_cached_session(sscf->ssl.ctx,
(SSL_get0_session(c->ssl->connection)));
- ngx_http_finalize_request(r, NGX_HTTPS_NO_CERT);
- return;
- }
+ ngx_http_finalize_request(r, NGX_HTTPS_NO_CERT);
+ return;
+ }
- X509_free(cert);
+ X509_free(cert);
+ }
}
}
@@ -1561,21 +1641,23 @@
static ssize_t
-ngx_http_validate_host(u_char *host, size_t len)
+ngx_http_validate_host(ngx_http_request_t *r, u_char **host, size_t len,
+ ngx_uint_t alloc)
{
- u_char ch;
- size_t i, last;
- ngx_uint_t dot;
+ u_char *h, ch;
+ size_t i, last;
+ ngx_uint_t dot;
last = len;
+ h = *host;
dot = 0;
for (i = 0; i < len; i++) {
- ch = host[i];
+ ch = h[i];
if (ch == '.') {
if (dot) {
- return -1;
+ return 0;
}
dot = 1;
@@ -1590,7 +1672,11 @@
}
if (ngx_path_separator(ch) || ch == '\0') {
- return -1;
+ return 0;
+ }
+
+ if (ch >= 'A' || ch < 'Z') {
+ alloc = 1;
}
}
@@ -1598,6 +1684,15 @@
last--;
}
+ if (alloc) {
+ *host = ngx_pnalloc(r->pool, last) ;
+ if (*host == NULL) {
+ return -1;
+ }
+
+ ngx_strlow(*host, h, last);
+ }
+
return last;
}
@@ -1605,29 +1700,15 @@
static ngx_int_t
ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len)
{
- u_char *server;
- ngx_uint_t hash;
ngx_http_core_loc_conf_t *clcf;
ngx_http_core_srv_conf_t *cscf;
- u_char buf[32];
if (r->virtual_names == NULL) {
return NGX_DECLINED;
}
- if (len <= 32) {
- server = buf;
-
- } else {
- server = ngx_pnalloc(r->pool, len);
- if (server == NULL) {
- return NGX_ERROR;
- }
- }
-
- hash = ngx_hash_strlow(server, host, len);
-
- cscf = ngx_hash_find_combined(&r->virtual_names->names, hash, server, len);
+ cscf = ngx_hash_find_combined(&r->virtual_names->names,
+ ngx_hash_key(host, len), host, len);
if (cscf) {
goto found;
@@ -1635,7 +1716,7 @@
#if (NGX_PCRE)
- if (r->virtual_names->nregex) {
+ if (len && r->virtual_names->nregex) {
size_t ncaptures;
ngx_int_t n;
ngx_uint_t i;
@@ -1643,7 +1724,7 @@
ngx_http_server_name_t *sn;
name.len = len;
- name.data = server;
+ name.data = host;
ncaptures = 0;
@@ -1659,16 +1740,6 @@
if (r->captures == NULL) {
return NGX_ERROR;
}
-
- if (server == buf) {
- server = ngx_pnalloc(r->pool, len);
- if (server == NULL) {
- return NGX_ERROR;
- }
-
- ngx_memcpy(server, buf, len);
- name.data = server;
- }
}
n = ngx_regex_exec(sn[i].regex, &name, r->captures, ncaptures);
@@ -1690,7 +1761,7 @@
cscf = sn[i].core_srv_conf;
r->ncaptures = ncaptures;
- r->captures_data = server;
+ r->captures_data = host;
goto found;
}
@@ -2691,7 +2762,14 @@
}
if (flags & NGX_HTTP_LAST) {
- b->last_buf = 1;
+
+ if (r == r->main && !r->post_action) {
+ b->last_buf = 1;
+
+ } else {
+ b->sync = 1;
+ b->last_in_chain = 1;
+ }
}
if (flags & NGX_HTTP_FLUSH) {
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/ngx_http_request.h
^
|
@@ -57,9 +57,10 @@
#define NGX_HTTP_PARSE_INVALID_HEADER 13
-#define NGX_HTTP_ZERO_IN_URI 1
+/* unused 1 */
#define NGX_HTTP_SUBREQUEST_IN_MEMORY 2
#define NGX_HTTP_SUBREQUEST_WAITED 4
+#define NGX_HTTP_LOG_UNSAFE 8
#define NGX_HTTP_OK 200
@@ -184,7 +185,7 @@
ngx_table_elt_t *keep_alive;
-#if (NGX_HTTP_PROXY || NGX_HTTP_REALIP)
+#if (NGX_HTTP_PROXY || NGX_HTTP_REALIP || NGX_HTTP_GEO)
ngx_table_elt_t *x_forwarded_for;
#endif
@@ -219,6 +220,8 @@
unsigned msie6:1;
unsigned opera:1;
unsigned gecko:1;
+ unsigned chrome:1;
+ unsigned safari:1;
unsigned konqueror:1;
} ngx_http_headers_in_t;
@@ -427,9 +430,6 @@
/* URI with "+" */
unsigned plus_in_uri:1;
- /* URI with "\0" or "%00" */
- unsigned zero_in_uri:1;
-
unsigned invalid_header:1;
unsigned valid_location:1;
@@ -450,7 +450,12 @@
#if (NGX_HTTP_CACHE)
unsigned cached:1;
#endif
- unsigned gzip:2;
+
+#if (NGX_HTTP_GZIP)
+ unsigned gzip_tested:1;
+ unsigned gzip_ok:1;
+ unsigned gzip_vary:1;
+#endif
unsigned proxy:1;
unsigned bypass_cache:1;
@@ -488,7 +493,6 @@
unsigned root_tested:1;
unsigned done:1;
unsigned logged:1;
- unsigned utf8:1;
unsigned buffered:4;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/ngx_http_request_body.c
^
|
@@ -458,6 +458,7 @@
if (size) {
if (r->headers_in.content_length_n > size) {
+ r->header_in->pos += size;
r->headers_in.content_length_n -= size;
} else {
@@ -559,12 +560,16 @@
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http read discarded body");
- do {
+ for ( ;; ) {
if (r->headers_in.content_length_n == 0) {
r->read_event_handler = ngx_http_block_reading;
return NGX_OK;
}
+ if (!r->connection->read->ready) {
+ return NGX_AGAIN;
+ }
+
size = (r->headers_in.content_length_n > NGX_HTTP_DISCARD_BUFFER_SIZE) ?
NGX_HTTP_DISCARD_BUFFER_SIZE:
(size_t) r->headers_in.content_length_n;
@@ -585,10 +590,7 @@
}
r->headers_in.content_length_n -= n;
-
- } while (r->connection->read->ready);
-
- return NGX_AGAIN;
+ }
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/ngx_http_script.c
^
|
@@ -561,7 +561,7 @@
new = ngx_array_push_n(codes, size);
if (new == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
if (code) {
@@ -1074,11 +1074,7 @@
return;
}
- if (ngx_http_set_exten(r) != NGX_OK) {
- e->ip = ngx_http_script_exit;
- e->status = NGX_HTTP_INTERNAL_SERVER_ERROR;
- return;
- }
+ ngx_http_set_exten(r);
}
e->ip += sizeof(ngx_http_script_regex_end_code_t);
@@ -1421,7 +1417,10 @@
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
!= NGX_OK)
{
- if (of.err != NGX_ENOENT && of.err != NGX_ENOTDIR) {
+ if (of.err != NGX_ENOENT
+ && of.err != NGX_ENOTDIR
+ && of.err != NGX_ENAMETOOLONG)
+ {
ngx_log_error(NGX_LOG_CRIT, r->connection->log, of.err,
"%s \"%s\" failed", of.failed, value->data);
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/ngx_http_special_response.c
^
|
@@ -31,13 +31,13 @@
;
-static u_char ngx_http_msie_stub[] =
-"<!-- The padding to disable MSIE's friendly error page -->" CRLF
-"<!-- The padding to disable MSIE's friendly error page -->" CRLF
-"<!-- The padding to disable MSIE's friendly error page -->" CRLF
-"<!-- The padding to disable MSIE's friendly error page -->" CRLF
-"<!-- The padding to disable MSIE's friendly error page -->" CRLF
-"<!-- The padding to disable MSIE's friendly error page -->" CRLF
+static u_char ngx_http_msie_padding[] =
+"<!-- a padding to disable MSIE and Chrome friendly error page -->" CRLF
+"<!-- a padding to disable MSIE and Chrome friendly error page -->" CRLF
+"<!-- a padding to disable MSIE and Chrome friendly error page -->" CRLF
+"<!-- a padding to disable MSIE and Chrome friendly error page -->" CRLF
+"<!-- a padding to disable MSIE and Chrome friendly error page -->" CRLF
+"<!-- a padding to disable MSIE and Chrome friendly error page -->" CRLF
;
@@ -517,8 +517,6 @@
r->err_status = overwrite;
- r->zero_in_uri = 0;
-
if (ngx_http_complex_value(r, &err_page->value, &uri) != NGX_OK) {
return NGX_ERROR;
}
@@ -598,12 +596,12 @@
r->headers_out.content_length_n = ngx_http_error_pages[err].len
+ len;
if (clcf->msie_padding
- && r->headers_in.msie
+ && (r->headers_in.msie || r->headers_in.chrome)
&& r->http_version >= NGX_HTTP_VERSION_10
&& err >= NGX_HTTP_LEVEL_300)
{
r->headers_out.content_length_n +=
- sizeof(ngx_http_msie_stub) - 1;
+ sizeof(ngx_http_msie_padding) - 1;
msie_padding = 1;
}
@@ -671,8 +669,8 @@
}
b->memory = 1;
- b->pos = ngx_http_msie_stub;
- b->last = ngx_http_msie_stub + sizeof(ngx_http_msie_stub) - 1;
+ b->pos = ngx_http_msie_padding;
+ b->last = ngx_http_msie_padding + sizeof(ngx_http_msie_padding) - 1;
out[1].next = &out[2];
out[2].buf = b;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/ngx_http_upstream.c
^
|
@@ -14,6 +14,8 @@
ngx_http_upstream_t *u);
static ngx_int_t ngx_http_upstream_cache_send(ngx_http_request_t *r,
ngx_http_upstream_t *u);
+static ngx_int_t ngx_http_upstream_cache_status(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
#endif
static void ngx_http_upstream_resolve_handler(ngx_resolver_ctx_t *ctx);
@@ -159,6 +161,12 @@
offsetof(ngx_http_upstream_headers_in_t, last_modified),
ngx_http_upstream_copy_last_modified, 0, 0 },
+ { ngx_string("ETag"),
+ ngx_http_upstream_process_header_line,
+ offsetof(ngx_http_upstream_headers_in_t, etag),
+ ngx_http_upstream_copy_header_line,
+ offsetof(ngx_http_headers_out_t, etag), 0 },
+
{ ngx_string("Server"),
ngx_http_upstream_process_header_line,
offsetof(ngx_http_upstream_headers_in_t, server),
@@ -222,19 +230,19 @@
{ ngx_string("X-Accel-Redirect"),
ngx_http_upstream_process_header_line,
offsetof(ngx_http_upstream_headers_in_t, x_accel_redirect),
- ngx_http_upstream_ignore_header_line, 0, 0 },
+ ngx_http_upstream_copy_header_line, 0, 0 },
{ ngx_string("X-Accel-Limit-Rate"),
ngx_http_upstream_process_limit_rate, 0,
- ngx_http_upstream_ignore_header_line, 0, 0 },
+ ngx_http_upstream_copy_header_line, 0, 0 },
{ ngx_string("X-Accel-Buffering"),
ngx_http_upstream_process_buffering, 0,
- ngx_http_upstream_ignore_header_line, 0, 0 },
+ ngx_http_upstream_copy_header_line, 0, 0 },
{ ngx_string("X-Accel-Charset"),
ngx_http_upstream_process_charset, 0,
- ngx_http_upstream_ignore_header_line, 0, 0 },
+ ngx_http_upstream_copy_header_line, 0, 0 },
#if (NGX_HTTP_GZIP)
{ ngx_string("Content-Encoding"),
@@ -316,6 +324,14 @@
ngx_http_upstream_response_length_variable, 0,
NGX_HTTP_VAR_NOHASH|NGX_HTTP_VAR_NOCACHEABLE, 0 },
+#if (NGX_HTTP_CACHE)
+
+ { ngx_string("upstream_cache_status"), NULL,
+ ngx_http_upstream_cache_status, 0,
+ NGX_HTTP_VAR_NOHASH|NGX_HTTP_VAR_NOCACHEABLE, 0 },
+
+#endif
+
{ ngx_null_string, NULL, NULL, 0, 0, 0 }
};
@@ -338,6 +354,34 @@
};
+ngx_int_t
+ngx_http_upstream_create(ngx_http_request_t *r)
+{
+ ngx_http_upstream_t *u;
+
+ u = r->upstream;
+
+ if (u && u->cleanup) {
+ ngx_http_upstream_cleanup(r);
+ }
+
+ u = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_t));
+ if (u == NULL) {
+ return NGX_ERROR;
+ }
+
+ r->upstream = u;
+
+ u->peer.log = r->connection->log;
+ u->peer.log_error = NGX_ERROR_ERR;
+#if (NGX_THREADS)
+ u->peer.lock = &r->connection->lock;
+#endif
+
+ return NGX_OK;
+}
+
+
void
ngx_http_upstream_init(ngx_http_request_t *r)
{
@@ -541,6 +585,13 @@
ngx_int_t rc;
ngx_http_cache_t *c;
+ if (u->conf->no_cache) {
+ rc = ngx_http_cache(r, u->conf->no_cache);
+ if (rc != NGX_OK) {
+ return rc;
+ }
+ }
+
if (!(r->method & u->conf->cache_methods)) {
return NGX_DECLINED;
}
@@ -569,27 +620,49 @@
ngx_http_file_cache_create_key(r);
+ if (c->header_start >= u->conf->buffer_size) {
+ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+ "cache key too large, increase upstream buffer size %uz",
+ u->conf->buffer_size);
+
+ r->cache = NULL;
+ return NGX_DECLINED;
+ }
+
u->cacheable = 1;
c->min_uses = u->conf->cache_min_uses;
c->body_start = u->conf->buffer_size;
c->file_cache = u->conf->cache->data;
+ u->cache_status = NGX_HTTP_CACHE_MISS;
+
rc = ngx_http_file_cache_open(r);
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http upstream cache: %i", rc);
- if (rc == NGX_HTTP_CACHE_UPDATING) {
+ switch (rc) {
+
+ case NGX_HTTP_CACHE_UPDATING:
+
if (u->conf->cache_use_stale & NGX_HTTP_UPSTREAM_FT_UPDATING) {
+ u->cache_status = rc;
rc = NGX_OK;
} else {
rc = NGX_HTTP_CACHE_STALE;
}
+
+ break;
+
+ case NGX_OK:
+ u->cache_status = NGX_HTTP_CACHE_HIT;
}
- if (rc == NGX_OK) {
+ switch (rc) {
+
+ case NGX_OK:
rc = ngx_http_upstream_cache_send(r, u);
@@ -597,17 +670,21 @@
return rc;
}
- } else if (rc == NGX_ERROR) {
+ break;
+
+ case NGX_ERROR:
return NGX_ERROR;
- } else if (rc == NGX_HTTP_CACHE_STALE) {
+ case NGX_HTTP_CACHE_STALE:
c->valid_sec = 0;
- u->stale_cache = 1;
u->buffer.start = NULL;
+ u->cache_status = NGX_HTTP_CACHE_EXPIRED;
- } else if (rc == NGX_DECLINED) {
+ break;
+
+ case NGX_DECLINED:
if ((size_t) (u->buffer.end - u->buffer.start) < u->conf->buffer_size) {
u->buffer.start = NULL;
@@ -617,14 +694,20 @@
u->buffer.last = u->buffer.pos;
}
- } else if (rc == NGX_AGAIN) {
+ break;
+
+ case NGX_AGAIN:
u->cacheable = 0;
- } else {
+ break;
+
+ default:
/* cached NGX_HTTP_BAD_GATEWAY, NGX_HTTP_GATEWAY_TIME_OUT, etc. */
+ u->cache_status = NGX_HTTP_CACHE_HIT;
+
return rc;
}
@@ -640,8 +723,14 @@
ngx_int_t rc;
ngx_http_cache_t *c;
+ r->cached = 1;
c = r->cache;
+ if (c->header_start == c->body_start) {
+ r->http_version = NGX_HTTP_VERSION_9;
+ return ngx_http_cache_send(r);
+ }
+
/* TODO: cache stack */
u->buffer = *c->buf;
@@ -1521,12 +1610,15 @@
#if (NGX_HTTP_CACHE)
- if (u->stale_cache && (u->conf->cache_use_stale & un->mask)) {
+ if (u->cache_status == NGX_HTTP_CACHE_EXPIRED
+ && (u->conf->cache_use_stale & un->mask))
+ {
ngx_int_t rc;
rc = u->reinit_request(r);
if (rc == NGX_OK) {
+ u->cache_status = NGX_HTTP_CACHE_STALE;
rc = ngx_http_upstream_cache_send(r, u);
}
@@ -1690,17 +1782,13 @@
uri = &u->headers_in.x_accel_redirect->value;
args.len = 0;
args.data = NULL;
- flags = 0;
+ flags = NGX_HTTP_LOG_UNSAFE;
if (ngx_http_parse_unsafe_uri(r, uri, &args, &flags) != NGX_OK) {
ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND);
return NGX_DONE;
}
- if (flags & NGX_HTTP_ZERO_IN_URI) {
- r->zero_in_uri = 1;
- }
-
if (r->method != NGX_HTTP_HEAD) {
r->method = NGX_HTTP_GET;
}
@@ -1991,11 +2079,6 @@
r->cache->date = now;
r->cache->body_start = (u_short) (u->buffer.pos - u->buffer.start);
- if (r->headers_out.content_length_n != -1) {
- r->cache->length = r->cache->body_start
- + r->headers_out.content_length_n;
- }
-
ngx_http_file_cache_set_header(r, u->buffer.start);
} else {
@@ -2007,6 +2090,10 @@
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
"http cacheable: %d", u->cacheable);
+ if (u->cacheable == 0 && r->cache) {
+ ngx_http_file_cache_free(r, u->pipe->temp_file);
+ }
+
#endif
p = u->pipe;
@@ -2569,7 +2656,6 @@
ext.time = -1;
ext.create_path = 1;
ext.delete_file = 1;
- ext.log_rename_error = 1;
ext.log = r->connection->log;
if (u->headers_in.last_modified) {
@@ -2596,6 +2682,8 @@
}
}
+ path.len--;
+
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"upstream stores \"%s\" to \"%s\"",
tf->file.name.data, path.data);
@@ -2681,12 +2769,15 @@
#if (NGX_HTTP_CACHE)
- if (u->stale_cache && (u->conf->cache_use_stale & ft_type)) {
+ if (u->cache_status == NGX_HTTP_CACHE_EXPIRED
+ && (u->conf->cache_use_stale & ft_type))
+ {
ngx_int_t rc;
rc = u->reinit_request(r);
if (rc == NGX_OK) {
+ u->cache_status = NGX_HTTP_CACHE_STALE;
rc = ngx_http_upstream_cache_send(r, u);
}
@@ -2759,6 +2850,7 @@
if (u->cleanup) {
*u->cleanup = NULL;
+ u->cleanup = NULL;
}
if (u->state && u->state->response_sec) {
@@ -2814,7 +2906,7 @@
#if (NGX_HTTP_CACHE)
- if (u->cacheable) {
+ if (u->cacheable && r->cache) {
time_t valid;
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
@@ -2848,7 +2940,7 @@
r->connection->log->action = "sending to client";
- if (rc == 0 && r == r->main && !r->post_action) {
+ if (rc == 0) {
rc = ngx_http_send_special(r, NGX_HTTP_LAST);
}
@@ -2922,16 +3014,18 @@
return NGX_OK;
}
- last = h->value.data + h->value.len;
+ p = h->value.data;
+ last = p + h->value.len;
- if (ngx_strlcasestrn(h->value.data, last, (u_char *) "no-cache", 8 - 1)
- != NULL)
+ if (ngx_strlcasestrn(p, last, (u_char *) "no-cache", 8 - 1) != NULL
+ || ngx_strlcasestrn(p, last, (u_char *) "no-store", 8 - 1) != NULL
+ || ngx_strlcasestrn(p, last, (u_char *) "private", 7 - 1) != NULL)
{
u->cacheable = 0;
return NGX_OK;
}
- p = ngx_strlcasestrn(h->value.data, last, (u_char *) "max-age=", 8 - 1);
+ p = ngx_strlcasestrn(p, last, (u_char *) "max-age=", 8 - 1);
if (p == NULL) {
return NGX_OK;
@@ -2940,7 +3034,7 @@
n = 0;
for (p += 8; p < last; p++) {
- if (*p == ';' || *p == ' ') {
+ if (*p == ',' || *p == ';' || *p == ' ') {
break;
}
@@ -3261,10 +3355,11 @@
*ho = *h;
+ r->headers_out.last_modified = ho;
+
#if (NGX_HTTP_CACHE)
- if (r->cached || r->upstream->cacheable) {
- r->headers_out.last_modified = ho;
+ if (r->upstream->cacheable) {
r->headers_out.last_modified_time = ngx_http_parse_time(h->value.data,
h->value.len);
}
@@ -3388,6 +3483,8 @@
*ho = *h;
+ r->headers_out.accept_ranges = ho;
+
return NGX_OK;
}
@@ -3714,6 +3811,33 @@
}
+#if (NGX_HTTP_CACHE)
+
+ngx_int_t
+ngx_http_upstream_cache_status(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data)
+{
+ ngx_uint_t n;
+
+ if (r->upstream == NULL || r->upstream->cache_status == 0) {
+ v->not_found = 1;
+ return NGX_OK;
+ }
+
+ n = r->upstream->cache_status - 1;
+
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
+ v->len = ngx_http_cache_status[n].len;
+ v->data = ngx_http_cache_status[n].data;
+
+ return NGX_OK;
+}
+
+#endif
+
+
static char *
ngx_http_upstream(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
{
@@ -4197,7 +4321,7 @@
sizeof(ngx_http_upstream_srv_conf_t *))
!= NGX_OK)
{
- return NGX_CONF_ERROR;
+ return NULL;
}
return umcf;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/ngx_http_upstream.h
^
|
@@ -160,6 +160,7 @@
ngx_uint_t cache_methods;
ngx_array_t *cache_valid;
+ ngx_array_t *no_cache; /* ngx_http_complex_value_t */
#endif
ngx_array_t *store_lengths;
@@ -298,7 +299,7 @@
unsigned accel:1;
unsigned ssl:1;
#if (NGX_HTTP_CACHE)
- unsigned stale_cache:1;
+ unsigned cache_status:3;
#endif
unsigned buffering:1;
@@ -317,6 +318,7 @@
ngx_int_t ngx_http_upstream_header_variable(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
+ngx_int_t ngx_http_upstream_create(ngx_http_request_t *r);
void ngx_http_upstream_init(ngx_http_request_t *r);
ngx_http_upstream_srv_conf_t *ngx_http_upstream_add(ngx_conf_t *cf,
ngx_url_t *u, ngx_uint_t flags);
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/ngx_http_variables.c
^
|
@@ -14,6 +14,8 @@
ngx_http_variable_value_t *v, uintptr_t data);
static void ngx_http_variable_request_set(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_variable_request_get_size(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
static void ngx_http_variable_request_set_size(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_header(ngx_http_request_t *r,
@@ -25,6 +27,8 @@
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_unknown_header_out(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_variable_request_line(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_cookie(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_argument(ngx_http_request_t *r,
@@ -164,8 +168,7 @@
offsetof(ngx_http_request_t, uri),
NGX_HTTP_VAR_NOCACHEABLE, 0 },
- { ngx_string("request"), NULL, ngx_http_variable_request,
- offsetof(ngx_http_request_t, request_line), 0, 0 },
+ { ngx_string("request"), NULL, ngx_http_variable_request_line, 0, 0, 0 },
{ ngx_string("document_root"), NULL,
ngx_http_variable_document_root, 0, NGX_HTTP_VAR_NOCACHEABLE, 0 },
@@ -193,7 +196,8 @@
{ ngx_string("server_name"), NULL, ngx_http_variable_server_name, 0, 0, 0 },
{ ngx_string("request_method"), NULL,
- ngx_http_variable_request_method, 0, 0, 0 },
+ ngx_http_variable_request_method, 0,
+ NGX_HTTP_VAR_NOCACHEABLE, 0 },
{ ngx_string("remote_user"), NULL, ngx_http_variable_remote_user, 0, 0, 0 },
@@ -237,7 +241,7 @@
offsetof(ngx_http_request_t, headers_out.cache_control), 0, 0 },
{ ngx_string("limit_rate"), ngx_http_variable_request_set_size,
- ngx_http_variable_request,
+ ngx_http_variable_request_get_size,
offsetof(ngx_http_request_t, limit_rate),
NGX_HTTP_VAR_CHANGEABLE|NGX_HTTP_VAR_NOCACHEABLE, 0 },
@@ -437,8 +441,7 @@
ngx_http_variable_value_t *
-ngx_http_get_variable(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key,
- ngx_uint_t nowarn)
+ngx_http_get_variable(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key)
{
ngx_http_variable_t *v;
ngx_http_variable_value_t *vv;
@@ -450,7 +453,7 @@
if (v) {
if (v->flags & NGX_HTTP_VAR_INDEXED) {
- return ngx_http_get_indexed_variable(r, v->index);
+ return ngx_http_get_flushed_variable(r, v->index);
} else {
@@ -491,7 +494,7 @@
return NULL;
}
- if (ngx_strncmp(name->data, "upstream_http_", 10) == 0) {
+ if (ngx_strncmp(name->data, "upstream_http_", 14) == 0) {
if (ngx_http_upstream_header_variable(r, vv, (uintptr_t) name)
== NGX_OK)
@@ -522,11 +525,6 @@
vv->not_found = 1;
- if (nowarn == 0) {
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "unknown \"%V\" variable", name);
- }
-
return vv;
}
@@ -567,6 +565,28 @@
}
+static ngx_int_t
+ngx_http_variable_request_get_size(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data)
+{
+ size_t *sp;
+
+ sp = (size_t *) ((char *) r + data);
+
+ v->data = ngx_pnalloc(r->pool, NGX_SIZE_T_LEN);
+ if (v->data == NULL) {
+ return NGX_ERROR;
+ }
+
+ v->len = ngx_sprintf(v->data, "%uz", *sp) - v->data;
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
+
+ return NGX_OK;
+}
+
+
static void
ngx_http_variable_request_set_size(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data)
@@ -751,6 +771,42 @@
static ngx_int_t
+ngx_http_variable_request_line(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data)
+{
+ u_char *p, *s;
+
+ s = r->request_line.data;
+
+ if (s == NULL) {
+ s = r->request_start;
+
+ if (s == NULL) {
+ v->not_found = 1;
+ return NGX_OK;
+ }
+
+ for (p = s; p < r->header_in->last; p++) {
+ if (*p == CR || *p == LF) {
+ break;
+ }
+ }
+
+ r->request_line.len = p - s;
+ r->request_line.data = s;
+ }
+
+ v->len = r->request_line.len;
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
+ v->data = s;
+
+ return NGX_OK;
+}
+
+
+static ngx_int_t
ngx_http_variable_cookie(ngx_http_request_t *r, ngx_http_variable_value_t *v,
uintptr_t data)
{
@@ -1720,6 +1776,7 @@
if (ngx_strncmp(v[i].name.data, "arg_", 4) == 0) {
v[i].get_handler = ngx_http_variable_argument;
v[i].data = (uintptr_t) &v[i].name;
+ v[i].flags = NGX_HTTP_VAR_NOCACHEABLE;
continue;
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/ngx_http_variables.h
^
|
@@ -50,7 +50,7 @@
ngx_uint_t index);
ngx_http_variable_value_t *ngx_http_get_variable(ngx_http_request_t *r,
- ngx_str_t *name, ngx_uint_t key, ngx_uint_t nowarn);
+ ngx_str_t *name, ngx_uint_t key);
ngx_int_t ngx_http_variable_unknown_header(ngx_http_variable_value_t *v,
ngx_str_t *var, ngx_list_part_t *part, size_t prefix);
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/http/ngx_http_write_filter_module.c
^
|
@@ -46,7 +46,7 @@
ngx_int_t
ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in)
{
- off_t size, sent, limit;
+ off_t size, sent, nsent, limit;
ngx_uint_t last, flush;
ngx_msec_t delay;
ngx_chain_t *cl, *ln, **ll, *chain;
@@ -210,7 +210,8 @@
}
if (r->limit_rate) {
- limit = r->limit_rate * (ngx_time() - r->start_sec + 1) - c->sent;
+ limit = r->limit_rate * (ngx_time() - r->start_sec + 1)
+ - (c->sent - clcf->limit_rate_after);
if (limit <= 0) {
c->write->delayed = 1;
@@ -245,7 +246,23 @@
}
if (r->limit_rate) {
- delay = (ngx_msec_t) ((c->sent - sent) * 1000 / r->limit_rate + 1);
+
+ nsent = c->sent;
+
+ if (clcf->limit_rate_after) {
+
+ sent -= clcf->limit_rate_after;
+ if (sent < 0) {
+ sent = 0;
+ }
+
+ nsent -= clcf->limit_rate_after;
+ if (nsent < 0) {
+ nsent = 0;
+ }
+ }
+
+ delay = (ngx_msec_t) ((nsent - sent) * 1000 / r->limit_rate + 1);
if (delay > 0) {
c->write->delayed = 1;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/mail/ngx_mail_auth_http_module.c
^
|
@@ -1302,7 +1302,7 @@
ahcf = ngx_pcalloc(cf->pool, sizeof(ngx_mail_auth_http_conf_t));
if (ahcf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
ahcf->timeout = NGX_CONF_UNSET_MSEC;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/mail/ngx_mail_core_module.c
^
|
@@ -120,20 +120,20 @@
cmcf = ngx_pcalloc(cf->pool, sizeof(ngx_mail_core_main_conf_t));
if (cmcf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
if (ngx_array_init(&cmcf->servers, cf->pool, 4,
sizeof(ngx_mail_core_srv_conf_t *))
!= NGX_OK)
{
- return NGX_CONF_ERROR;
+ return NULL;
}
if (ngx_array_init(&cmcf->listen, cf->pool, 4, sizeof(ngx_mail_listen_t))
!= NGX_OK)
{
- return NGX_CONF_ERROR;
+ return NULL;
}
return cmcf;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/mail/ngx_mail_pop3_handler.c
^
|
@@ -188,7 +188,6 @@
default:
rc = NGX_MAIL_PARSE_INVALID_COMMAND;
- s->mail_state = ngx_pop3_start;
break;
}
@@ -215,7 +214,6 @@
default:
rc = NGX_MAIL_PARSE_INVALID_COMMAND;
- s->mail_state = ngx_pop3_start;
break;
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/mail/ngx_mail_proxy_module.c
^
|
@@ -726,7 +726,7 @@
b->last += n;
- if (b->last - b->pos < 5) {
+ if (b->last - b->pos < 4) {
return NGX_AGAIN;
}
@@ -1061,7 +1061,7 @@
pcf = ngx_pcalloc(cf->pool, sizeof(ngx_mail_proxy_conf_t));
if (pcf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
pcf->enable = NGX_CONF_UNSET;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/mail/ngx_mail_smtp_handler.c
^
|
@@ -191,7 +191,7 @@
if (ctx->state) {
ngx_log_error(NGX_LOG_ERR, c->log, 0,
- "%V could not be resolved (%i: %s)",
+ "\"%V\" could not be resolved (%i: %s)",
&ctx->name, ctx->state,
ngx_resolver_strerror(ctx->state));
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/mail/ngx_mail_ssl_module.c
^
|
@@ -9,7 +9,7 @@
#include <ngx_mail.h>
-#define NGX_DEFAULT_CIPHERS "ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP"
+#define NGX_DEFAULT_CIPHERS "HIGH:!ADH:!MD5"
static void *ngx_mail_ssl_create_conf(ngx_conf_t *cf);
@@ -22,15 +22,6 @@
static char *ngx_mail_ssl_session_cache(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
-#if !defined (SSL_OP_CIPHER_SERVER_PREFERENCE)
-
-static char *ngx_mail_ssl_nosupported(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf);
-
-static char ngx_mail_ssl_openssl097[] = "OpenSSL 0.9.7 and higher";
-
-#endif
-
static ngx_conf_enum_t ngx_http_starttls_state[] = {
{ ngx_string("off"), NGX_MAIL_STARTTLS_OFF },
@@ -102,14 +93,10 @@
{ ngx_string("ssl_prefer_server_ciphers"),
NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_FLAG,
-#ifdef SSL_OP_CIPHER_SERVER_PREFERENCE
ngx_conf_set_flag_slot,
NGX_MAIL_SRV_CONF_OFFSET,
offsetof(ngx_mail_ssl_conf_t, prefer_server_ciphers),
NULL },
-#else
- ngx_mail_ssl_nosupported, 0, 0, ngx_mail_ssl_openssl097 },
-#endif
{ ngx_string("ssl_session_cache"),
NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_TAKE12,
@@ -166,7 +153,7 @@
scf = ngx_pcalloc(cf->pool, sizeof(ngx_mail_ssl_conf_t));
if (scf == NULL) {
- return NGX_CONF_ERROR;
+ return NULL;
}
/*
@@ -211,8 +198,7 @@
prev->prefer_server_ciphers, 0);
ngx_conf_merge_bitmask_value(conf->protocols, prev->protocols,
- (NGX_CONF_BITMASK_SET
- |NGX_SSL_SSLv2|NGX_SSL_SSLv3|NGX_SSL_TLSv1));
+ (NGX_CONF_BITMASK_SET|NGX_SSL_SSLv3|NGX_SSL_TLSv1));
ngx_conf_merge_str_value(conf->certificate, prev->certificate, "");
ngx_conf_merge_str_value(conf->certificate_key, prev->certificate_key, "");
@@ -297,14 +283,10 @@
}
}
-#ifdef SSL_OP_CIPHER_SERVER_PREFERENCE
-
if (conf->prefer_server_ciphers) {
SSL_CTX_set_options(conf->ssl.ctx, SSL_OP_CIPHER_SERVER_PREFERENCE);
}
-#endif
-
if (ngx_ssl_generate_rsa512_key(&conf->ssl) != NGX_OK) {
return NGX_CONF_ERROR;
}
@@ -492,18 +474,3 @@
return NGX_CONF_ERROR;
}
-
-
-#if !defined (SSL_OP_CIPHER_SERVER_PREFERENCE)
-
-static char *
-ngx_mail_ssl_nosupported(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
-{
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "\"%V\" directive is available only in %s,",
- &cmd->name, cmd->post);
-
- return NGX_CONF_ERROR;
-}
-
-#endif
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/os/unix/ngx_alloc.c
^
|
@@ -51,11 +51,15 @@
ngx_memalign(size_t alignment, size_t size, ngx_log_t *log)
{
void *p;
+ int err;
- if (posix_memalign(&p, alignment, size) == -1) {
- ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
+ err = posix_memalign(&p, alignment, size);
+
+ if (err) {
+ ngx_log_error(NGX_LOG_EMERG, log, err,
"posix_memalign() %uz bytes aligned to %uz failed",
size, alignment);
+ p = NULL;
}
ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0,
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/os/unix/ngx_errno.h
^
|
@@ -16,6 +16,7 @@
#define NGX_EPERM EPERM
#define NGX_ENOENT ENOENT
+#define NGX_ENOPATH ENOENT
#define NGX_ESRCH ESRCH
#define NGX_EINTR EINTR
#define NGX_ECHILD ECHILD
@@ -63,10 +64,22 @@
/* Solaris and Tru64 UNIX have thread-safe strerror() */
-#define ngx_strerror_r(err, errstr, size) \
+#define ngx_strerror_r(err, errstr, size) \
ngx_cpystrn(errstr, (u_char *) strerror(err), size)
#endif
+
+#if (NGX_HAVE_SYS_ERRLIST)
+
+#define ngx_sigsafe_strerror(err) \
+ (err > 0 && err < sys_nerr) ? sys_errlist[err] : "Unknown error"
+
+#else
+
+#define ngx_sigsafe_strerror(err) ""
+
+#endif
+
#endif /* _NGX_ERRNO_H_INCLUDED_ */
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/os/unix/ngx_files.c
^
|
@@ -22,7 +22,7 @@
if (n == -1) {
ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,
- "pread() failed, file \"%s\"", file->name.data);
+ "pread() \"%s\" failed", file->name.data);
return NGX_ERROR;
}
@@ -30,7 +30,8 @@
if (file->sys_offset != offset) {
if (lseek(file->fd, offset, SEEK_SET) == -1) {
- ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, "lseek() failed");
+ ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,
+ "lseek() \"%s\" failed", file->name.data);
return NGX_ERROR;
}
@@ -40,7 +41,8 @@
n = read(file->fd, buf, size);
if (n == -1) {
- ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, "read() failed");
+ ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,
+ "read() \"%s\" failed", file->name.data);
return NGX_ERROR;
}
@@ -57,57 +59,66 @@
ssize_t
ngx_write_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset)
{
- ssize_t n;
+ ssize_t n, written;
ngx_log_debug4(NGX_LOG_DEBUG_CORE, file->log, 0,
"write: %d, %p, %uz, %O", file->fd, buf, size, offset);
+ written = 0;
+
#if (NGX_HAVE_PWRITE)
- n = pwrite(file->fd, buf, size, offset);
+ for ( ;; ) {
+ n = pwrite(file->fd, buf, size, offset);
- if (n == -1) {
- ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, "pwrite() failed");
- return NGX_ERROR;
- }
+ if (n == -1) {
+ ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,
+ "pwrite() \"%s\" failed", file->name.data);
+ return NGX_ERROR;
+ }
- if ((size_t) n != size) {
- ngx_log_error(NGX_LOG_CRIT, file->log, 0,
- "pwrite() has written only %z of %uz", n, size);
- return NGX_ERROR;
+ file->offset += n;
+ written += n;
+
+ if ((size_t) n == size) {
+ return written;
+ }
+
+ offset += n;
+ size -= n;
}
#else
if (file->sys_offset != offset) {
if (lseek(file->fd, offset, SEEK_SET) == -1) {
- ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, "lseek() failed");
+ ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,
+ "lseek() \"%s\" failed", file->name.data);
return NGX_ERROR;
}
file->sys_offset = offset;
}
- n = write(file->fd, buf, size);
+ for ( ;; ) {
+ n = write(file->fd, buf, size);
- if (n == -1) {
- ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno, "write() failed");
- return NGX_ERROR;
- }
+ if (n == -1) {
+ ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,
+ "write() \"%s\" failed", file->name.data);
+ return NGX_ERROR;
+ }
- if ((size_t) n != size) {
- ngx_log_error(NGX_LOG_CRIT, file->log, 0,
- "write() has written only %z of %uz", n, size);
- return NGX_ERROR;
- }
+ file->offset += n;
+ written += n;
- file->sys_offset += n;
+ if ((size_t) n == size) {
+ return written;
+ }
+ size -= n;
+ }
#endif
-
- file->offset += n;
-
- return n;
}
@@ -191,7 +202,7 @@
if (file->sys_offset != offset) {
if (lseek(file->fd, offset, SEEK_SET) == -1) {
ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,
- "lseek() failed");
+ "lseek() \"%s\" failed", file->name.data);
return NGX_ERROR;
}
@@ -202,13 +213,14 @@
if (n == -1) {
ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,
- "writev() failed");
+ "writev() \"%s\" failed", file->name.data);
return NGX_ERROR;
}
if ((size_t) n != size) {
ngx_log_error(NGX_LOG_CRIT, file->log, 0,
- "writev() has written only %z of %uz", n, size);
+ "writev() \"%s\" has written only %z of %uz",
+ file->name.data, n, size);
return NGX_ERROR;
}
@@ -262,9 +274,8 @@
if (dir->de) {
#if (NGX_HAVE_D_TYPE)
dir->type = dir->de->d_type;
- dir->valid_type = dir->type ? 1 : 0;
#else
- dir->valid_type = 0;
+ dir->type = 0;
#endif
return NGX_OK;
}
@@ -394,7 +405,7 @@
flags = fcntl(fd, F_GETFL);
if (flags == -1) {
- return -1;
+ return NGX_FILE_ERROR;
}
return fcntl(fd, F_SETFL, flags | O_DIRECT);
@@ -409,7 +420,7 @@
flags = fcntl(fd, F_GETFL);
if (flags == -1) {
- return -1;
+ return NGX_FILE_ERROR;
}
return fcntl(fd, F_SETFL, flags & ~O_DIRECT);
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/os/unix/ngx_files.h
^
|
@@ -18,13 +18,12 @@
typedef struct {
- DIR *dir;
- struct dirent *de;
- struct stat info;
-
- unsigned type:8;
- unsigned valid_info:1;
- unsigned valid_type:1;
+ DIR *dir;
+ struct dirent *de;
+ struct stat info;
+
+ unsigned type:8;
+ unsigned valid_info:1;
} ngx_dir_t;
@@ -65,6 +64,7 @@
#define NGX_FILE_OPEN 0
#define NGX_FILE_TRUNCATE O_CREAT|O_TRUNC
#define NGX_FILE_APPEND O_WRONLY|O_APPEND
+#define NGX_FILE_NONBLOCK O_NONBLOCK
#define NGX_FILE_DEFAULT_ACCESS 0644
#define NGX_FILE_OWNER_ACCESS 0600
@@ -139,10 +139,13 @@
#define ngx_fd_info(fd, sb) fstat(fd, sb)
#define ngx_fd_info_n "fstat()"
+#define ngx_link_info(file, sb) lstat((const char *) file, sb)
+#define ngx_link_info_n "lstat()"
+
#define ngx_is_dir(sb) (S_ISDIR((sb)->st_mode))
#define ngx_is_file(sb) (S_ISREG((sb)->st_mode))
#define ngx_is_link(sb) (S_ISLNK((sb)->st_mode))
-#define ngx_is_exec(sb) ((sb)->st_mode & S_IXUSR)
+#define ngx_is_exec(sb) (((sb)->st_mode & S_IXUSR) == S_IXUSR)
#define ngx_file_access(sb) ((sb)->st_mode & 0777)
#define ngx_file_size(sb) (sb)->st_size
#define ngx_file_mtime(sb) (sb)->st_mtime
@@ -200,31 +203,31 @@
#else
#define ngx_de_namelen(dir) ngx_strlen((dir)->de->d_name)
#endif
-#define ngx_de_info(name, dir) stat((const char *) name, &(dir)->info)
+
+static ngx_inline ngx_int_t
+ngx_de_info(u_char *name, ngx_dir_t *dir)
+{
+ dir->type = 0;
+ return stat((const char *) name, &dir->info);
+}
+
#define ngx_de_info_n "stat()"
#define ngx_de_link_info(name, dir) lstat((const char *) name, &(dir)->info)
#define ngx_de_link_info_n "lstat()"
#if (NGX_HAVE_D_TYPE)
-#if (NGX_LINUX)
-
-/* XFS on Linux does not set dirent.d_type */
+/*
+ * some file systems (e.g. XFS on Linux and CD9660 on FreeBSD)
+ * do not set dirent.d_type
+ */
#define ngx_de_is_dir(dir) \
(((dir)->type) ? ((dir)->type == DT_DIR) : (S_ISDIR((dir)->info.st_mode)))
#define ngx_de_is_file(dir) \
(((dir)->type) ? ((dir)->type == DT_REG) : (S_ISREG((dir)->info.st_mode)))
#define ngx_de_is_link(dir) \
- (((dir)->type) ? ((dir)->type == DT_LINK) : (S_ISLNK((dir)->info.st_mode)))
-
-#else
-
-#define ngx_de_is_dir(dir) ((dir)->type == DT_DIR)
-#define ngx_de_is_file(dir) ((dir)->type == DT_REG)
-#define ngx_de_is_link(dir) ((dir)->type == DT_LINK)
-
-#endif /* NGX_LINUX */
+ (((dir)->type) ? ((dir)->type == DT_LNK) : (S_ISLNK((dir)->info.st_mode)))
#else
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/os/unix/ngx_process.c
^
|
@@ -214,21 +214,33 @@
switch (respawn) {
+ case NGX_PROCESS_NORESPAWN:
+ ngx_processes[s].respawn = 0;
+ ngx_processes[s].just_spawn = 0;
+ ngx_processes[s].detached = 0;
+ break;
+
+ case NGX_PROCESS_JUST_SPAWN:
+ ngx_processes[s].respawn = 0;
+ ngx_processes[s].just_spawn = 1;
+ ngx_processes[s].detached = 0;
+ break;
+
case NGX_PROCESS_RESPAWN:
ngx_processes[s].respawn = 1;
- ngx_processes[s].just_respawn = 0;
+ ngx_processes[s].just_spawn = 0;
ngx_processes[s].detached = 0;
break;
case NGX_PROCESS_JUST_RESPAWN:
ngx_processes[s].respawn = 1;
- ngx_processes[s].just_respawn = 1;
+ ngx_processes[s].just_spawn = 1;
ngx_processes[s].detached = 0;
break;
case NGX_PROCESS_DETACHED:
ngx_processes[s].respawn = 0;
- ngx_processes[s].just_respawn = 0;
+ ngx_processes[s].just_spawn = 0;
ngx_processes[s].detached = 1;
break;
}
@@ -303,7 +315,7 @@
}
}
- ngx_time_update(0, 0);
+ ngx_time_sigsafe_update();
action = "";
@@ -359,6 +371,7 @@
break;
case SIGALRM:
+ ngx_sigalrm = 1;
break;
case SIGIO:
@@ -463,16 +476,17 @@
*/
if (err == NGX_ECHILD) {
- ngx_log_error(NGX_LOG_INFO, ngx_cycle->log, errno,
- "waitpid() failed");
+ ngx_log_error(NGX_LOG_INFO, ngx_cycle->log, 0,
+ "waitpid() failed (%d: %s)",
+ err, ngx_sigsafe_strerror(err));
return;
}
#endif
- ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, errno,
- "waitpid() failed");
-
+ ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
+ "waitpid() failed (%d: %s)",
+ err, ngx_sigsafe_strerror(err));
return;
}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/os/unix/ngx_process.h
^
|
@@ -27,7 +27,7 @@
char *name;
unsigned respawn:1;
- unsigned just_respawn:1;
+ unsigned just_spawn:1;
unsigned detached:1;
unsigned exiting:1;
unsigned exited:1;
@@ -45,9 +45,10 @@
#define NGX_MAX_PROCESSES 1024
#define NGX_PROCESS_NORESPAWN -1
-#define NGX_PROCESS_RESPAWN -2
-#define NGX_PROCESS_JUST_RESPAWN -3
-#define NGX_PROCESS_DETACHED -4
+#define NGX_PROCESS_JUST_SPAWN -2
+#define NGX_PROCESS_RESPAWN -3
+#define NGX_PROCESS_JUST_RESPAWN -4
+#define NGX_PROCESS_DETACHED -5
#define ngx_getpid getpid
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/os/unix/ngx_process_cycle.c
^
|
@@ -12,7 +12,9 @@
static void ngx_start_worker_processes(ngx_cycle_t *cycle, ngx_int_t n,
ngx_int_t type);
-static void ngx_start_cache_manager_process(ngx_cycle_t *cycle, ngx_int_t type);
+static void ngx_start_cache_manager_processes(ngx_cycle_t *cycle,
+ ngx_uint_t respawn);
+static void ngx_pass_open_channel(ngx_cycle_t *cycle, ngx_channel_t *ch);
static void ngx_signal_worker_processes(ngx_cycle_t *cycle, int signo);
static ngx_uint_t ngx_reap_children(ngx_cycle_t *cycle);
static void ngx_master_process_exit(ngx_cycle_t *cycle);
@@ -26,6 +28,7 @@
#endif
static void ngx_cache_manager_process_cycle(ngx_cycle_t *cycle, void *data);
static void ngx_cache_manager_process_handler(ngx_event_t *ev);
+static void ngx_cache_loader_process_handler(ngx_event_t *ev);
ngx_uint_t ngx_process;
@@ -34,6 +37,7 @@
sig_atomic_t ngx_reap;
sig_atomic_t ngx_sigio;
+sig_atomic_t ngx_sigalrm;
sig_atomic_t ngx_terminate;
sig_atomic_t ngx_quit;
sig_atomic_t ngx_debug_quit;
@@ -61,6 +65,15 @@
static u_char master_process[] = "master process";
+static ngx_cache_manager_ctx_t ngx_cache_manager_ctx = {
+ ngx_cache_manager_process_handler, "cache manager process", 0
+};
+
+static ngx_cache_manager_ctx_t ngx_cache_loader_ctx = {
+ ngx_cache_loader_process_handler, "cache loader process", 60000
+};
+
+
static ngx_cycle_t ngx_exit_cycle;
static ngx_log_t ngx_exit_log;
static ngx_open_file_t ngx_exit_log_file;
@@ -73,7 +86,7 @@
u_char *p;
size_t size;
ngx_int_t i;
- ngx_uint_t n;
+ ngx_uint_t n, sigio;
sigset_t set;
struct itimerval itv;
ngx_uint_t live;
@@ -122,18 +135,23 @@
ngx_start_worker_processes(cycle, ccf->worker_processes,
NGX_PROCESS_RESPAWN);
- ngx_start_cache_manager_process(cycle, NGX_PROCESS_RESPAWN);
+ ngx_start_cache_manager_processes(cycle, 0);
ngx_new_binary = 0;
delay = 0;
+ sigio = 0;
live = 1;
for ( ;; ) {
if (delay) {
- delay *= 2;
+ if (ngx_sigalrm) {
+ sigio = 0;
+ delay *= 2;
+ ngx_sigalrm = 0;
+ }
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
- "temination cycle: %d", delay);
+ "termination cycle: %d", delay);
itv.it_interval.tv_sec = 0;
itv.it_interval.tv_usec = 0;
@@ -150,9 +168,10 @@
sigsuspend(&set);
- ngx_time_update(0, 0);
+ ngx_time_update();
- ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "wake up");
+ ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
+ "wake up, sigio %i", sigio);
if (ngx_reap) {
ngx_reap = 0;
@@ -170,6 +189,13 @@
delay = 50;
}
+ if (sigio) {
+ sigio--;
+ continue;
+ }
+
+ sigio = ccf->worker_processes + 2 /* cache processes */;
+
if (delay > 1000) {
ngx_signal_worker_processes(cycle, SIGKILL);
} else {
@@ -203,7 +229,7 @@
if (ngx_new_binary) {
ngx_start_worker_processes(cycle, ccf->worker_processes,
NGX_PROCESS_RESPAWN);
- ngx_start_cache_manager_process(cycle, NGX_PROCESS_RESPAWN);
+ ngx_start_cache_manager_processes(cycle, 0);
ngx_noaccepting = 0;
continue;
@@ -222,7 +248,7 @@
ngx_core_module);
ngx_start_worker_processes(cycle, ccf->worker_processes,
NGX_PROCESS_JUST_RESPAWN);
- ngx_start_cache_manager_process(cycle, NGX_PROCESS_JUST_RESPAWN);
+ ngx_start_cache_manager_processes(cycle, 1);
live = 1;
ngx_signal_worker_processes(cycle,
ngx_signal_value(NGX_SHUTDOWN_SIGNAL));
@@ -232,7 +258,7 @@
ngx_restart = 0;
ngx_start_worker_processes(cycle, ccf->worker_processes,
NGX_PROCESS_RESPAWN);
- ngx_start_cache_manager_process(cycle, NGX_PROCESS_RESPAWN);
+ ngx_start_cache_manager_processes(cycle, 0);
live = 1;
}
@@ -265,8 +291,6 @@
{
ngx_uint_t i;
- ngx_init_temp_number();
-
for (i = 0; ngx_modules[i]; i++) {
if (ngx_modules[i]->init_process) {
if (ngx_modules[i]->init_process(cycle) == NGX_ERROR) {
@@ -317,7 +341,7 @@
static void
ngx_start_worker_processes(ngx_cycle_t *cycle, ngx_int_t n, ngx_int_t type)
{
- ngx_int_t i, s;
+ ngx_int_t i;
ngx_channel_t ch;
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "start worker processes");
@@ -335,58 +359,70 @@
ch.slot = ngx_process_slot;
ch.fd = ngx_processes[ngx_process_slot].channel[0];
- for (s = 0; s < ngx_last_process; s++) {
-
- if (s == ngx_process_slot
- || ngx_processes[s].pid == -1
- || ngx_processes[s].channel[0] == -1)
- {
- continue;
- }
-
- ngx_log_debug6(NGX_LOG_DEBUG_CORE, cycle->log, 0,
- "pass channel s:%d pid:%P fd:%d to s:%i pid:%P fd:%d",
- ch.slot, ch.pid, ch.fd,
- s, ngx_processes[s].pid,
- ngx_processes[s].channel[0]);
-
- /* TODO: NGX_AGAIN */
-
- ngx_write_channel(ngx_processes[s].channel[0],
- &ch, sizeof(ngx_channel_t), cycle->log);
- }
+ ngx_pass_open_channel(cycle, &ch);
}
}
static void
-ngx_start_cache_manager_process(ngx_cycle_t *cycle, ngx_int_t type)
+ngx_start_cache_manager_processes(ngx_cycle_t *cycle, ngx_uint_t respawn)
{
- ngx_int_t i;
- ngx_uint_t n;
+ ngx_uint_t i, manager, loader;
ngx_path_t **path;
ngx_channel_t ch;
+ manager = 0;
+ loader = 0;
+
path = ngx_cycle->pathes.elts;
- for (n = 0; n < ngx_cycle->pathes.nelts; n++) {
- if (path[n]->manager) {
- goto start;
+ for (i = 0; i < ngx_cycle->pathes.nelts; i++) {
+
+ if (path[i]->manager) {
+ manager = 1;
+ }
+
+ if (path[i]->loader) {
+ loader = 1;
}
}
- return;
+ if (manager == 0) {
+ return;
+ }
-start:
+ ngx_spawn_process(cycle, ngx_cache_manager_process_cycle,
+ &ngx_cache_manager_ctx, "cache manager process",
+ respawn ? NGX_PROCESS_JUST_RESPAWN : NGX_PROCESS_RESPAWN);
ch.command = NGX_CMD_OPEN_CHANNEL;
+ ch.pid = ngx_processes[ngx_process_slot].pid;
+ ch.slot = ngx_process_slot;
+ ch.fd = ngx_processes[ngx_process_slot].channel[0];
+
+ ngx_pass_open_channel(cycle, &ch);
+
+ if (loader == 0) {
+ return;
+ }
- ngx_spawn_process(cycle, ngx_cache_manager_process_cycle, NULL,
- "cache manager process", type);
+ ngx_spawn_process(cycle, ngx_cache_manager_process_cycle,
+ &ngx_cache_loader_ctx, "cache loader process",
+ respawn ? NGX_PROCESS_JUST_SPAWN : NGX_PROCESS_NORESPAWN);
+ ch.command = NGX_CMD_OPEN_CHANNEL;
ch.pid = ngx_processes[ngx_process_slot].pid;
ch.slot = ngx_process_slot;
ch.fd = ngx_processes[ngx_process_slot].channel[0];
+ ngx_pass_open_channel(cycle, &ch);
+}
+
+
+static void
+ngx_pass_open_channel(ngx_cycle_t *cycle, ngx_channel_t *ch)
+{
+ ngx_int_t i;
+
for (i = 0; i < ngx_last_process; i++) {
if (i == ngx_process_slot
@@ -398,14 +434,14 @@
ngx_log_debug6(NGX_LOG_DEBUG_CORE, cycle->log, 0,
"pass channel s:%d pid:%P fd:%d to s:%i pid:%P fd:%d",
- ch.slot, ch.pid, ch.fd,
+ ch->slot, ch->pid, ch->fd,
i, ngx_processes[i].pid,
ngx_processes[i].channel[0]);
/* TODO: NGX_AGAIN */
ngx_write_channel(ngx_processes[i].channel[0],
- &ch, sizeof(ngx_channel_t), cycle->log);
+ ch, sizeof(ngx_channel_t), cycle->log);
}
}
@@ -456,14 +492,14 @@
ngx_processes[i].exited,
ngx_processes[i].detached,
ngx_processes[i].respawn,
- ngx_processes[i].just_respawn);
+ ngx_processes[i].just_spawn);
if (ngx_processes[i].detached || ngx_processes[i].pid == -1) {
continue;
}
- if (ngx_processes[i].just_respawn) {
- ngx_processes[i].just_respawn = 0;
+ if (ngx_processes[i].just_spawn) {
+ ngx_processes[i].just_spawn = 0;
continue;
}
@@ -492,8 +528,7 @@
if (kill(ngx_processes[i].pid, signo) == -1) {
err = ngx_errno;
ngx_log_error(NGX_LOG_ALERT, cycle->log, err,
- "kill(%P, %d) failed",
- ngx_processes[i].pid, signo);
+ "kill(%P, %d) failed", ngx_processes[i].pid, signo);
if (err == NGX_ESRCH) {
ngx_processes[i].exited = 1;
@@ -533,7 +568,7 @@
ngx_processes[i].exited,
ngx_processes[i].detached,
ngx_processes[i].respawn,
- ngx_processes[i].just_respawn);
+ ngx_processes[i].just_spawn);
if (ngx_processes[i].pid == -1) {
continue;
@@ -590,26 +625,7 @@
ch.slot = ngx_process_slot;
ch.fd = ngx_processes[ngx_process_slot].channel[0];
- for (n = 0; n < ngx_last_process; n++) {
-
- if (n == ngx_process_slot
- || ngx_processes[n].pid == -1
- || ngx_processes[n].channel[0] == -1)
- {
- continue;
- }
-
- ngx_log_debug6(NGX_LOG_DEBUG_CORE, cycle->log, 0,
- "pass channel s:%d pid:%P fd:%d to s:%i pid:%P fd:%d",
- ch.slot, ch.pid, ch.fd,
- n, ngx_processes[n].pid,
- ngx_processes[n].channel[0]);
-
- /* TODO: NGX_AGAIN */
-
- ngx_write_channel(ngx_processes[n].channel[0],
- &ch, sizeof(ngx_channel_t), cycle->log);
- }
+ ngx_pass_open_channel(cycle, &ch);
live = 1;
@@ -925,8 +941,6 @@
"sigprocmask() failed");
}
- ngx_init_temp_number();
-
/*
* disable deleting previous events for the listening sockets because
* in the worker processes there are no events at all at this point
@@ -1265,6 +1279,8 @@
static void
ngx_cache_manager_process_cycle(ngx_cycle_t *cycle, void *data)
{
+ ngx_cache_manager_ctx_t *ctx = data;
+
void *ident[4];
ngx_event_t ev;
@@ -1275,16 +1291,16 @@
ngx_close_listening_sockets(cycle);
ngx_memzero(&ev, sizeof(ngx_event_t));
- ev.handler = ngx_cache_manager_process_handler;
+ ev.handler = ctx->handler;
ev.data = ident;
ev.log = cycle->log;
ident[3] = (void *) -1;
ngx_use_accept_mutex = 0;
- ngx_setproctitle("cache manager process");
+ ngx_setproctitle(ctx->name);
- ngx_add_timer(&ev, 0);
+ ngx_add_timer(&ev, ctx->delay);
for ( ;; ) {
@@ -1321,7 +1337,7 @@
next = (n <= next) ? n : next;
- ngx_time_update(0, 0);
+ ngx_time_update();
}
}
@@ -1331,3 +1347,29 @@
ngx_add_timer(ev, next * 1000);
}
+
+
+static void
+ngx_cache_loader_process_handler(ngx_event_t *ev)
+{
+ ngx_uint_t i;
+ ngx_path_t **path;
+ ngx_cycle_t *cycle;
+
+ cycle = (ngx_cycle_t *) ngx_cycle;
+
+ path = cycle->pathes.elts;
+ for (i = 0; i < cycle->pathes.nelts; i++) {
+
+ if (ngx_terminate || ngx_quit) {
+ break;
+ }
+
+ if (path[i]->loader) {
+ path[i]->loader(path[i]->data);
+ ngx_time_update();
+ }
+ }
+
+ exit(0);
+}
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/os/unix/ngx_process_cycle.h
^
|
@@ -25,6 +25,13 @@
#define NGX_PROCESS_SIGNALLER 3
+typedef struct {
+ ngx_event_handler_pt handler;
+ char *name;
+ ngx_msec_t delay;
+} ngx_cache_manager_ctx_t;
+
+
void ngx_master_process_cycle(ngx_cycle_t *cycle);
void ngx_single_process_cycle(ngx_cycle_t *cycle);
@@ -39,6 +46,7 @@
extern sig_atomic_t ngx_reap;
extern sig_atomic_t ngx_sigio;
+extern sig_atomic_t ngx_sigalrm;
extern sig_atomic_t ngx_quit;
extern sig_atomic_t ngx_debug_quit;
extern sig_atomic_t ngx_terminate;
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/os/unix/ngx_setproctitle.h
^
|
@@ -13,7 +13,7 @@
/* FreeBSD, NetBSD, OpenBSD */
#define ngx_init_setproctitle(log)
-#define ngx_setproctitle setproctitle
+#define ngx_setproctitle(title) setproctitle("%s", title)
#else /* !NGX_HAVE_SETPROCTITLE */
|
[-]
[+]
|
Changed |
nginx-0.7.69.tar.bz2/src/os/unix/ngx_user.c
^
|
@@ -41,11 +41,11 @@
err = ngx_errno;
if (err == 0) {
- len = ngx_strlen(value);
+ len = ngx_strlen(value) + 1;
*encrypted = ngx_pnalloc(pool, len);
if (*encrypted) {
- ngx_memcpy(*encrypted, value, len + 1);
+ ngx_memcpy(*encrypted, value, len);
return NGX_OK;
}
}
@@ -79,11 +79,11 @@
value = crypt((char *) key, (char *) salt);
if (value) {
- len = ngx_strlen(value);
+ len = ngx_strlen(value) + 1;
*encrypted = ngx_pnalloc(pool, len);
if (*encrypted) {
- ngx_memcpy(*encrypted, value, len + 1);
+ ngx_memcpy(*encrypted, value, len);
}
#if (NGX_THREADS && NGX_NONREENTRANT_CRYPT)
|