[-]
[+]
|
Changed |
nginx-testing.spec
|
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/CHANGES
^
|
@@ -1,438 +1,4 @@
-Changes with nginx 0.8.52 28 Sep 2010
-
- *) Bugfix: nginx used SSL mode for a listen socket if any listen option
- was set; the bug had appeared in 0.8.51.
-
-
-Changes with nginx 0.8.51 27 Sep 2010
-
- *) Change: the "secure_link_expires" directive has been canceled.
-
- *) Change: a logging level of resolver errors has been lowered from
- "alert" to "error".
-
- *) Feature: now a listen socket "ssl" parameter may be set several
- times.
-
-
-Changes with nginx 0.8.50 02 Sep 2010
-
- *) Feature: the "secure_link", "secure_link_md5", and
- "secure_link_expires" directives of the ngx_http_secure_link_module.
-
- *) Feature: the -q switch.
- Thanks to Gena Makhomed.
-
- *) Bugfix: worker processes may got caught in an endless loop during
- reconfiguration, if a caching was used; the bug had appeared in
- 0.8.48.
-
- *) Bugfix: in the "gzip_disable" directive.
- Thanks to Derrick Petzold.
-
- *) Bugfix: nginx/Windows could not send stop, quit, reopen, and reload
- signals to a process run in other session.
-
-
-Changes with nginx 0.8.49 09 Aug 2010
-
- *) Feature: the "image_filter_jpeg_quality" directive supports
- variables.
-
- *) Bugfix: a segmentation fault might occur in a worker process, if the
- $geoip_region_name variables was used; the bug had appeared in
- 0.8.48.
-
- *) Bugfix: errors intercepted by error_page were cached only for next
- request; the bug had appeared in 0.8.48.
-
-
-Changes with nginx 0.8.48 03 Aug 2010
-
- *) Change: now the "server_name" directive default value is an empty
- name "".
- Thanks to Gena Makhomed.
-
- *) Change: now the "server_name_in_redirect" directive default value is
- "off".
-
- *) Feature: the $geoip_dma_code, $geoip_area_code, and
- $geoip_region_name variables.
- Thanks to Christine McGonagle.
-
- *) Bugfix: the "proxy_pass", "fastcgi_pass", "uwsgi_pass", and
- "scgi_pass" directives were not inherited inside "limit_except"
- blocks.
-
- *) Bugfix: the "proxy_cache_min_uses", "fastcgi_cache_min_uses"
- "uwsgi_cache_min_uses", and "scgi_cache_min_uses" directives did not
- work; the bug had appeared in 0.8.46.
-
- *) Bugfix: the "fastcgi_split_path_info" directive used incorrectly
- captures, if only parts of an URI were captured.
- Thanks to Yuriy Taraday and Frank Enderle.
-
- *) Bugfix: the "rewrite" directive did not escape a ";" character
- during copying from URI to query string.
- Thanks to Daisuke Murase.
-
- *) Bugfix: the ngx_http_image_filter_module closed a connection, if an
- image was larger than "image_filter_buffer" size.
-
-
-Changes with nginx 0.8.47 28 Jul 2010
-
- *) Bugfix: $request_time variable had invalid values for subrequests.
-
- *) Bugfix: errors intercepted by error_page could not be cached.
-
- *) Bugfix: a cache manager process may got caught in an endless loop,
- if max_size parameter was used; the bug had appeared in 0.8.46.
-
-
-Changes with nginx 0.8.46 19 Jul 2010
-
- *) Change: now the "proxy_no_cache", "fastcgi_no_cache",
- "uwsgi_no_cache", and "scgi_no_cache" directives affect on a cached
- response saving only.
-
- *) Feature: the "proxy_cache_bypass", "fastcgi_cache_bypass",
- "uwsgi_cache_bypass", and "scgi_cache_bypass" directives.
-
- *) Bugfix: nginx did not free memory in cache keys zones if there was
- an error during working with backend: the memory was freed only
- after inactivity time or on memory low condition.
-
-
-Changes with nginx 0.8.45 13 Jul 2010
-
- *) Feature: ngx_http_xslt_filter improvements.
- Thanks to Laurence Rowe.
-
- *) 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 "listen" directive did not support the "setfib=0"
- parameter.
-
-
-Changes with nginx 0.8.44 05 Jul 2010
-
- *) Change: now nginx does not cache by default backend responses, if
- they have a "Set-Cookie" header line.
-
- *) Feature: the "listen" directive supports the "setfib" parameter.
- Thanks to Andrew Filonov.
-
- *) Bugfix: the "sub_filter" directive might change character case on
- partial match.
-
- *) Bugfix: compatibility with HP/UX.
-
- *) Bugfix: compatibility with AIX xcl_r compiler.
-
- *) Bugfix: nginx treated large SSLv2 packets as plain requests.
- Thanks to Miroslaw Jaworski.
-
-
-Changes with nginx 0.8.43 30 Jun 2010
-
- *) Feature: large geo ranges base loading speed-up.
-
- *) Bugfix: an error_page redirection to "location /zero {return 204;}"
- without changing status code kept the error body; the bug had
- appeared in 0.8.42.
-
- *) Bugfix: nginx might close IPv6 listen socket during
- reconfiguration.
- Thanks to Maxim Dounin.
-
- *) Bugfix: the $uid_set variable may be used at any request processing
- stage.
-
-
-Changes with nginx 0.8.42 21 Jun 2010
-
- *) Change: now nginx tests locations given by regular expressions, if
- request was matched exactly by a location given by a prefix string.
- The previous behavior has been introduced in 0.7.1.
-
- *) Feature: the ngx_http_scgi_module.
- Thanks to Manlio Perillo.
-
- *) Feature: a text answer may be added to a "return" directive.
-
-
-Changes with nginx 0.8.41 15 Jun 2010
-
- *) Security: nginx/Windows worker might be terminated abnormally if a
- requested file name has invalid UTF-8 encoding.
-
- *) Change: now nginx allows to use spaces in a request line.
-
- *) Bugfix: the "proxy_redirect" directive changed incorrectly a backend
- "Refresh" response header line.
- Thanks to Andrey Andreew and Max Sogin.
-
- *) Bugfix: nginx did not support path without host name in
- "Destination" request header line.
-
-
-Changes with nginx 0.8.40 07 Jun 2010
-
- *) Security: now nginx/Windows ignores default file stream name.
- Thanks to Jose Antonio Vazquez Gonzalez.
-
- *) Feature: the ngx_http_uwsgi_module.
- Thanks to Roberto De Ioris.
-
- *) Feature: a "fastcgi_param" directive with value starting with
- "HTTP_" overrides a client request header line.
-
- *) Bugfix: the "If-Modified-Since", "If-Range", etc. client request
- header lines were passed to FastCGI-server while caching.
-
- *) Bugfix: listen unix domain socket could not be changed during
- reconfiguration.
- Thanks to Maxim Dounin.
-
-
-Changes with nginx 0.8.39 31 May 2010
-
- *) Bugfix: an inherited "alias" directive worked incorrectly in
- inclusive location.
-
- *) Bugfix: in "alias" with variables and "try_files" directives
- combination.
-
- *) Bugfix: listen unix domain and IPv6 sockets did not inherit while
- online upgrade.
- Thanks to Maxim Dounin.
-
-
-Changes with nginx 0.8.38 24 May 2010
-
- *) 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.
-
- *) Bugfix: now "limit_req" delay directive conforms to the described
- algorithm.
- Thanks to Maxim Dounin.
-
- *) Bugfix: the $uid_got variable might not be used in the SSI and perl
- modules.
-
-
-Changes with nginx 0.8.37 17 May 2010
-
- *) Feature: the ngx_http_split_clients_module.
-
- *) Feature: the "map" directive supports keys more than 255 characters.
-
- *) Bugfix: nginx ignored the "private" and "no-store" values in the
- "Cache-Control" backend response header line.
-
- *) Bugfix: a "stub" parameter of an "include" SSI directive was not
- used, if empty response has 200 status code.
-
- *) 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.8.33.
- Thanks to Yichun Zhang.
-
- *) Bugfix: IMAP connections may hang until they timed out while talking
- to Zimbra server.
- Thanks to Alan Batie.
-
-
-Changes with nginx 0.8.36 22 Apr 2010
-
- *) Bugfix: the ngx_http_dav_module handled incorrectly the DELETE,
- COPY, and MOVE methods for symlinks.
-
- *) Bugfix: values of the $query_string, $arg_..., etc. variables cached
- in main request were used by the SSI module in subrequests.
-
- *) Bugfix: a variable value was repeatedly encoded after each an "echo"
- SSI-command output; the bug had appeared in 0.6.14.
-
- *) Bugfix: a worker process hung if a FIFO file was requested.
- Thanks to Vicente Aguilar and Maxim Dounin.
-
- *) Bugfix: OpenSSL-1.0.0 compatibility on 64-bit Linux.
- Thanks to Maxim Dounin.
-
- *) Bugfix: nginx could not be built --without-http-cache; the bug had
- appeared in 0.8.35.
-
-
-Changes with nginx 0.8.35 01 Apr 2010
-
- *) Change: now the charset filter runs before the SSI filter.
-
- *) Feature: the "chunked_transfer_encoding" directive.
-
- *) 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: a segmentation fault occurred in a worker process, if there
- was large stderr output before FastCGI response; the bug had
- appeared in 0.8.34.
- Thanks to Maxim Dounin.
-
-
-Changes with nginx 0.8.34 03 Mar 2010
-
- *) Bugfix: nginx did not support all ciphers and digests used in client
- certificates.
- Thanks to Innocenty Enikeew.
-
- *) Bugfix: nginx cached incorrectly FastCGI responses if there was
- large stderr output before response.
-
- *) 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.8.33.
-
- *) Bugfix: the $date_local variable has an incorrect value, if the "%s"
- format was used.
- Thanks to Maxim Dounin.
-
- *) 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: a geo range returned default value if the range included two
- or more /16 networks and did not begin at /16 network boundary.
-
- *) Bugfix: a block used in a "stub" parameter of an "include" SSI
- directive was output with "text/plain" MIME type.
-
- *) Bugfix: $r->sleep() did not work; the bug had appeared in 0.8.11.
-
-
-Changes with nginx 0.8.33 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 keepalive connections after POST requests are not
- disabled for MSIE 7.0+.
- Thanks to Adam Lounds.
-
- *) Workaround: now keepalive connections are disabled for Safari.
- Thanks to Joshua Sierles.
-
- *) 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.8.7.
-
- *) Bugfix: a segmentation fault might occur in a worker process, while
- discarding a request body; the bug had appeared in 0.8.11.
-
-
-Changes with nginx 0.8.32 11 Jan 2010
-
- *) Bugfix: UTF-8 encoding usage in the ngx_http_autoindex_module.
- Thanks to Maxim Dounin.
-
- *) Bugfix: regular expression named captures worked for two names only.
- Thanks to Maxim Dounin.
-
- *) Bugfix: now the "localhost" name is used in the "Host" request
- header line, if an unix domain socket is defined in the "auth_http"
- directive.
- Thanks to Maxim Dounin.
-
- *) Bugfix: nginx did not support chunked transfer encoding for 201
- responses.
- Thanks to Julian Reich.
-
- *) 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.
-
-
-Changes with nginx 0.8.31 23 Dec 2009
-
- *) Feature: now the "error_page" directive may redirect the 301 and 302
- responses.
-
- *) 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.
-
- *) Bugfix: nginx closed a connection if a cached response had an empty
- body.
- Thanks to Piotr Sikora.
-
- *) Bugfix: nginx might not be built by gcc 4.x if the -O2 or higher
- optimization option was used.
- Thanks to Maxim Dounin and Denis F. Latypoff.
-
- *) Bugfix: regular expressions in location were always tested in
- case-sensitive mode; the bug had appeared in 0.8.25.
-
- *) 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/Windows tried to delete a temporary file twice if the
- file should replace an already existent file.
-
-
-Changes with nginx 0.8.30 15 Dec 2009
-
- *) Change: now the default buffer size of the
- "large_client_header_buffers" directive is 8K.
- Thanks to Andrew Cholakian.
-
- *) Feature: the conf/fastcgi.conf for simple FastCGI configurations.
-
- *) Bugfix: nginx/Windows tried to rename a temporary file twice if the
- file should replace an already existent file.
-
- *) Bugfix: of "double free or corruption" error issued if host could
- not be resolved; the bug had appeared in 0.8.22.
- Thanks to Konstantin Svist.
-
- *) Bugfix: in libatomic usage on some platforms.
- Thanks to W-Mark Kubacki.
-
-
Changes with nginx 0.8.29 30 Nov 2009
*) Change: now the "009" status code is written to an access log for
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/CHANGES.ru
^
|
@@ -1,444 +1,4 @@
-éÚÍÅÎÅÎÉÑ × nginx 0.8.52 28.09.2010
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÉÓÐÏÌØÚÏ×ÁÌ ÒÅÖÉÍ SSL ÄÌÑ listen ÓÏËÅÔÁ, ÅÓÌÉ ÄÌÑ
- ÎÅÇÏ ÂÙÌ ÕÓÔÁÎÏ×ÌÅÎ ÌÀÂÏÊ listen-ÐÁÒÁÍÅÔÒ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.8.51.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.51 27.09.2010
-
- *) éÚÍÅÎÅÎÉÅ: ÄÉÒÅËÔÉ×Á secure_link_expires ÕÐÒÁÚÄÎÅÎÁ.
-
- *) éÚÍÅÎÅÎÉÅ: ÕÒÏ×ÅÎØ ÌÏÇÇÉÒÏ×ÁÎÉÑ ÏÛÉÂÏË resolver'Á ÐÏÎÉÖÅÎ Ó ÕÒÏ×ÎÑ
- alert ÎÁ error.
-
- *) äÏÂÁ×ÌÅÎÉÅ: ÔÅÐÅÒØ ÐÁÒÁÍÅÔÒ "ssl" listen-ÓÏËÅÔÁ ÍÏÖÎÏ ÕÓÔÁÎÁ×ÌÉ×ÁÔØ
- ÎÅÓËÏÌØËÏ ÒÁÚ.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.50 02.09.2010
-
- *) äÏÂÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Ù secure_link, secure_link_md5 É
- secure_link_expires ÍÏÄÕÌÑ ngx_http_secure_link_module.
-
- *) äÏÂÁ×ÌÅÎÉÅ: ËÌÀÞ -q.
- óÐÁÓÉÂÏ çÅÎÎÁÄÉÀ íÁÈÏÍÅÄÕ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ ËÜÛÉÒÏ×ÁÎÉÑ ÒÁÂÏÞÉÅ ÐÒÏÃÅÓÓÙ É ÍÏÇÌÉ
- ÚÁÃÉËÌÉÔØÓÑ ×Ï ×ÒÅÍÑ ÐÅÒÅËÏÎÆÉÇÕÒÁÃÉÉ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.8.48.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: × ÄÉÒÅËÔÉ×Å gzip_disable.
- óÐÁÓÉÂÏ Derrick Petzold.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: nginx/Windows ÎÅ ÍÏÇ ÐÏÓÙÌÁÔØ ÓÉÇÎÁÌÙ stop, quit,
- reopen, reload ÐÒÏÃÅÓÓÕ, ÚÁÐÕÝÅÎÎÏÍÕ × ÄÒÕÇÏÊ ÓÅÓÓÉÉ.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.49 09.08.2010
-
- *) äÏÂÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Á image_filter_jpeg_quality ÐÏÄÄÅÒÖÉ×ÁÅÔ
- ÐÅÒÅÍÅÎÎÙÅ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ ÐÅÒÅÍÅÎÎÏÊ $geoip_region_name ×
- ÒÁÂÏÞÅÍ ÐÒÏÃÅÓÓÅ ÍÏÇ ÐÒÏÉÚÏÊÔÉ segmentation fault; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ
- × 0.8.48.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÏÛÉÂËÉ, ÐÅÒÅÈ×ÁÞÅÎÎÙÅ error_page, ËÜÛÉÒÏ×ÁÌÉÓØ ÔÏÌØËÏ
- ÄÏ ÓÌÅÄÕÀÝÅÇÏ ÚÁÐÒÏÓÁ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.8.48.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.48 03.08.2010
-
- *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ ÐÏ ÕÍÏÌÞÁÎÉÀ ÄÉÒÅËÔÉ×Á server_name ÉÍÅÅÔ ÚÎÁÞÅÎÉÅ
- ÐÕÓÔÏÅ ÉÍÑ "".
- óÐÁÓÉÂÏ çÅÎÎÁÄÉÀ íÁÈÏÍÅÄÕ.
-
- *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ ÐÏ ÕÍÏÌÞÁÎÉÀ ÄÉÒÅËÔÉ×Á server_name_in_redirect
- ÉÍÅÅÔ ÚÎÁÞÅÎÉÅ off.
-
- *) äÏÂÁ×ÌÅÎÉÅ: ÐÅÒÅÍÅÎÎÙÅ $geoip_dma_code, $geoip_area_code É
- $geoip_region_name.
- óÐÁÓÉÂÏ Christine McGonagle.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Ù proxy_pass, fastcgi_pass, uwsgi_pass É
- scgi_pass ÎÅ ÎÁÓÌÅÄÏ×ÁÌÉÓØ × ÂÌÏËÉ limit_except.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Ù proxy_cache_min_uses, fastcgi_cache_min_uses
- uwsgi_cache_min_uses É scgi_cache_min_uses ÎÅ ÒÁÂÏÔÁÌÉ; ÏÛÉÂËÁ
- ÐÏÑ×ÉÌÁÓØ × 0.8.46.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Á fastcgi_split_path_info ÎÅ×ÅÒÎÏ ÉÓÐÏÌØÚÏ×ÁÌÁ
- ×ÙÄÅÌÅÎÉÑ, ÅÓÌÉ × ×ÙÄÅÌÅÎÉÑ ÐÏÐÁÄÁÌÁ ÔÏÌØËÏ ÞÁÓÔØ URI.
- óÐÁÓÉÂÏ àÒÉÀ ôÁÒÁÄÁÀ É Frank Enderle.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Á rewrite ÎÅ ÜËÒÁÎÉÒÏ×ÁÌÁ ÓÉÍ×ÏÌ ";" ÐÒÉ
- ËÏÐÉÒÏ×ÁÎÉÉ ÉÚ URI × ÁÒÇÕÍÅÎÔÙ.
- óÐÁÓÉÂÏ Daisuke Murase.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÍÏÄÕÌØ ngx_http_image_filter_module ÚÁËÒÙ×ÁÌ
- ÓÏÅÄÉÎÅÎÉÅ, ÅÓÌÉ ÉÚÏÂÒÁÖÅÎÉÅ ÂÙÌÏ ÂÏÌØÛÅ ÒÁÚÍÅÒÁ image_filter_buffer.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.47 28.07.2010
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÅÒÅÍÅÎÎÁÑ $request_time ÉÍÅÌÁ ÎÅ×ÅÒÎÙÅ ÚÎÁÞÅÎÉÑ ÄÌÑ
- ÐÏÄÚÁÐÒÏÓÏ×.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÏÛÉÂËÉ, ÐÅÒÅÈ×ÁÞÅÎÎÙÅ error_page, ÎÅ ËÜÛÉÒÏ×ÁÌÉÓØ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÅÓÌÉ ÉÓÐÏÌØÚÏ×ÁÌÓÑ ÐÁÒÁÍÅÔÒ max_size, ÔÏ cache manager
- ÍÏÇ ÚÁÃÉËÌÉÔØÓÑ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.8.46.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.46 19.07.2010
-
- *) éÚÍÅÎÅÎÉÅ: ÄÉÒÅËÔÉ×Ù proxy_no_cache, fastcgi_no_cache,
- uwsgi_no_cache É scgi_no_cache ÔÅÐÅÒØ ×ÌÉÑÀÔ ÔÏÌØËÏ ÎÁ ÓÏÈÒÁÎÅÎÉÅ
- ÚÁËÜÛÉÒÏ×ÁÎÎÏÇÏ ÏÔ×ÅÔÁ.
-
- *) äÏÂÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Ù proxy_cache_bypass, fastcgi_cache_bypass,
- uwsgi_cache_bypass É scgi_cache_bypass.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÏÓ×ÏÂÏÖÄÁÌ ÐÁÍÑÔØ × keys_zone ËÜÛÅÊ × ÓÌÕÞÁÅ
- ÏÛÉÂËÉ ÒÁÂÏÔÙ Ó ÂÜËÅÎÄÏÍ: ÐÁÍÑÔØ ÏÓ×ÏÂÏÖÄÁÌÁÓØ ÔÏÌØËÏ ÐÏ ÉÓÔÅÞÅÎÉÉ
- ×ÒÅÍÅÎÉ ÎÅÁËÔÉ×ÎÏÓÔÉ ÉÌÉ ÐÒÉ ÎÅÄÏÓÔÁÔËÅ ÐÁÍÑÔÉ.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.45 13.07.2010
-
- *) äÏÂÁ×ÌÅÎÉÅ: ÕÌÕÞÛÅÎÉÑ × ÍÏÄÕÌÅ ngx_http_xslt_filter.
- óÐÁÓÉÂÏ Laurence Rowe.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÏÔ×ÅÔ SSI ÍÏÄÕÌÑ ÍÏÇ ÐÅÒÅÄÁ×ÁÔØÓÑ ÎÅ ÐÏÌÎÏÓÔØÀ ÐÏÓÌÅ
- ËÏÍÁÎÄÙ include Ó ÐÁÒÁÍÅÔÒÏÍ wait="yes"; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.25.
- óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Á listen ÎÅ ÐÏÄÄÅÒÖÉ×ÁÌÁ ÐÁÒÁÍÅÔÒ setfib=0.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.44 05.07.2010
-
- *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ nginx ÐÏ ÕÍÏÌÞÁÎÉÀ ÎÅ ËÜÛÉÒÕÅÔ ÏÔ×ÅÔÙ ÂÜËÅÎÄÏ×, ×
- ÚÁÇÏÌÏ×ËÅ ËÏÔÏÒÙÈ ÅÓÔØ ÓÔÒÏËÁ "Set-Cookie".
-
- *) äÏÂÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Á listen ÐÏÄÄÅÒÖÉ×ÁÅÔ ÐÁÒÁÍÅÔÒ setfib.
- óÐÁÓÉÂÏ áÎÄÒÅÀ æÉÌÏÎÏ×Õ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Á sub_filter ÍÏÇÌÁ ÉÚÍÅÎÑÔØ ÒÅÇÉÓÔÒ ÂÕË× ÐÒÉ
- ÞÁÓÔÉÞÎÏÍ ÓÏ×ÐÁÄÅÎÉÉ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÓÏ×ÍÅÓÔÉÍÏÓÔØ Ó HP/UX.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÓÏ×ÍÅÓÔÉÍÏÓÔØ Ó ËÏÍÐÉÌÑÔÏÒÏÍ AIX xcl_r.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÓÞÉÔÁÌ ÂÏÌØÛÉÅ ÐÁËÅÔÙ SSLv2 ËÁË ÏÂÙÞÎÙÅ ÔÅËÓÔÏ×ÙÅ
- ÚÁÐÒÏÓÙ.
- óÐÁÓÉÂÏ Miroslaw Jaworski.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.43 30.06.2010
-
- *) äÏÂÁ×ÌÅÎÉÅ: ÕÓËÏÒÅÎÉÅ ÚÁÇÒÕÚËÉ ÂÏÌØÛÉÈ ÂÁÚ geo-ÄÉÁÐÁÚÏÎÏ×.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÅÒÅÎÁÐÒÁ×ÌÅÎÉÅ ÏÛÉÂËÉ × "location /zero {return 204;}"
- ÂÅÚ ÉÚÍÅÎÅÎÉÑ ËÏÄÁ ÏÔ×ÅÔÁ ÏÓÔÁ×ÌÑÌÏ ÔÅÌÏ ÏÛÉÂËÉ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ ×
- 0.8.42.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÍÏÇ ÚÁËÒÙ×ÁÔØ IPv6 listen ÓÏËÅÔ ×Ï ×ÒÅÍÑ
- ÐÅÒÅËÏÎÆÉÇÕÒÁÃÉÉ.
- óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÅÒÅÍÅÎÎÕÀ $uid_set ÍÏÖÎÏ ÉÓÐÏÌØÚÏ×ÁÔØ ÎÁ ÌÀÂÏÊ ÓÔÁÄÉÉ
- ÏÂÒÁÂÏÔËÉ ÚÁÐÒÏÓÁ.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.42 21.06.2010
-
- *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ nginx ÐÒÏ×ÅÒÑÅÔ location'Ù, ÚÁÄÁÎÎÙÅ ÒÅÇÕÌÑÒÎÙÍÉ
- ×ÙÒÁÖÅÎÉÑÍÉ, ÅÓÌÉ ÚÁÐÒÏÓ ÐÏÌÎÏÓÔØÀ ÓÏ×ÐÁÌ Ó location'ÏÍ, ÚÁÄÁÎÎÙÍ
- ÓÔÒÏËÏÊ ÐÒÅÆÉËÓÁ. ðÒÅÄÙÄÕÝÅÅ ÐÏ×ÅÄÅÎÉÅ ÐÏÑ×ÉÌÏÓØ × 0.7.1.
-
- *) äÏÂÁ×ÌÅÎÉÅ: ÍÏÄÕÌØ ngx_http_scgi_module.
- óÐÁÓÉÂÏ Manlio Perillo.
-
- *) äÏÂÁ×ÌÅÎÉÅ: × ÄÉÒÅËÔÉ×Å return ÍÏÖÎÏ ÄÏÂÁ×ÌÑÔØ ÔÅËÓÔ ÏÔ×ÅÔÁ.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.41 15.06.2010
-
- *) âÅÚÏÐÁÓÎÏÓÔØ: ÒÁÂÏÞÉÊ ÐÒÏÃÅÓÓ nginx/Windows ÍÏÇ ÚÁ×ÅÒÛÁÔØÓÑ Á×ÁÒÉÊÎÏ
- ÐÒÉ ÚÁÐÒÏÓÅ ÆÁÊÌÁ Ó ÎÅ×ÅÒÎÏÊ ËÏÄÉÒÏ×ËÏÊ UTF-8.
-
- *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ nginx ÒÁÚÒÅÛÁÅÔ ÉÓÐÏÌØÚÏ×ÁÔØ ÐÒÏÂÅÌÙ × ÓÔÒÏËÅ
- ÚÁÐÒÏÓÁ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Á proxy_redirect ÎÅÐÒÁ×ÉÌØÎÏ ÉÚÍÅÎÑÌÁ ÓÔÒÏËÕ
- "Refresh" × ÚÁÇÏÌÏ×ËÅ ÏÔ×ÅÔÁ ÂÜËÅÎÄÁ.
- óÐÁÓÉÂÏ áÎÄÒÅÀ áÎÄÒÅÅ×Õ É íÁËÓÉÍÕ óÏÇÉÎÕ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÐÏÄÄÅÒÖÉ×ÁÌ ÐÕÔØ ÂÅÚ ÉÍÅÎÉ ÈÏÓÔÁ × ÓÔÒÏËÅ
- "Destination" × ÚÁÇÏÌÏ×ËÅ ÚÁÐÒÏÓÁ.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.40 07.06.2010
-
- *) âÅÚÏÐÁÓÎÏÓÔØ: ÔÅÐÅÒØ nginx/Windows ÉÇÎÏÒÉÒÕÅÔ ÉÍÑ ÐÏÔÏËÁ ÆÁÊÌÁ ÐÏ
- ÕÍÏÌÞÁÎÉÀ.
- óÐÁÓÉÂÏ Jose Antonio Vazquez Gonzalez.
-
- *) äÏÂÁ×ÌÅÎÉÅ: ÍÏÄÕÌØ ngx_http_uwsgi_module.
- óÐÁÓÉÂÏ Roberto De Ioris.
-
- *) äÏÂÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Á fastcgi_param ÓÏ ÚÎÁÞÅÎÉÅÍ, ÎÁÞÉÎÁÀÝÉÍÓÑ ÓÏ
- ÓÔÒÏËÉ "HTTP_", ÉÚÍÅÎÑÅÔ ÓÔÒÏËÕ ÚÁÇÏÌÏ×ËÁ × ÚÁÐÒÏÓÅ ËÌÉÅÎÔÁ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÓÔÒÏËÉ "If-Modified-Since", "If-Range" É ÉÍ ÐÏÄÏÂÎÙÅ ×
- ÚÁÇÏÌÏ×ËÅ ÚÁÐÒÏÓÁ ËÌÉÅÎÔÁ ÐÅÒÅÄÁ×ÁÌÉÓØ FastCGI-ÓÅÒ×ÅÒÕ ÐÒÉ
- ËÜÛÉÒÏ×ÁÎÉÉ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: listen unix domain ÓÏËÅÔ ÎÅÌØÚÑ ÂÙÌÏ ÉÚÍÅÎÉÔØ ×Ï ×ÒÅÍÑ
- ÐÅÒÅËÏÎÆÉÇÕÒÁÃÉÉ.
- óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.39 31.05.2010
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÎÁÓÌÅÄÕÅÍÁÑ ÄÉÒÅËÔÉ×Á alias ÎÅÐÒÁ×ÉÌØÎÏ ÒÁÂÏÔÁÌÁ ×Ï
- ×ÌÏÖÅÎÎÏÍ location'Å.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: × ËÏÍÂÉÎÁÃÉÉ ÄÉÒÅËÔÉ× alias Ó ÐÅÒÅÍÅÎÎÙÍÉ É try_files;
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: listen unix domain É IPv6 ÓÏËÅÔÙ ÎÅ ÎÁÓÌÅÄÏ×ÁÌÉÓØ ×Ï
- ×ÒÅÍÑ ÏÂÎÏ×ÌÅÎÉÑ ÂÅÚ ÐÅÒÅÒÙ×Á.
- óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.38 24.05.2010
-
- *) äÏÂÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Ù proxy_no_cache É fastcgi_no_cache.
-
- *) äÏÂÁ×ÌÅÎÉÅ: ÔÅÐÅÒØ ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ ÐÅÒÅÍÅÎÎÏÊ $scheme × ÄÉÒÅËÔÉ×Å
- rewrite Á×ÔÏÍÁÔÉÞÅÓËÉ ÄÅÌÁÅÔÓÑ ÒÅÄÉÒÅËÔ.
- óÐÁÓÉÂÏ Piotr Sikora.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÔÅÐÅÒØ ÚÁÄÅÒÖËÉ × ÄÉÒÅËÔÉ×Å limit_req ÓÏÏÔ×ÅÔÓÔ×ÕÅÔ
- ÏÐÉÓÁÎÎÏÍÕ ÁÌÇÏÒÉÔÍÕ.
- óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÅÒÅÍÅÎÎÕÀ $uid_got ÎÅÌØÚÑ ÂÙÌÏ ÉÓÐÏÌØÚÏ×ÁÔØ × SSI É
- ÐÅÒÌÏ×ÏÍ ÍÏÄÕÌÑÈ.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.37 17.05.2010
-
- *) äÏÂÁ×ÌÅÎÉÅ: ÍÏÄÕÌØ ngx_http_split_clients_module.
-
- *) äÏÂÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Á map ÐÏÄÄÅÒÖÉ×ÁÅÔ ËÌÀÞÉ ÂÏÌØÛÅ 255 ÓÉÍ×ÏÌÏ×.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÉÇÎÏÒÉÒÏ×ÁÌ ÚÎÁÞÅÎÉÑ "private" É "no-store" ×
- ÓÔÒÏËÅ "Cache-Control" × ÚÁÇÏÌÏ×ËÅ ÏÔ×ÅÔÁ ÂÜËÅÎÄÁ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÁÒÁÍÅÔÒ stub × SSI-ÄÉÒÅËÔÉ×Å include ÎÅ ÉÓÐÏÌØÚÏ×ÁÌÓÑ,
- ÅÓÌÉ ÐÕÓÔÏÊ ÏÔ×ÅÔ ÉÍÅÌ ËÏÄ 200.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÅÓÌÉ ÐÒÏËÓÉÒÏ×ÁÎÎÙÊ ÉÌÉ FastCGI ÚÁÐÒÏÓ ×ÎÕÔÒÅÎÎÅ
- ÐÅÒÅÎÁÐÒÁ×ÌÑÌÓÑ × ÄÒÕÇÏÊ ÐÒÏËÓÉÒÏ×ÁÎÎÙÊ ÉÌÉ FastCGI location, ÔÏ ×
- ÒÁÂÏÞÅÍ ÐÒÏÃÅÓÓÅ ÍÏÇ ÐÒÏÉÚÏÊÔÉ segmentation fault; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ
- × 0.8.33.
- óÐÁÓÉÂÏ Yichun Zhang.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÓÏÅÄÉÎÅÎÉÑ IMAP Ë ÓÅÒ×ÅÒÕ Zimbra ÍÏÇÌÏ ÚÁ×ÉÓÎÕÔØ ÄÏ
- ÔÁÊÍÁÕÔÁ.
- óÐÁÓÉÂÏ Alan Batie.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.36 22.04.2010
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÍÏÄÕÌØ ngx_http_dav_module ÎÅÐÒÁ×ÉÌØÎÏ ÏÂÒÁÂÁÔÙ×ÁÌ
- ÍÅÔÏÄÙ DELETE, COPY É MOVE ÄÌÑ ÓÉÍÌÉÎËÏ×.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÍÏÄÕÌØ SSI × ÐÏÄÚÁÐÒÏÓÁÈ ÉÓÐÏÌØÚÏ×ÁÌ ÚÁËÜÛÉÒÏ×ÁÎÎÙÅ ×
- ÏÓÎÏ×ÎÏÍ ÚÁÐÒÏÓÅ ÚÎÁÞÅÎÉÑ ÐÅÒÅÍÅÎÎÙÈ $query_string, $arg_... É ÉÍ
- ÐÏÄÏÂÎÙÈ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÚÎÁÞÅÎÉÅ ÐÅÒÅÍÅÎÎÏÊ ÐÏ×ÔÏÒÎÏ ÜËÒÁÎÉÒÏ×ÁÌÏÓØ ÐÏÓÌÅ
- ËÁÖÄÏÇÏ ×Ù×ÏÄÁ SSI-ËÏÍÁÎÄÙ echo; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.6.14.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÒÁÂÏÞÉÊ ÐÒÏÃÅÓÓ ÚÁ×ÉÓÁÌ ÐÒÉ ÚÁÐÒÏÓÅ ÆÁÊÌÁ FIFO.
- óÐÁÓÉÂÏ Vicente Aguilar É íÁËÓÉÍÕ äÕÎÉÎÕ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÓÏ×ÍÅÓÔÉÍÏÓÔØ Ó OpenSSL-1.0.0 ÎÁ 64-ÂÉÔÎÏÍ Linux.
- óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÓÏÂÉÒÁÌÓÑ Ó ÐÁÒÁÍÅÔÒÏÍ --without-http-cache;
- ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.8.35.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.35 01.04.2010
-
- *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ charset-ÆÉÌØÔÒ ÒÁÂÏÔÁÅÔ ÄÏ SSI-ÆÉÌØÔÒÁ.
-
- *) äÏÂÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Á chunked_transfer_encoding.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÓÉÍ×ÏÌ "&" ÐÒÉ ËÏÐÉÒÏ×ÁÎÉÉ × ÁÒÇÕÍÅÎÔÙ × ÐÒÁ×ÉÌÁÈ
- rewrite ÎÅ ÜËÒÁÎÉÒÏ×ÁÌÓÑ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÍÏÇ ÚÁ×ÅÒÛÁÔØÓÑ Á×ÁÒÉÊÎÏ ×Ï ×ÒÅÍÑ ÏÂÒÁÂÏÔËÉ
- ÓÉÇÎÁÌÁ ÉÌÉ ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ ÄÉÒÅËÔÉ×Ù timer_resolution ÎÁ
- ÐÌÁÔÆÏÒÍÁÈ, ÎÅ ÐÏÄÄÅÒÖÉ×ÁÀÝÉÈ ÍÅÔÏÄÙ kqueue ÉÌÉ eventport.
- óÐÁÓÉÂÏ George Xie É íÁËÓÉÍÕ äÕÎÉÎÕ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÅÓÌÉ ×ÒÅÍÅÎÎÙÅ ÆÁÊÌÙ É ÐÏÓÔÏÑÎÎÏÅ ÍÅÓÔÏ ÈÒÁÎÅÎÉÑ
- ÒÁÓÐÏÌÁÇÁÌÉÓØ ÎÁ ÒÁÚÎÙÈ ÆÁÊÌÏ×ÙÈ ÓÉÓÔÅÍÁÈ, ÔÏ Õ ÐÏÓÔÏÑÎÎÙÈ ÆÁÊÌÏ×
- ×ÒÅÍÑ ÉÚÍÅÎÅÎÉÑ ÂÙÌÏ ÎÅ×ÅÒÎÙÍ.
- óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÍÏÄÕÌØ ngx_http_memcached_module ÍÏÇ ×ÙÄÁ×ÁÔØ ÏÛÉÂËÕ
- "memcached sent invalid trailer".
- óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÍÏÇ ÓÏÂÒÁÔØ ÂÉÂÌÉÏÔÅËÕ zlib-1.2.4 ÉÚ ÉÓÈÏÄÎÙÈ
- ÔÅËÓÔÏ×.
- óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: × ÒÁÂÏÞÅÍ ÐÒÏÃÅÓÓÅ ÐÒÏÉÓÈÏÄÉÌ segmentation fault, ÅÓÌÉ
- ÐÅÒÅÄ ÏÔ×ÅÔÏÍ FastCGI-ÓÅÒ×ÅÒÁ ÂÙÌÏ ÍÎÏÇÏ ×Ù×ÏÄÁ × stderr; ÏÛÉÂËÁ
- ÐÏÑ×ÉÌÁÓØ × 0.8.34.
- óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.34 03.03.2010
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÐÏÄÄÅÒÖÉ×ÁÌ ×ÓÅ ÛÉÆÒÙ, ÉÓÐÏÌØÚÕÅÍÙÅ ×
- ËÌÉÅÎÔÓËÉÈ ÓÅÒÔÉÆÉËÁÔÁÈ.
- óÐÁÓÉÂÏ éÎÎÏËÅÎÔÉÀ åÎÉËÅÅ×Õ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅÐÒÁ×ÉÌØÎÏ ËÜÛÉÒÏ×ÁÌ FastCGI-ÏÔ×ÅÔÙ, ÅÓÌÉ ÐÅÒÅÄ
- ÏÔ×ÅÔÏÍ ÂÙÌÏ ÍÎÏÇÏ ×Ù×ÏÄÁ × stderr.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÐÏÄÄÅÒÖÉ×ÁÌ HTTPS-ÒÅÆÅÒÅÒÙ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: nginx/Windows ÍÏÇ ÎÅ ÎÁÈÏÄÉÔØ ÆÁÊÌÙ, ÅÓÌÉ ÐÕÔØ ×
- ËÏÎÆÉÇÕÒÁÃÉÉ ÂÙÌ ÚÁÄÁÎ × ÄÒÕÇÏÍ ÒÅÇÉÓÔÒÅ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.8.33.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÅÒÅÍÅÎÎÁÑ $date_local ×ÙÄÁ×ÁÌÁ ÎÅ×ÅÒÎÏÅ ×ÒÅÍÑ, ÅÓÌÉ
- ÉÓÐÏÌØÚÏ×ÁÌÓÑ ÆÏÒÍÁÔ "%s".
- óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÅÓÌÉ ssl_session_cache ÎÅ ÂÙÌ ÕÓÔÁÎÏ×ÌÅÎ ÉÌÉ ÕÓÔÁÎÏ×ÌÅÎ
- × none, ÔÏ ÐÒÉ ÐÒÏ×ÅÒËÅ ËÌÉÅÎÔÓËÏÇÏ ÓÅÒÔÉÆÉËÁÔÙ ÍÏÇÌÁ ÐÒÏÉÓÈÏÄÉÔØ
- ÏÛÉÂËÁ "session id context uninitialized"; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.1.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: geo-ÄÉÁÐÁÚÏÎ ×ÏÚ×ÒÁÝÁÌ ÚÎÁÞÅÎÉÅ ÐÏ ÕÍÏÌÞÁÎÉÀ, ÅÓÌÉ
- ÄÉÁÐÁÚÏÎ ×ËÌÀÞÁÌ × ÓÅÂÑ ÏÄÎÕ É ÂÏÌÅÅ ÓÅÔÅÊ ÒÁÚÍÅÒÏÍ /16 É ÎÅ
- ÎÁÞÉÎÁÌÓÑ ÎÁ ÇÒÁÎÉÃÅ ÓÅÔÉ ÒÁÚÍÅÒÏÍ /16.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÂÌÏË, ÉÓÐÏÌØÚÕÅÍÙÊ × ÐÁÒÁÍÅÔÒÅ stub × SSI-ÄÉÒÅËÔÉ×Å
- include, ×Ù×ÏÄÉÌÓÑ Ó MIME-ÔÉÐÏÍ "text/plain".
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: $r->sleep() ÎÅ ÒÁÂÏÔÁÌ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.8.11.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.33 01.02.2010
-
- *) âÅÚÏÐÁÓÎÏÓÔØ: ÔÅÐÅÒØ nginx/Windows ÉÇÎÏÒÉÒÕÅÔ ÐÒÏÂÅÌÙ × ËÏÎÃÅ URI.
- óÐÁÓÉÂÏ Dan Crowley, Core Security Technologies.
-
- *) âÅÚÏÐÁÓÎÏÓÔØ: ÔÅÐÅÒØ nginx/Windows ÉÇÎÏÒÉÒÕÅÔ ËÏÒÏÔËÉÅ ÉÍÅÎÁ ÆÁÊÌÏ×.
- óÐÁÓÉÂÏ Dan Crowley, Core Security Technologies.
-
- *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ keepalive ÓÏÅÄÉÎÅÎÉÑ ÐÏÓÌÅ ÚÁÐÒÏÓÏ× POST ÎÅ
- ÚÁÐÒÅÝÁÀÔÓÑ ÄÌÑ MSIE 7.0+.
- óÐÁÓÉÂÏ Adam Lounds.
-
- *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ keepalive ÓÏÅÄÉÎÅÎÉÑ ÚÁÐÒÅÝÅÎÙ ÄÌÑ Safari.
- óÐÁÓÉÂÏ Joshua Sierles.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÅÓÌÉ ÐÒÏËÓÉÒÏ×ÁÎÎÙÊ ÉÌÉ FastCGI ÚÁÐÒÏÓ ×ÎÕÔÒÅÎÎÅ
- ÐÅÒÅÎÁÐÒÁ×ÌÑÌÓÑ × ÄÒÕÇÏÊ ÐÒÏËÓÉÒÏ×ÁÎÎÙÊ ÉÌÉ FastCGI location, ÔÏ
- ÐÅÒÅÍÅÎÎÁÑ $upstream_response_time ÍÏÇÌÁ ÉÍÅÔØ ÎÅÎÏÒÍÁÌØÎÏ ÂÏÌØÛÏÅ
- ÚÎÁÞÅÎÉÅ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.8.7.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: × ÒÁÂÏÞÅÍ ÐÒÏÃÅÓÓÅ ÍÏÇ ÐÒÏÉÚÏÊÔÉ segmentation fault ÐÒÉ
- ÏÔÂÒÁÓÙ×ÁÎÉÑ ÔÅÌÁ ÚÁÐÒÏÓÁ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.8.11.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.32 11.01.2010
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÏÛÉÂËÉ ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ ËÏÄÉÒÏ×ËÉ UTF-8 ×
- ngx_http_autoindex_module.
- óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÉÍÅÎÏ×ÁÎÎÙÅ ×ÙÄÅÌÅÎÉÑ × ÒÅÇÕÌÑÒÎÙÈ ×ÙÒÁÖÅÎÉÑÈ ÒÁÂÏÔÁÌÉ
- ÔÏÌØËÏ ÄÌÑ Ä×ÕÈ ÐÅÒÅÍÅÎÎÙÈ.
- óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÔÅÐÅÒØ × ÓÔÒÏËÅ ÚÁÇÏÌÏ×ËÁ ÚÁÐÒÏÓÁ "Host" ÉÓÐÏÌØÚÕÅÔÓÑ
- ÉÍÑ "localhost", ÅÓÌÉ × ÄÉÒÅËÔÉ×Å auth_http ÕËÁÚÁÎ unix domain
- ÓÏËÅÔ.
- óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÐÏÄÄÅÒÖÉ×ÁÌ ÐÅÒÅÄÁÞÕ chunk'ÁÍÉ ÄÌÑ 201-ÙÈ
- ÏÔ×ÅÔÏ×.
- óÐÁÓÉÂÏ Julian Reich.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÅÓÌÉ ÄÉÒÅËÔÉ×Á "expires modified" ×ÙÓÔÁ×ÌÑÌÁ ÄÁÔÕ ×
- ÐÒÏÛÌÏÍ, ÔÏ × ÓÔÒÏËÅ ÚÁÇÏÌÏ×ËÁ ÏÔ×ÅÔÁ "Cache-Control" ×ÙÄÁ×ÁÌÏÓØ
- ÏÔÒÉÃÁÔÅÌØÎÏÅ ÞÉÓÌÏ.
- óÐÁÓÉÂÏ áÌÅËÓÅÀ ëÁÐÒÁÎÏ×Õ.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.31 23.12.2009
-
- *) äÏÂÁ×ÌÅÎÉÅ: ÔÅÐÅÒØ ÄÉÒÅËÔÉ×Á error_page ÍÏÖÅÔ ÐÅÒÅÎÁÐÒÁ×ÌÑÔØ ÏÔ×ÅÔÙ
- ÓÏ ÓÔÁÔÕÓÏÍ 301 É 302.
-
- *) äÏÂÁ×ÌÅÎÉÅ: ÐÅÒÅÍÅÎÎÙÅ $geoip_city_continent_code, $geoip_latitude É
- $geoip_longitude.
- óÐÁÓÉÂÏ Arvind Sundararajan.
-
- *) äÏÂÁ×ÌÅÎÉÅ: ÍÏÄÕÌØ ngx_http_image_filter_module ÔÅÐÅÒØ ×ÓÅÇÄÁ
- ÕÄÁÌÑÅÔ EXIF É ÄÒÕÇÉÅ ÄÁÎÎÙÅ, ÅÓÌÉ ÏÎÉ ÚÁÎÉÍÁÀÔ ÂÏÌØÛÅ 5% ×
- JPEG-ÆÁÊÌÅ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÚÁËÒÙ×ÁÌ ÓÏÅÄÉÎÅÎÉÅ ÐÒÉ ÚÁÐÒÏÓÅ ÚÁËÜÛÉÒÏ×ÁÎÎÏÇÏ
- ÏÔ×ÅÔÁ Ó ÐÕÓÔÙÍ ÔÅÌÏÍ.
- óÐÁÓÉÂÏ Piotr Sikora.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÍÏÇ ÎÅ ÓÏÂÉÒÁÔØÓÑ gcc 4.x ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ
- ÏÐÔÉÍÉÚÁÃÉÉ -O2 É ×ÙÛÅ.
- óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ É äÅÎÉÓÕ ìÁÔÙÐÏ×Õ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÒÅÇÕÌÑÒÎÙÅ ×ÙÒÁÖÅÎÉÑ × location ×ÓÅÇÄÁ ÔÅÓÔÉÒÏ×ÁÌÉÓØ Ó
- ÕÞ£ÔÏÍ ÒÅÇÉÓÔÒÁ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.8.25.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ËÜÛÉÒÏ×ÁÌ 304 ÏÔ×ÅÔ, ÅÓÌÉ × ÚÁÇÏÌÏ×ËÅ
- ÐÒÏËÓÉÒÕÅÍÏÇÏ ÚÁÐÒÏÓÁ ÂÙÌÁ ÓÔÒÏËÁ "If-None-Match".
- óÐÁÓÉÂÏ Tim Dettrick É David Kostal.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: nginx/Windows ÐÙÔÁÌÓÑ Ä×ÁÖÄÙ ÕÄÁÌÉÔØ ×ÒÅÍÅÎÎÙÊ ÆÁÊÌ ÐÒÉ
- ÐÅÒÅÚÁÐÉÓÉ ÕÖÅ ÓÕÝÅÓÔ×ÕÀÝÅÇÏ ÆÁÊÌÁ.
-
-
-éÚÍÅÎÅÎÉÑ × nginx 0.8.30 15.12.2009
-
- *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ ÐÏ ÕÍÏÌÞÁÎÉÀ ÒÁÚÍÅÒ ÂÕÆÅÒÁ ÄÉÒÅËÔÉ×Ù
- large_client_header_buffers ÒÁ×ÅÎ 8K.
- óÐÁÓÉÂÏ Andrew Cholakian.
-
- *) äÏÂÁ×ÌÅÎÉÅ: ÆÁÊÌ conf/fastcgi.conf ÄÌÑ ÐÒÏÓÔÙÈ ËÏÎÆÉÇÕÒÁÃÉÊ FastCGI.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: nginx/Windows ÐÙÔÁÌÓÑ Ä×ÁÖÄÙ ÐÅÒÅÉÍÅÎÏ×ÁÔØ ×ÒÅÍÅÎÎÙÊ
- ÆÁÊÌ ÐÒÉ ÐÅÒÅÚÁÐÉÓÉ ÕÖÅ ÓÕÝÅÓÔ×ÕÀÝÅÇÏ ÆÁÊÌÁ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÏÛÉÂËÉ double free or corruption, ×ÏÚÎÉËÁÀÝÅÊ, ÅÓÌÉ ÉÍÑ
- ÈÏÓÔÁ ÎÅ ÂÙÌÏ ÎÁÊÄÅÎÏ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.8.22.
- óÐÁÓÉÂÏ ëÏÎÓÔÁÎÔÉÎÕ ó×ÉÓÔÕ.
-
- *) éÓÐÒÁ×ÌÅÎÉÅ: × ÉÓÐÏÌØÚÏ×ÁÎÉÉ libatomic ÎÁ ÎÅËÏÔÏÒÙÈ ÐÌÁÔÆÏÒÍÁÈ.
- óÐÁÓÉÂÏ W-Mark Kubacki.
-
-
éÚÍÅÎÅÎÉÑ × nginx 0.8.29 30.11.2009
*) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ ÄÌÑ ÐÒÏËÓÉÒÕÅÍÙÈ ÏÔ×ÅÔÏ× HTTP/0.9 × ÌÏÇ ÐÉÛÅÔÓÑ
@@ -526,7 +86,7 @@
*) âÅÚÏÐÁÓÎÏÓÔØ: ÔÅÐÅÒØ SSL/TLS renegotiation ÚÁÐÒÅÝ£Î.
óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
- *) éÓÐÒÁ×ÌÅÎÉÅ: listen unix domain ÓÏËÅÔ ÎÅ ÎÁÓÌÅÄÏ×ÁÌÓÑ ×Ï ×ÒÅÍÑ
+ *) éÓÐÒÁ×ÌÅÎÉÅ: listen unix domain ÓÏËÅÔ ÎÅ ÎÁÓÌÅÄÏ×ÁÌÉÓØ ×Ï ×ÒÅÍÑ
ÏÂÎÏ×ÌÅÎÉÑ ÂÅÚ ÐÅÒÅÒÙ×Á.
*) éÓÐÒÁ×ÌÅÎÉÅ: ÐÁÒÁÍÅÔÒ "unix:" × ÄÉÒÅËÔÉ×Å set_real_ip_from ÎÅ
@@ -602,7 +162,7 @@
--error-log-path; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.53.
*) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÓÞÉÔÁÌ ÚÁÐÑÔÕÀ ÒÁÚÄÅÌÉÔÅÌÅÍ × ÓÔÒÏËÅ
- "Cache-Control" × ÚÁÇÏÌÏ×ËÅ ÏÔ×ÅÔÁ ÂÜËÅÎÄÁ.
+ "Cache-Control" × ÓÔÒÏËÅ ÚÁÇÏÌÏ×ËÁ ÂÜËÅÎÄÁ.
*) éÓÐÒÁ×ÌÅÎÉÅ: nginx/Windows ÍÏÇ ÎÅ ÓÏÚÄÁÔØ ×ÒÅÍÅÎÎÙÊ ÆÁÊÌ, ÆÁÊÌ ×
ËÜÛÅ ÉÌÉ ÆÁÊÌ Ó ÐÏÍÏÝØÀ ÄÉÒÅËÔÉ× proxy/fastcgi_store, ÅÓÌÉ ÒÁÂÏÞÉÊ
@@ -636,7 +196,7 @@
*) äÏÂÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Ù limit_req_log_level É limit_conn_log_level.
- *) éÓÐÒÁ×ÌÅÎÉÅ: ÔÅÐÅÒØ ÄÉÒÅËÔÉ×Á limit_req ÓÏÏÔ×ÅÔÓÔ×ÕÅÔ ÁÌÇÏÒÉÔÍÕ
+ *) éÓÐÒÁ×ÌÅÎÉÅ: ôÅÐÅÒØ ÄÉÒÅËÔÉ×Á limit_req ÓÏÏÔ×ÅÔÓÔ×ÕÅÔ ÁÌÇÏÒÉÔÍÕ
leaky bucket.
óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
@@ -823,7 +383,7 @@
óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
*) éÓÐÒÁ×ÌÅÎÉÅ: × ÏÂÒÁÂÏÔËÅ ÓÔÒÏË "Last-Modified" É "Accept-Ranges" ×
- ÚÁÇÏÌÏ×ËÅ ÏÔ×ÅÔÁ ÂÜËÅÎÄÁ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.44.
+ ÚÁÇÏÌÏ×ËÅ ÏÔ×ÅÔÁ ÂÜËÅÎÄÁ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.44
óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
*) éÓÐÒÁ×ÌÅÎÉÅ: ÏÛÉÂËÉ "[alert] zero size buf" ÐÒÉ ÐÏÌÕÞÅÎÉÉ ÐÕÓÔÙÈ
@@ -2002,7 +1562,7 @@
*) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ×ÅÒÎÏ ÏÐÒÅÄÅÌÑÌ ÄÌÉÎÕ ÓÔÒÏËÉ ËÜÛÁ ÎÁ
Pentium 4.
- óÐÁÓÉÂÏ çÅÎÎÁÄÉÀ íÁÈÏÍÅÄÕ.
+ óÐÁÓÉÂÏ Gena Makhomed.
*) éÓÐÒÁ×ÌÅÎÉÅ: × ÐÒÏËÓÉÒÏ×ÁÎÎÙÈ ÐÏÄÚÁÐÒÏÓÁÈ É ÐÏÄÚÁÐÒÏÓÁÈ Ë
FastCGI-ÓÅÒ×ÅÒÕ ×ÍÅÓÔÏ ÍÅÔÏÄÁ GET ÉÓÐÏÌØÚÏ×ÁÌÓÑ ÏÒÉÇÉÎÁÌØÎÙÊ ÍÅÔÏÄ
@@ -2270,7 +1830,7 @@
óÐÁÓÉÂÏ áÎÄÒÅÀ îÉÇÍÁÔÕÌÉÎÕ.
*) éÓÐÒÁ×ÌÅÎÉÅ: ngx_http_memcached_module ÎÅ ÕÓÔÁÎÁ×ÌÉ×ÁÌ
- $upstream_response_time.
+ upstream_response_time.
óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
*) éÓÐÒÁ×ÌÅÎÉÅ: ÒÁÂÏÞÉÊ ÐÒÏÃÅÓÓ ÍÏÇ ÚÁÃÉËÌÉÔØÓÑ ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/LICENSE
^
|
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2010 Igor Sysoev
+ * Copyright (C) 2002-2009 Igor Sysoev
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/auto/cc/conf
^
|
@@ -143,6 +143,19 @@
. auto/feature
+ ngx_feature="gcc variadic macros"
+ ngx_feature_name="NGX_HAVE_GCC_VARIADIC_MACROS"
+ ngx_feature_run=yes
+ ngx_feature_incs="#include <stdio.h>
+#define var(dummy, args...) sprintf(args)"
+ ngx_feature_path=
+ ngx_feature_libs=
+ ngx_feature_test="char buf[30]; buf[0] = '0';
+ var(0, buf, \"%d\", 1);
+ if (buf[0] != '1') return 1"
+ . auto/feature
+
+
if [ "$NGX_CC_NAME" = "ccc" ]; then
echo "checking for C99 variadic macros ... disabled"
else
@@ -160,19 +173,6 @@
fi
- ngx_feature="gcc variadic macros"
- ngx_feature_name="NGX_HAVE_GCC_VARIADIC_MACROS"
- ngx_feature_run=yes
- ngx_feature_incs="#include <stdio.h>
-#define var(dummy, args...) sprintf(args)"
- ngx_feature_path=
- ngx_feature_libs=
- ngx_feature_test="char buf[30]; buf[0] = '0';
- var(0, buf, \"%d\", 1);
- if (buf[0] != '1') return 1"
- . auto/feature
-
-
# ngx_feature="inline"
# ngx_feature_name=
# ngx_feature_run=no
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/auto/cc/gcc
^
|
@@ -51,6 +51,8 @@
#NGX_GCC_OPT="-Os"
NGX_GCC_OPT="-O"
+CFLAGS="$CFLAGS $NGX_GCC_OPT"
+
#CFLAGS="$CFLAGS -fomit-frame-pointer"
case $CPU in
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/auto/install
^
|
@@ -101,20 +101,6 @@
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_PREFIX/uwsgi_params' \
- || cp conf/uwsgi_params '\$(DESTDIR)$NGX_CONF_PREFIX'
- cp conf/uwsgi_params \
- '\$(DESTDIR)$NGX_CONF_PREFIX/uwsgi_params.default'
-
- test -f '\$(DESTDIR)$NGX_CONF_PREFIX/scgi_params' \
- || cp conf/scgi_params '\$(DESTDIR)$NGX_CONF_PREFIX'
- cp conf/scgi_params \
- '\$(DESTDIR)$NGX_CONF_PREFIX/scgi_params.default'
-
test -f '\$(DESTDIR)$NGX_CONF_PATH' \
|| cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PATH'
cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PREFIX/nginx.conf.default'
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/auto/lib/libatomic/conf
^
|
@@ -14,8 +14,7 @@
ngx_feature="atomic_ops library"
ngx_feature_name=NGX_HAVE_LIBATOMIC
ngx_feature_run=yes
- ngx_feature_incs="#define AO_REQUIRE_CAS
- #include <atomic_ops.h>"
+ ngx_feature_incs="#include <atomic_ops.h>"
ngx_feature_path=
ngx_feature_libs="-latomic_ops"
ngx_feature_test="long n = 0;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/auto/lib/md5/conf
^
|
@@ -94,10 +94,8 @@
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
MD5=YES
MD5_LIB=$ngx_md5_lib
- fi
- fi
+ else
- if [ $MD5 != YES ]; then
cat << END
$0: error: the HTTP cache module requires md5 functions
@@ -107,7 +105,9 @@
--with-http_ssl_module --with-openssl=<path> options.
END
- exit 1
+ exit 1
+ fi
+
fi
fi
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/auto/lib/openssl/conf
^
|
@@ -19,8 +19,6 @@
# libeay32.lib requires gdi32.lib
CORE_LIBS="$CORE_LIBS gdi32.lib"
- # OpenSSL 1.0.0 requires crypt32.lib
- CORE_LIBS="$CORE_LIBS crypt32.lib"
;;
*)
@@ -37,27 +35,38 @@
else
- if [ "$NGX_PLATFORM" != win32 ]; then
+ case "$NGX_PLATFORM" in
- OPENSSL=NO
-
- ngx_feature="OpenSSL library"
- ngx_feature_name="NGX_OPENSSL"
- ngx_feature_run=no
- ngx_feature_incs="#include <openssl/ssl.h>"
- ngx_feature_path=
- ngx_feature_libs="-lssl -lcrypto"
- ngx_feature_test="SSL_library_init()"
- . auto/feature
-
- if [ $ngx_found = yes ]; then
+ win32)
+ have=NGX_OPENSSL . auto/have
have=NGX_SSL . auto/have
- CORE_LIBS="$CORE_LIBS $ngx_feature_libs $NGX_LIBDL"
OPENSSL=YES
- fi
- fi
- if [ $OPENSSL != YES ]; then
+ CORE_INCS="$CORE_INCS c:/openssl/include"
+ CORE_LIBS="$CORE_LIBS c:/openssl/ssleay32.lib"
+ CORE_LIBS="$CORE_LIBS c:/openssl/libeay32.lib"
+
+ # libeay32.lib requires gdi32.lib
+ CORE_LIBS="$CORE_LIBS gdi32.lib"
+ ;;
+
+ *)
+ OPENSSL=NO
+
+ ngx_feature="OpenSSL library"
+ ngx_feature_name="NGX_OPENSSL"
+ ngx_feature_run=no
+ ngx_feature_incs="#include <openssl/ssl.h>"
+ ngx_feature_path=
+ ngx_feature_libs="-lssl -lcrypto"
+ ngx_feature_test="SSL_library_init()"
+ . auto/feature
+
+ if [ $ngx_found = yes ]; then
+ have=NGX_SSL . auto/have
+ CORE_LIBS="$CORE_LIBS $ngx_feature_libs $NGX_LIBDL"
+ OPENSSL=YES
+ else
cat << END
@@ -67,7 +76,10 @@
with nginx by using --with-openssl=<path> option.
END
- exit 1
- fi
+ exit 1
+ fi
+ ;;
+
+ esac
fi
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/auto/lib/openssl/make
^
|
@@ -57,7 +57,7 @@
&& \$(MAKE) clean \\
&& ./config --prefix=$ngx_prefix no-shared $OPENSSL_OPT \\
&& \$(MAKE) \\
- && \$(MAKE) install LIBDIR=lib
+ && \$(MAKE) install
END
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/auto/lib/openssl/makefile.bcc
^
|
@@ -5,7 +5,8 @@
all:
cd $(OPENSSL)
- perl Configure BC-32 no-shared --prefix=openssl $(OPENSSL_OPT)
+ perl Configure BC-32 no-shared --prefix=openssl -DNO_SYS_TYPES_H \
+ $(OPENSSL_OPT)
ms\do_nasm
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/auto/lib/openssl/makefile.msvc
^
|
@@ -5,7 +5,8 @@
all:
cd $(OPENSSL)
- perl Configure VC-WIN32 no-shared --prefix=openssl $(OPENSSL_OPT)
+ perl Configure VC-WIN32 no-shared --prefix=openssl -DNO_SYS_TYPES_H \
+ $(OPENSSL_OPT)
ms\do_ms
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/auto/lib/pcre/conf
^
|
@@ -161,10 +161,8 @@
CORE_INCS="$CORE_INCS $ngx_feature_path"
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
PCRE=YES
- fi
- fi
+ else
- if [ $PCRE != YES ]; then
cat << END
$0: error: the HTTP rewrite module requires the PCRE library.
@@ -173,7 +171,9 @@
statically from the source with nginx by using --with-pcre=<path> option.
END
- exit 1
- fi
+ exit 1
+ fi
+
+ fi
fi
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/auto/lib/zlib/conf
^
|
@@ -57,10 +57,8 @@
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
ZLIB=YES
ngx_found=no
- fi
- fi
+ else
- if [ $ZLIB != YES ]; then
cat << END
$0: error: the HTTP gzip module requires the zlib library.
@@ -69,7 +67,8 @@
statically from the source with nginx by using --with-zlib=<path> option.
END
- exit 1
+ exit 1
+ fi
fi
fi
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/auto/lib/zlib/make
^
|
@@ -53,7 +53,7 @@
$ZLIB/libz.a: $NGX_MAKEFILE
cd $ZLIB \\
- && \$(MAKE) distclean \\
+ && \$(MAKE) clean \\
&& cp contrib/asm586/match.S . \\
&& CFLAGS="$ZLIB_OPT -DASMV" CC="\$(CC)" \\
./configure \\
@@ -70,7 +70,7 @@
$ZLIB/libz.a: $NGX_MAKEFILE
cd $ZLIB \\
- && \$(MAKE) distclean \\
+ && \$(MAKE) clean \\
&& cp contrib/asm686/match.S . \\
&& CFLAGS="$ZLIB_OPT -DASMV" CC="\$(CC)" \\
./configure \\
@@ -103,7 +103,7 @@
$ZLIB/libz.a: $NGX_MAKEFILE
cd $ZLIB \\
- && \$(MAKE) distclean \\
+ && \$(MAKE) clean \\
&& CFLAGS="$ZLIB_OPT" CC="\$(CC)" \\
./configure \\
&& \$(MAKE) libz.a
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/auto/modules
^
|
@@ -102,10 +102,10 @@
# ngx_http_range_header_filter
# ngx_http_gzip_filter
# ngx_http_postpone_filter
-# ngx_http_ssi_filter
# ngx_http_charset_filter
+# ngx_http_ssi_filter
# ngx_http_xslt_filter
-# ngx_http_image_filter
+# ngx_http_image_filter_filter
# ngx_http_sub_filter
# ngx_http_addition_filter
# ngx_http_userid_filter
@@ -131,6 +131,12 @@
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"
@@ -138,11 +144,6 @@
HTTP_SRCS="$HTTP_SRCS $HTTP_SSI_SRCS"
fi
-if [ $HTTP_CHARSET = YES ]; then
- 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"
@@ -185,6 +186,7 @@
fi
if [ $HTTP_AUTOINDEX = YES ]; then
+ have=NGX_HTTP_AUTOINDEX . auto/have
HTTP_MODULES="$HTTP_MODULES $HTTP_AUTOINDEX_MODULE"
HTTP_SRCS="$HTTP_SRCS $HTTP_AUTOINDEX_SRCS"
fi
@@ -192,11 +194,13 @@
HTTP_MODULES="$HTTP_MODULES $HTTP_INDEX_MODULE"
if [ $HTTP_RANDOM_INDEX = YES ]; then
+ have=NGX_HTTP_RANDOM_INDEX . auto/have
HTTP_MODULES="$HTTP_MODULES $HTTP_RANDOM_INDEX_MODULE"
HTTP_SRCS="$HTTP_SRCS $HTTP_RANDOM_INDEX_SRCS"
fi
if [ $HTTP_AUTH_BASIC = YES ]; then
+ have=NGX_HTTP_AUTH_BASIC . auto/have
have=NGX_CRYPT . auto/have
HTTP_MODULES="$HTTP_MODULES $HTTP_AUTH_BASIC_MODULE"
HTTP_SRCS="$HTTP_SRCS $HTTP_AUTH_BASIC_SRCS"
@@ -204,6 +208,7 @@
fi
if [ $HTTP_ACCESS = YES ]; then
+ have=NGX_HTTP_ACCESS . auto/have
HTTP_MODULES="$HTTP_MODULES $HTTP_ACCESS_MODULE"
HTTP_SRCS="$HTTP_SRCS $HTTP_ACCESS_SRCS"
fi
@@ -225,6 +230,7 @@
fi
if [ $HTTP_STATUS = YES ]; then
+ have=NGX_HTTP_STATUS . auto/have
HTTP_MODULES="$HTTP_MODULES $HTTP_STATUS_MODULE"
HTTP_SRCS="$HTTP_SRCS $HTTP_STATUS_SRCS"
fi
@@ -236,26 +242,24 @@
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"
HTTP_SRCS="$HTTP_SRCS $HTTP_MAP_SRCS"
fi
-if [ $HTTP_SPLIT_CLIENTS = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_SPLIT_CLIENTS_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_SPLIT_CLIENTS_SRCS"
-fi
-
if [ $HTTP_REFERER = YES ]; then
HTTP_MODULES="$HTTP_MODULES $HTTP_REFERER_MODULE"
HTTP_SRCS="$HTTP_SRCS $HTTP_REFERER_SRCS"
fi
if [ $HTTP_REWRITE = YES -a $USE_PCRE != DISABLED ]; then
+ have=NGX_HTTP_REWRITE . auto/have
USE_PCRE=YES
HTTP_MODULES="$HTTP_MODULES $HTTP_REWRITE_MODULE"
HTTP_SRCS="$HTTP_SRCS $HTTP_REWRITE_SRCS"
@@ -282,18 +286,9 @@
HTTP_SRCS="$HTTP_SRCS $HTTP_FASTCGI_SRCS"
fi
-if [ $HTTP_UWSGI = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_UWSGI_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_UWSGI_SRCS"
-fi
-
-if [ $HTTP_SCGI = YES ]; then
- HTTP_MODULES="$HTTP_MODULES $HTTP_SCGI_MODULE"
- HTTP_SRCS="$HTTP_SRCS $HTTP_SCGI_SRCS"
-fi
-
if [ $HTTP_PERL = YES ]; then
USE_PERL=YES
+ have=NGX_HTTP_PERL . auto/have
HTTP_MODULES="$HTTP_MODULES $HTTP_PERL_MODULE"
HTTP_INCS="$HTTP_INCS $HTTP_PERL_INCS"
HTTP_DEPS="$HTTP_DEPS $HTTP_PERL_DEPS"
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/auto/options
^
|
@@ -52,8 +52,6 @@
NGX_HTTP_CLIENT_TEMP_PATH=
NGX_HTTP_PROXY_TEMP_PATH=
NGX_HTTP_FASTCGI_TEMP_PATH=
-NGX_HTTP_UWSGI_TEMP_PATH=
-NGX_HTTP_SCGI_TEMP_PATH=
HTTP_CACHE=YES
HTTP_CHARSET=YES
@@ -76,13 +74,10 @@
HTTP_GEO=YES
HTTP_GEOIP=NO
HTTP_MAP=YES
-HTTP_SPLIT_CLIENTS=YES
HTTP_REFERER=YES
HTTP_REWRITE=YES
HTTP_PROXY=YES
HTTP_FASTCGI=YES
-HTTP_UWSGI=YES
-HTTP_SCGI=YES
HTTP_PERL=NO
HTTP_MEMCACHED=YES
HTTP_LIMIT_ZONE=YES
@@ -189,8 +184,6 @@
--http-client-body-temp-path=*) NGX_HTTP_CLIENT_TEMP_PATH="$value" ;;
--http-proxy-temp-path=*) NGX_HTTP_PROXY_TEMP_PATH="$value" ;;
--http-fastcgi-temp-path=*) NGX_HTTP_FASTCGI_TEMP_PATH="$value" ;;
- --http-uwsgi-temp-path=*) NGX_HTTP_UWSGI_TEMP_PATH="$value" ;;
- --http-scgi-temp-path=*) NGX_HTTP_SCGI_TEMP_PATH="$value" ;;
--with-http_ssl_module) HTTP_SSL=YES ;;
--with-http_realip_module) HTTP_REALIP=YES ;;
@@ -216,13 +209,10 @@
--without-http_status_module) HTTP_STATUS=NO ;;
--without-http_geo_module) HTTP_GEO=NO ;;
--without-http_map_module) HTTP_MAP=NO ;;
- --without-http_split_clients_module) HTTP_SPLIT_CLIENTS=NO ;;
--without-http_referer_module) HTTP_REFERER=NO ;;
--without-http_rewrite_module) HTTP_REWRITE=NO ;;
--without-http_proxy_module) HTTP_PROXY=NO ;;
--without-http_fastcgi_module) HTTP_FASTCGI=NO ;;
- --without-http_uwsgi_module) HTTP_UWSGI=NO ;;
- --without-http_scgi_module) HTTP_SCGI=NO ;;
--without-http_memcached_module) HTTP_MEMCACHED=NO ;;
--without-http_limit_zone_module) HTTP_LIMIT_ZONE=NO ;;
--without-http_limit_req_module) HTTP_LIMIT_REQ=NO ;;
@@ -351,13 +341,10 @@
--without-http_autoindex_module disable ngx_http_autoindex_module
--without-http_geo_module disable ngx_http_geo_module
--without-http_map_module disable ngx_http_map_module
- --without-http_split_clients_module disable ngx_http_split_clients_module
--without-http_referer_module disable ngx_http_referer_module
--without-http_rewrite_module disable ngx_http_rewrite_module
--without-http_proxy_module disable ngx_http_proxy_module
--without-http_fastcgi_module disable ngx_http_fastcgi_module
- --without-http_uwsgi_module disable ngx_http_uwsgi_module
- --without-http_scgi_module disable ngx_http_scgi_module
--without-http_memcached_module disable ngx_http_memcached_module
--without-http_limit_zone_module disable ngx_http_limit_zone_module
--without-http_limit_req_module disable ngx_http_limit_req_module
@@ -376,8 +363,6 @@
--http-proxy-temp-path=PATH set path to the http proxy temporary files
--http-fastcgi-temp-path=PATH set path to the http fastcgi temporary
files
- --http-uwsgi-temp-path=PATH set path to the http uwsgi temporary files
- --http-scgi-temp-path=PATH set path to the http scgi temporary files
--without-http disable HTTP server
--without-http-cache disable HTTP cache
@@ -467,8 +452,6 @@
NGX_HTTP_CLIENT_TEMP_PATH=${NGX_HTTP_CLIENT_TEMP_PATH:-client_body_temp}
NGX_HTTP_PROXY_TEMP_PATH=${NGX_HTTP_PROXY_TEMP_PATH:-proxy_temp}
NGX_HTTP_FASTCGI_TEMP_PATH=${NGX_HTTP_FASTCGI_TEMP_PATH:-fastcgi_temp}
-NGX_HTTP_UWSGI_TEMP_PATH=${NGX_HTTP_UWSGI_TEMP_PATH:-uwsgi_temp}
-NGX_HTTP_SCGI_TEMP_PATH=${NGX_HTTP_SCGI_TEMP_PATH:-scgi_temp}
case ".$NGX_PERL_MODULES" in
./*)
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/auto/os/features
^
|
@@ -295,15 +295,6 @@
fi
fi
-ngx_feature="SO_SETFIB"
-ngx_feature_name="NGX_HAVE_SETFIB"
-ngx_feature_run=no
-ngx_feature_incs="#include <sys/socket.h>"
-ngx_feature_path=
-ngx_feature_libs=
-ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_SETFIB, NULL, 4)"
-. auto/feature
-
if [ $NGX_FILE_AIO = YES ]; then
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/auto/sources
^
|
@@ -387,10 +387,6 @@
HTTP_MAP_SRCS=src/http/modules/ngx_http_map_module.c
-HTTP_SPLIT_CLIENTS_MODULE=ngx_http_split_clients_module
-HTTP_SPLIT_CLIENTS_SRCS=src/http/modules/ngx_http_split_clients_module.c
-
-
HTTP_REFERER_MODULE=ngx_http_referer_module
HTTP_REFERER_SRCS=src/http/modules/ngx_http_referer_module.c
@@ -412,14 +408,6 @@
HTTP_FASTCGI_SRCS=src/http/modules/ngx_http_fastcgi_module.c
-HTTP_UWSGI_MODULE=ngx_http_uwsgi_module
-HTTP_UWSGI_SRCS=src/http/modules/ngx_http_uwsgi_module.c
-
-
-HTTP_SCGI_MODULE=ngx_http_scgi_module
-HTTP_SCGI_SRCS=src/http/modules/ngx_http_scgi_module.c
-
-
HTTP_PERL_MODULE=ngx_http_perl_module
HTTP_PERL_INCS=src/http/modules/perl
HTTP_PERL_DEPS=src/http/modules/perl/ngx_http_perl_module.h
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/auto/summary
^
|
@@ -38,6 +38,7 @@
case $PCRE in
YES) echo " + using system PCRE library" ;;
NONE) echo " + PCRE library is not used" ;;
+ NO) echo " + PCRE library is not found" ;;
*) echo " + using PCRE library: $PCRE" ;;
esac
fi
@@ -45,12 +46,14 @@
case $OPENSSL in
YES) echo " + using system OpenSSL library" ;;
NONE) echo " + OpenSSL library is not used" ;;
+ NO) echo " + OpenSSL library is not found" ;;
*) echo " + using OpenSSL library: $OPENSSL" ;;
esac
case $MD5 in
YES) echo " + md5: using $MD5_LIB library" ;;
NONE) echo " + md5 library is not used" ;;
+ NO) echo " + md5 library is not found" ;;
*) echo " + using md5 library: $MD5" ;;
esac
@@ -64,15 +67,10 @@
case $ZLIB in
YES) echo " + using system zlib library" ;;
NONE) echo " + zlib library is not used" ;;
+ NO) echo " + zlib library is not found" ;;
*) echo " + using zlib library: $ZLIB" ;;
esac
-case $NGX_LIBATOMIC in
- YES) echo " + using system libatomic_ops library" ;;
- NO) ;; # not used
- *) echo " + using libatomic_ops library: $NGX_LIBATOMIC" ;;
-esac
-
echo
@@ -93,20 +91,7 @@
cat << END
nginx http access log file: "$NGX_HTTP_LOG_PATH"
nginx http client request body temporary files: "$NGX_HTTP_CLIENT_TEMP_PATH"
-END
+ nginx http proxy temporary files: "$NGX_HTTP_PROXY_TEMP_PATH"
+ nginx http fastcgi temporary files: "$NGX_HTTP_FASTCGI_TEMP_PATH"
-if [ $HTTP_PROXY = YES ]; then
- echo " nginx http proxy temporary files: \"$NGX_HTTP_PROXY_TEMP_PATH\""
-fi
-
-if [ $HTTP_FASTCGI = YES ]; then
- echo " nginx http fastcgi temporary files: \"$NGX_HTTP_FASTCGI_TEMP_PATH\""
-fi
-
-if [ $HTTP_UWSGI = YES ]; then
- echo " nginx http uwsgi temporary files: \"$NGX_HTTP_UWSGI_TEMP_PATH\""
-fi
-
-if [ $HTTP_SCGI = YES ]; then
- echo " nginx http scgi temporary files: \"$NGX_HTTP_SCGI_TEMP_PATH\""
-fi
+END
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/auto/unix
^
|
@@ -133,16 +133,6 @@
. 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
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/conf/mime.types
^
|
@@ -35,7 +35,6 @@
application/vnd.wap.xhtml+xml xhtml;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
- application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/configure
^
|
@@ -90,10 +90,6 @@
. auto/define
have=NGX_HTTP_FASTCGI_TEMP_PATH value="\"$NGX_HTTP_FASTCGI_TEMP_PATH\""
. auto/define
-have=NGX_HTTP_UWSGI_TEMP_PATH value="\"$NGX_HTTP_UWSGI_TEMP_PATH\""
-. auto/define
-have=NGX_HTTP_SCGI_TEMP_PATH value="\"$NGX_HTTP_SCGI_TEMP_PATH\""
-. auto/define
. auto/make
. auto/lib/make
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/nginx.c
^
|
@@ -110,7 +110,7 @@
{ ngx_string("worker_rlimit_core"),
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_off_slot,
+ ngx_conf_set_size_slot,
0,
offsetof(ngx_core_conf_t, rlimit_core),
NULL },
@@ -212,7 +212,7 @@
if (ngx_show_help) {
ngx_log_stderr(0,
- "Usage: nginx [-?hvVtq] [-s signal] [-c filename] "
+ "Usage: nginx [-?hvVt] [-s signal] [-c filename] "
"[-p prefix] [-g directives]" CRLF CRLF
"Options:" CRLF
" -?,-h : this help" CRLF
@@ -220,8 +220,6 @@
" -V : show version and configure options then exit"
CRLF
" -t : test configuration and exit" CRLF
- " -q : suppress non-error messages "
- "during configuration testing" CRLF
" -s signal : send signal to a master process: "
"stop, quit, reopen, reload" CRLF
#ifdef NGX_PREFIX
@@ -289,6 +287,9 @@
init_cycle.log = log;
ngx_cycle = &init_cycle;
+ /* dummy pagesize to create aligned pool */
+ ngx_pagesize = 1024;
+
init_cycle.pool = ngx_create_pool(1024, log);
if (init_cycle.pool == NULL) {
return 1;
@@ -334,11 +335,8 @@
}
if (ngx_test_config) {
- if (!ngx_quiet_mode) {
- ngx_log_stderr(0, "configuration file %s test is successful",
- cycle->conf_file.data);
- }
-
+ ngx_log_stderr(0, "configuration file %s test is successful",
+ cycle->conf_file.data);
return 0;
}
@@ -690,10 +688,6 @@
ngx_test_config = 1;
break;
- case 'q':
- ngx_quiet_mode = 1;
- break;
-
case 'p':
if (*p) {
ngx_prefix = p;
@@ -868,11 +862,14 @@
#else
#ifdef NGX_CONF_PREFIX
- ngx_str_set(&cycle->conf_prefix, NGX_CONF_PREFIX);
+ cycle->conf_prefix.len = sizeof(NGX_CONF_PREFIX) - 1;
+ cycle->conf_prefix.data = (u_char *) NGX_CONF_PREFIX;
#else
- ngx_str_set(&cycle->conf_prefix, NGX_PREFIX);
+ cycle->conf_prefix.len = sizeof(NGX_PREFIX) - 1;
+ cycle->conf_prefix.data = (u_char *) NGX_PREFIX;
#endif
- ngx_str_set(&cycle->prefix, NGX_PREFIX);
+ cycle->prefix.len = sizeof(NGX_PREFIX) - 1;
+ cycle->prefix.data = (u_char *) NGX_PREFIX;
#endif
}
@@ -882,7 +879,8 @@
cycle->conf_file.data = ngx_conf_file;
} else {
- ngx_str_set(&cycle->conf_file, NGX_CONF_PATH);
+ cycle->conf_file.len = sizeof(NGX_CONF_PATH) - 1;
+ cycle->conf_file.data = (u_char *) NGX_CONF_PATH;
}
if (ngx_conf_full_name(cycle, &cycle->conf_file, 0) != NGX_OK) {
@@ -924,7 +922,7 @@
}
/*
- * set by ngx_pcalloc()
+ * set by pcalloc()
*
* ccf->pid = NULL;
* ccf->oldpid = NULL;
@@ -941,7 +939,7 @@
ccf->debug_points = NGX_CONF_UNSET;
ccf->rlimit_nofile = NGX_CONF_UNSET;
- ccf->rlimit_core = NGX_CONF_UNSET;
+ ccf->rlimit_core = NGX_CONF_UNSET_SIZE;
ccf->rlimit_sigpending = NGX_CONF_UNSET;
ccf->user = (ngx_uid_t) NGX_CONF_UNSET_UINT;
@@ -998,7 +996,8 @@
if (ccf->pid.len == 0) {
- ngx_str_set(&ccf->pid, NGX_PID_PATH);
+ ccf->pid.len = sizeof(NGX_PID_PATH) - 1;
+ ccf->pid.data = (u_char *) NGX_PID_PATH;
}
if (ngx_conf_full_name(cycle, &ccf->pid, 0) != NGX_OK) {
@@ -1046,7 +1045,8 @@
if (ccf->lock_file.len == 0) {
- ngx_str_set(&ccf->lock_file, NGX_LOCK_PATH);
+ ccf->lock_file.len = sizeof(NGX_LOCK_PATH) - 1;
+ ccf->lock_file.data = (u_char *) NGX_LOCK_PATH;
}
if (ngx_conf_full_name(cycle, &ccf->lock_file, 0) != NGX_OK) {
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/nginx.h
^
|
@@ -8,8 +8,8 @@
#define _NGINX_H_INCLUDED_
-#define nginx_version 8052
-#define NGINX_VERSION "0.8.52"
+#define nginx_version 8029
+#define NGINX_VERSION "0.8.29"
#define NGINX_VER "nginx/" NGINX_VERSION
#define NGINX_VAR "NGINX"
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_conf_file.c
^
|
@@ -671,8 +671,7 @@
}
} else if (ch == ' ' || ch == '\t' || ch == CR || ch == LF
- || ch == ';' || ch == '{')
- {
+ || ch == ';' || ch == '{') {
last_space = 1;
found = 1;
}
@@ -904,7 +903,8 @@
ngx_open_file_t *file;
#if (NGX_SUPPRESS_WARN)
- ngx_str_null(&full);
+ full.len = 0;
+ full.data = NULL;
#endif
if (name->len) {
@@ -1006,7 +1006,7 @@
void ngx_cdecl
ngx_conf_log_error(ngx_uint_t level, ngx_conf_t *cf, ngx_err_t err,
- const char *fmt, ...)
+ char *fmt, ...)
{
u_char errstr[NGX_MAX_CONF_ERRSTR], *p, *last;
va_list args;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_conf_file.h
^
|
@@ -322,7 +322,7 @@
ngx_uint_t conf_prefix);
ngx_open_file_t *ngx_conf_open_file(ngx_cycle_t *cycle, ngx_str_t *name);
void ngx_cdecl ngx_conf_log_error(ngx_uint_t level, ngx_conf_t *cf,
- ngx_err_t err, const char *fmt, ...);
+ ngx_err_t err, char *fmt, ...);
char *ngx_conf_set_flag_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_connection.c
^
|
@@ -74,10 +74,6 @@
ls->rcvbuf = -1;
ls->sndbuf = -1;
-#if (NGX_HAVE_SETFIB)
- ls->setfib = -1;
-#endif
-
return ls;
}
@@ -100,12 +96,14 @@
ls = cycle->listening.elts;
for (i = 0; i < cycle->listening.nelts; i++) {
- ls[i].sockaddr = ngx_palloc(cycle->pool, NGX_SOCKADDRLEN);
+ /* AF_INET only */
+
+ ls[i].sockaddr = ngx_palloc(cycle->pool, sizeof(struct sockaddr_in));
if (ls[i].sockaddr == NULL) {
return NGX_ERROR;
}
- ls[i].socklen = NGX_SOCKADDRLEN;
+ ls[i].socklen = sizeof(struct sockaddr_in);
if (getsockname(ls[i].fd, ls[i].sockaddr, &ls[i].socklen) == -1) {
ngx_log_error(NGX_LOG_CRIT, cycle->log, ngx_socket_errno,
"getsockname() of the inherited "
@@ -183,25 +181,6 @@
ls[i].sndbuf = -1;
}
-#if 0
- /* SO_SETFIB is currently a set only option */
-
-#if (NGX_HAVE_SETFIB)
-
- if (getsockopt(ls[i].setfib, SOL_SOCKET, SO_SETFIB,
- (void *) &ls[i].setfib, &olen)
- == -1)
- {
- ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
- "getsockopt(SO_SETFIB) %V failed, ignored",
- &ls[i].addr_text);
-
- ls[i].setfib = -1;
- }
-
-#endif
-#endif
-
#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
ngx_memzero(&af, sizeof(struct accept_filter_arg));
@@ -496,19 +475,6 @@
}
}
-#if (NGX_HAVE_SETFIB)
- if (ls[i].setfib != -1) {
- if (setsockopt(ls[i].fd, SOL_SOCKET, SO_SETFIB,
- (const void *) &ls[i].setfib, sizeof(int))
- == -1)
- {
- ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
- "setsockopt(SO_SETFIB, %d) %V failed, ignored",
- ls[i].setfib, &ls[i].addr_text);
- }
- }
-#endif
-
#if 0
if (1) {
int tcp_nodelay = 1;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_connection.h
^
|
@@ -69,9 +69,6 @@
char *accept_filter;
#endif
#endif
-#if (NGX_HAVE_SETFIB)
- int setfib;
-#endif
};
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_cycle.c
^
|
@@ -24,7 +24,6 @@
static ngx_event_t ngx_cleaner_event;
ngx_uint_t ngx_test_config;
-ngx_uint_t ngx_quiet_mode;
#if (NGX_THREADS)
ngx_tls_key_t ngx_core_tls_key;
@@ -64,7 +63,7 @@
tp = ngx_timeofday();
tp->sec = 0;
- ngx_time_update();
+ ngx_time_update(0, 0);
log = old_cycle->log;
@@ -267,7 +266,7 @@
return NULL;
}
- if (ngx_test_config && !ngx_quiet_mode) {
+ if (ngx_test_config) {
ngx_log_stderr(0, "the configuration file %s syntax is ok",
cycle->conf_file.data);
}
@@ -667,24 +666,6 @@
ngx_close_socket_n " listening socket on %V failed",
&ls[i].addr_text);
}
-
-#if (NGX_HAVE_UNIX_DOMAIN)
-
- if (ls[i].sockaddr->sa_family == AF_UNIX) {
- u_char *name;
-
- name = ls[i].addr_text.data + sizeof("unix:") - 1;
-
- ngx_log_error(NGX_LOG_WARN, cycle->log, 0,
- "deleting socket %s", name);
-
- if (ngx_delete_file(name) == -1) {
- ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_socket_errno,
- ngx_delete_file_n " %s failed", name);
- }
- }
-
-#endif
}
@@ -854,9 +835,6 @@
#if (NGX_HAVE_INET6)
struct sockaddr_in6 *sin61, *sin62;
#endif
-#if (NGX_HAVE_UNIX_DOMAIN)
- struct sockaddr_un *saun1, *saun2;
-#endif
if (sa1->sa_family != sa2->sa_family) {
return NGX_DECLINED;
@@ -869,7 +847,7 @@
sin61 = (struct sockaddr_in6 *) sa1;
sin62 = (struct sockaddr_in6 *) sa2;
- if (sin61->sin6_port != sin62->sin6_port) {
+ if (sin61->sin6_port != sin61->sin6_port) {
return NGX_DECLINED;
}
@@ -880,21 +858,6 @@
break;
#endif
-#if (NGX_HAVE_UNIX_DOMAIN)
- case AF_UNIX:
- saun1 = (struct sockaddr_un *) sa1;
- saun2 = (struct sockaddr_un *) sa2;
-
- if (ngx_memcmp(&saun1->sun_path, &saun2->sun_path,
- sizeof(saun1->sun_path))
- != 0)
- {
- return NGX_DECLINED;
- }
-
- break;
-#endif
-
default: /* AF_INET */
sin1 = (struct sockaddr_in *) sa1;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_cycle.h
^
|
@@ -78,7 +78,7 @@
ngx_int_t rlimit_nofile;
ngx_int_t rlimit_sigpending;
- off_t rlimit_core;
+ size_t rlimit_core;
int priority;
@@ -130,7 +130,6 @@
extern ngx_array_t ngx_old_cycles;
extern ngx_module_t ngx_core_module;
extern ngx_uint_t ngx_test_config;
-extern ngx_uint_t ngx_quiet_mode;
#if (NGX_THREADS)
extern ngx_tls_key_t ngx_core_tls_key;
#endif
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_file.c
^
|
@@ -591,10 +591,16 @@
#if (NGX_WIN32)
if (err == NGX_EEXIST) {
- err = ngx_win32_rename_file(src, to, ext->log);
+ if (ngx_win32_rename_file(src, to, ext->log) == NGX_OK) {
- if (err == 0) {
- return NGX_OK;
+ if (ngx_rename_file(src->data, to->data) != NGX_FILE_ERROR) {
+ return NGX_OK;
+ }
+
+ err = ngx_errno;
+
+ } else {
+ err = 0;
}
}
@@ -762,12 +768,10 @@
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;
- }
+ 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;
@@ -825,7 +829,8 @@
ngx_str_t file, buf;
ngx_dir_t dir;
- ngx_str_null(&buf);
+ buf.len = 0;
+ buf.data = NULL;
ngx_log_debug1(NGX_LOG_DEBUG_CORE, ctx->log, 0,
"walk tree \"%V\"", tree);
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_hash.c
^
|
@@ -245,7 +245,7 @@
#define NGX_HASH_ELT_SIZE(name) \
- (sizeof(void *) + ngx_align((name)->key.len + 2, sizeof(void *)))
+ (sizeof(void *) + ngx_align((name)->key.len + 1, sizeof(void *)))
ngx_int_t
ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts)
@@ -257,6 +257,14 @@
ngx_hash_elt_t *elt, **buckets;
for (n = 0; n < nelts; n++) {
+ if (names[n].key.len >= 255) {
+ ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0,
+ "the \"%V\" value to hash is to long: %uz bytes, "
+ "the maximum length can be 255 bytes only",
+ &names[n].key, names[n].key.len);
+ return NGX_ERROR;
+ }
+
if (hinit->bucket_size < NGX_HASH_ELT_SIZE(&names[n]) + sizeof(void *))
{
ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0,
@@ -398,7 +406,7 @@
elt = (ngx_hash_elt_t *) ((u_char *) buckets[key] + test[key]);
elt->value = names[n].value;
- elt->len = (u_short) names[n].key.len;
+ elt->len = (u_char) names[n].key.len;
ngx_strlow(elt->name, names[n].key.data, names[n].key.len);
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_hash.h
^
|
@@ -14,7 +14,7 @@
typedef struct {
void *value;
- u_short len;
+ u_char len;
u_char name[1];
} ngx_hash_elt_t;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_inet.c
^
|
@@ -750,6 +750,7 @@
ngx_free(p);
if (h == NULL || h->h_addr_list[0] == NULL) {
+ ngx_free(p);
u->err = "host not found";
return NGX_ERROR;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_log.c
^
|
@@ -429,7 +429,8 @@
value = cf->args->elts;
if (ngx_strcmp(value[1].data, "stderr") == 0) {
- ngx_str_null(&name);
+ name.len = 0;
+ name.data = NULL;
} else {
name = value[1];
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_log.h
^
|
@@ -68,35 +68,35 @@
/*********************************/
-#if (NGX_HAVE_C99_VARIADIC_MACROS)
+#if (NGX_HAVE_GCC_VARIADIC_MACROS)
#define NGX_HAVE_VARIADIC_MACROS 1
-#define ngx_log_error(level, log, ...) \
- if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
+#define ngx_log_error(level, log, args...) \
+ if ((log)->log_level >= level) ngx_log_error_core(level, log, args)
void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
const char *fmt, ...);
-#define ngx_log_debug(level, log, ...) \
+#define ngx_log_debug(level, log, args...) \
if ((log)->log_level & level) \
- ngx_log_error_core(NGX_LOG_DEBUG, log, __VA_ARGS__)
+ ngx_log_error_core(NGX_LOG_DEBUG, log, args)
/*********************************/
-#elif (NGX_HAVE_GCC_VARIADIC_MACROS)
+#elif (NGX_HAVE_C99_VARIADIC_MACROS)
#define NGX_HAVE_VARIADIC_MACROS 1
-#define ngx_log_error(level, log, args...) \
- if ((log)->log_level >= level) ngx_log_error_core(level, log, args)
+#define ngx_log_error(level, log, ...) \
+ if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
const char *fmt, ...);
-#define ngx_log_debug(level, log, args...) \
+#define ngx_log_debug(level, log, ...) \
if ((log)->log_level & level) \
- ngx_log_error_core(NGX_LOG_DEBUG, log, args)
+ ngx_log_error_core(NGX_LOG_DEBUG, log, __VA_ARGS__)
/*********************************/
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_open_file_cache.c
^
|
@@ -490,14 +490,7 @@
}
if (!of->log) {
-
- /*
- * 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);
+ fd = ngx_open_file(name, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
} else {
fd = ngx_open_file(name, NGX_FILE_APPEND, NGX_FILE_CREATE_OR_OPEN,
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_output_chain.c
^
|
@@ -465,7 +465,10 @@
dst = ctx->buf;
size = ngx_buf_size(src);
- size = ngx_min(size, dst->end - dst->pos);
+
+ if (size > dst->end - dst->pos) {
+ size = dst->end - dst->pos;
+ }
sendfile = ctx->sendfile & !ctx->directio;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_palloc.c
^
|
@@ -17,7 +17,7 @@
{
ngx_pool_t *p;
- p = ngx_memalign(NGX_POOL_ALIGNMENT, size, log);
+ p = ngx_memalign(ngx_min(ngx_pagesize, size), size, log);
if (p == NULL) {
return NULL;
}
@@ -181,7 +181,7 @@
psize = (size_t) (pool->d.end - (u_char *) pool);
- m = ngx_memalign(NGX_POOL_ALIGNMENT, psize, pool->log);
+ m = ngx_memalign(ngx_min(ngx_pagesize, psize), psize, pool->log);
if (m == NULL) {
return NULL;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_palloc.h
^
|
@@ -19,11 +19,8 @@
#define NGX_MAX_ALLOC_FROM_POOL (ngx_pagesize - 1)
#define NGX_DEFAULT_POOL_SIZE (16 * 1024)
-
-#define NGX_POOL_ALIGNMENT 16
#define NGX_MIN_POOL_SIZE \
- ngx_align((sizeof(ngx_pool_t) + 2 * sizeof(ngx_pool_large_t)), \
- NGX_POOL_ALIGNMENT)
+ (sizeof(ngx_pool_t) + 2 * sizeof(ngx_pool_large_t))
typedef void (*ngx_pool_cleanup_pt)(void *data);
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_resolver.c
^
|
@@ -87,9 +87,10 @@
static void ngx_resolver_free(ngx_resolver_t *r, void *p);
static void ngx_resolver_free_locked(ngx_resolver_t *r, void *p);
static void *ngx_resolver_dup(ngx_resolver_t *r, void *src, size_t size);
-static u_char *ngx_resolver_log_error(ngx_log_t *log, u_char *buf, size_t len);
+/* STUB: ngx_peer_addr_t * */
+
ngx_resolver_t *
ngx_resolver_create(ngx_conf_t *cf, ngx_addr_t *addr)
{
@@ -138,7 +139,7 @@
r->valid = 300;
r->log = &cf->cycle->new_log;
- r->log_level = NGX_LOG_ERR;
+ r->log_level = NGX_LOG_ALERT;
if (addr) {
uc = ngx_calloc(sizeof(ngx_udp_connection_t), cf->log);
@@ -151,11 +152,7 @@
uc->sockaddr = addr->sockaddr;
uc->socklen = addr->socklen;
uc->server = addr->name;
-
- uc->log = cf->cycle->new_log;
- uc->log.handler = ngx_resolver_log_error;
- uc->log.data = uc;
- uc->log.action = "resolving";
+ uc->log = &cf->cycle->new_log;
}
return r;
@@ -845,7 +842,7 @@
}
if ((size_t) n != (size_t) rn->qlen) {
- ngx_log_error(NGX_LOG_CRIT, &uc->log, 0, "send() incomplete");
+ ngx_log_error(NGX_LOG_CRIT, uc->log, 0, "send() incomplete");
return NGX_ERROR;
}
@@ -1836,7 +1833,7 @@
p += sizeof(ngx_resolver_query_t);
- for (n = 0; n < 32; n += 8) {
+ for (n = 0; n < 32; n += 8){
d = ngx_sprintf(&p[1], "%ud", (ctx->addr >> n) & 0xff);
*p = (u_char) (d - &p[1]);
p = d;
@@ -2076,29 +2073,6 @@
}
-static u_char *
-ngx_resolver_log_error(ngx_log_t *log, u_char *buf, size_t len)
-{
- u_char *p;
- ngx_udp_connection_t *uc;
-
- p = buf;
-
- if (log->action) {
- p = ngx_snprintf(buf, len, " while %s", log->action);
- len -= p - buf;
- }
-
- uc = log->data;
-
- if (uc) {
- p = ngx_snprintf(p, len, ", resolver: %V", &uc->server);
- }
-
- return p;
-}
-
-
ngx_int_t
ngx_udp_connect(ngx_udp_connection_t *uc)
{
@@ -2110,19 +2084,19 @@
s = ngx_socket(AF_INET, SOCK_DGRAM, 0);
- ngx_log_debug1(NGX_LOG_DEBUG_EVENT, &uc->log, 0, "UDP socket %d", s);
+ ngx_log_debug1(NGX_LOG_DEBUG_EVENT, uc->log, 0, "UDP socket %d", s);
if (s == -1) {
- ngx_log_error(NGX_LOG_ALERT, &uc->log, ngx_socket_errno,
+ ngx_log_error(NGX_LOG_ALERT, uc->log, ngx_socket_errno,
ngx_socket_n " failed");
return NGX_ERROR;
}
- c = ngx_get_connection(s, &uc->log);
+ c = ngx_get_connection(s, uc->log);
if (c == NULL) {
if (ngx_close_socket(s) == -1) {
- ngx_log_error(NGX_LOG_ALERT, &uc->log, ngx_socket_errno,
+ ngx_log_error(NGX_LOG_ALERT, uc->log, ngx_socket_errno,
ngx_close_socket_n "failed");
}
@@ -2130,13 +2104,13 @@
}
if (ngx_nonblocking(s) == -1) {
- ngx_log_error(NGX_LOG_ALERT, &uc->log, ngx_socket_errno,
+ ngx_log_error(NGX_LOG_ALERT, uc->log, ngx_socket_errno,
ngx_nonblocking_n " failed");
ngx_free_connection(c);
if (ngx_close_socket(s) == -1) {
- ngx_log_error(NGX_LOG_ALERT, &uc->log, ngx_socket_errno,
+ ngx_log_error(NGX_LOG_ALERT, uc->log, ngx_socket_errno,
ngx_close_socket_n " failed");
}
@@ -2146,8 +2120,8 @@
rev = c->read;
wev = c->write;
- rev->log = &uc->log;
- wev->log = &uc->log;
+ rev->log = uc->log;
+ wev->log = uc->log;
uc->connection = c;
@@ -2164,7 +2138,7 @@
#endif
- ngx_log_debug3(NGX_LOG_DEBUG_EVENT, &uc->log, 0,
+ ngx_log_debug3(NGX_LOG_DEBUG_EVENT, uc->log, 0,
"connect to %V, fd:%d #%d", &uc->server, s, c->number);
rc = connect(s, uc->sockaddr, uc->socklen);
@@ -2172,8 +2146,8 @@
/* TODO: aio, iocp */
if (rc == -1) {
- ngx_log_error(NGX_LOG_CRIT, &uc->log, ngx_socket_errno,
- "connect() failed");
+ ngx_log_error(NGX_LOG_CRIT, uc->log, ngx_socket_errno,
+ "connect() to %V failed", &uc->server);
return NGX_ERROR;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_resolver.h
^
|
@@ -37,7 +37,7 @@
struct sockaddr *sockaddr;
socklen_t socklen;
ngx_str_t server;
- ngx_log_t log;
+ ngx_log_t *log;
} ngx_udp_connection_t;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_string.c
^
|
@@ -10,8 +10,6 @@
static u_char *ngx_sprintf_num(u_char *buf, u_char *last, uint64_t ui64,
u_char zero, ngx_uint_t hexadecimal, ngx_uint_t width);
-static ngx_int_t ngx_decode_base64_internal(ngx_str_t *dst, ngx_str_t *src,
- const u_char *basis);
void
@@ -77,7 +75,7 @@
* %[0][width][u][x|X]D int32_t/uint32_t
* %[0][width][u][x|X]L int64_t/uint64_t
* %[0][width|m][u][x|X]A ngx_atomic_int_t/ngx_atomic_uint_t
- * %[0][width][.width]f double, max valid number fits to %18.15f
+ * %[0][width][.width]f float
* %P ngx_pid_t
* %M ngx_msec_t
* %r rlim_t
@@ -145,7 +143,7 @@
{
u_char *p, zero;
int d;
- double f, scale;
+ float f, scale;
size_t len, slen;
int64_t i64;
uint64_t ui64;
@@ -231,7 +229,9 @@
case 'V':
v = va_arg(args, ngx_str_t *);
- len = ngx_min(((size_t) (last - buf)), v->len);
+ len = v->len;
+ len = (buf + len < last) ? len : (size_t) (last - buf);
+
buf = ngx_cpymem(buf, v->data, len);
fmt++;
@@ -240,7 +240,9 @@
case 'v':
vv = va_arg(args, ngx_variable_value_t *);
- len = ngx_min(((size_t) (last - buf)), vv->len);
+ len = vv->len;
+ len = (buf + len < last) ? len : (size_t) (last - buf);
+
buf = ngx_cpymem(buf, vv->data, len);
fmt++;
@@ -255,7 +257,8 @@
}
} else {
- len = ngx_min(((size_t) (last - buf)), slen);
+ len = (buf + slen < last) ? slen : (size_t) (last - buf);
+
buf = ngx_cpymem(buf, p, len);
}
@@ -356,7 +359,7 @@
break;
case 'f':
- f = va_arg(args, double);
+ f = (float) va_arg(args, double);
if (f < 0) {
*buf++ = '-';
@@ -383,7 +386,7 @@
* (int64_t) cast is required for msvc6:
* it can not convert uint64_t to double
*/
- ui64 = (uint64_t) ((f - (int64_t) ui64) * scale + 0.5);
+ ui64 = (uint64_t) ((f - (int64_t) ui64) * scale);
buf = ngx_sprintf_num(buf, last, ui64, '0', 0, frac_width);
}
@@ -874,56 +877,6 @@
}
-/* parse a fixed point number, e.g., ngx_atofp("10.5", 4, 2) returns 1050 */
-
-ngx_int_t
-ngx_atofp(u_char *line, size_t n, size_t point)
-{
- ngx_int_t value;
- ngx_uint_t dot;
-
- if (n == 0) {
- return NGX_ERROR;
- }
-
- dot = 0;
-
- for (value = 0; n--; line++) {
-
- if (point == 0) {
- return NGX_ERROR;
- }
-
- if (*line == '.') {
- if (dot) {
- return NGX_ERROR;
- }
-
- dot = 1;
- continue;
- }
-
- if (*line < '0' || *line > '9') {
- return NGX_ERROR;
- }
-
- value = value * 10 + (*line - '0');
- point -= dot;
- }
-
- while (point--) {
- value = value * 10;
- }
-
- if (value < 0) {
- return NGX_ERROR;
-
- } else {
- return value;
- }
-}
-
-
ssize_t
ngx_atosz(u_char *line, size_t n)
{
@@ -1097,6 +1050,8 @@
ngx_int_t
ngx_decode_base64(ngx_str_t *dst, ngx_str_t *src)
{
+ size_t len;
+ u_char *d, *s;
static u_char basis64[] = {
77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
@@ -1117,49 +1072,12 @@
77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77
};
- return ngx_decode_base64_internal(dst, src, basis64);
-}
-
-
-ngx_int_t
-ngx_decode_base64url(ngx_str_t *dst, ngx_str_t *src)
-{
- static u_char basis64[] = {
- 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
- 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
- 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 62, 77, 77,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 77, 77, 77, 77, 77, 77,
- 77, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 77, 77, 77, 77, 63,
- 77, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 77, 77, 77, 77, 77,
-
- 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
- 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
- 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
- 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
- 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
- 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
- 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
- 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77
- };
-
- return ngx_decode_base64_internal(dst, src, basis64);
-}
-
-
-static ngx_int_t
-ngx_decode_base64_internal(ngx_str_t *dst, ngx_str_t *src, const u_char *basis)
-{
- size_t len;
- u_char *d, *s;
-
for (len = 0; len < src->len; len++) {
if (src->data[len] == '=') {
break;
}
- if (basis[src->data[len]] == 77) {
+ if (basis64[src->data[len]] == 77) {
return NGX_ERROR;
}
}
@@ -1172,20 +1090,20 @@
d = dst->data;
while (len > 3) {
- *d++ = (u_char) (basis[s[0]] << 2 | basis[s[1]] >> 4);
- *d++ = (u_char) (basis[s[1]] << 4 | basis[s[2]] >> 2);
- *d++ = (u_char) (basis[s[2]] << 6 | basis[s[3]]);
+ *d++ = (u_char) (basis64[s[0]] << 2 | basis64[s[1]] >> 4);
+ *d++ = (u_char) (basis64[s[1]] << 4 | basis64[s[2]] >> 2);
+ *d++ = (u_char) (basis64[s[2]] << 6 | basis64[s[3]]);
s += 4;
len -= 4;
}
if (len > 1) {
- *d++ = (u_char) (basis[s[0]] << 2 | basis[s[1]] >> 4);
+ *d++ = (u_char) (basis64[s[0]] << 2 | basis64[s[1]] >> 4);
}
if (len > 2) {
- *d++ = (u_char) (basis[s[1]] << 4 | basis[s[2]] >> 2);
+ *d++ = (u_char) (basis64[s[1]] << 4 | basis64[s[2]] >> 2);
}
dst->len = d - dst->data;
@@ -1321,8 +1239,10 @@
break;
}
+ len--;
+
while (src < next) {
- *dst++ = *src++;
+ *++dst = *++src;
len--;
}
}
@@ -1360,13 +1280,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 /.-, +*)( '&%$ #"! */
- 0x88000869, /* 1000 1000 0000 0000 0000 1000 0110 1001 */
+ 0x80000829, /* 1000 0000 0000 0000 0000 1000 0010 1001 */
/* _^]\ [ZYX WVUT SRQP ONML KJIH GFED CBA@ */
0x00000000, /* 0000 0000 0000 0000 0000 0000 0000 0000 */
@@ -1675,89 +1595,6 @@
}
-void
-ngx_str_rbtree_insert_value(ngx_rbtree_node_t *temp,
- ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel)
-{
- ngx_str_node_t *n, *t;
- ngx_rbtree_node_t **p;
-
- for ( ;; ) {
-
- n = (ngx_str_node_t *) node;
- t = (ngx_str_node_t *) temp;
-
- if (node->key != temp->key) {
-
- p = (node->key < temp->key) ? &temp->left : &temp->right;
-
- } else if (n->str.len != t->str.len) {
-
- p = (n->str.len < t->str.len) ? &temp->left : &temp->right;
-
- } else {
- p = (ngx_memcmp(n->str.data, t->str.data, n->str.len) < 0)
- ? &temp->left : &temp->right;
- }
-
- if (*p == sentinel) {
- break;
- }
-
- temp = *p;
- }
-
- *p = node;
- node->parent = temp;
- node->left = sentinel;
- node->right = sentinel;
- ngx_rbt_red(node);
-}
-
-
-ngx_str_node_t *
-ngx_str_rbtree_lookup(ngx_rbtree_t *rbtree, ngx_str_t *val, uint32_t hash)
-{
- ngx_int_t rc;
- ngx_str_node_t *n;
- ngx_rbtree_node_t *node, *sentinel;
-
- node = rbtree->root;
- sentinel = rbtree->sentinel;
-
- while (node != sentinel) {
-
- n = (ngx_str_node_t *) node;
-
- if (hash != node->key) {
- node = (hash < node->key) ? node->left : node->right;
- continue;
- }
-
- if (val->len != n->str.len) {
- node = (val->len < n->str.len) ? node->left : node->right;
- continue;
- }
-
- rc = ngx_memcmp(val->data, n->str.data, val->len);
-
- if (rc < 0) {
- node = node->left;
- continue;
- }
-
- if (rc > 0) {
- node = node->right;
- continue;
- }
-
- return n;
- }
-
- return NULL;
-}
-
-
/* ngx_sort() is implemented as insertion sort because we need stable sort */
void
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_string.h
^
|
@@ -38,9 +38,6 @@
#define ngx_string(str) { sizeof(str) - 1, (u_char *) str }
#define ngx_null_string { 0, NULL }
-#define ngx_str_set(str, text) \
- (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text
-#define ngx_str_null(str) (str)->len = 0; (str)->data = NULL
#define ngx_tolower(c) (u_char) ((c >= 'A' && c <= 'Z') ? (c | 0x20) : c)
@@ -89,7 +86,7 @@
#if (NGX_MEMCPY_LIMIT)
void *ngx_memcpy(void *dst, void *src, size_t n);
-#define ngx_cpymem(dst, src, n) (((u_char *) ngx_memcpy(dst, src, n)) + (n))
+#define ngx_cpymem(dst, src, n) ((u_char *) ngx_memcpy(dst, src, n)) + (n)
#else
@@ -99,7 +96,7 @@
* icc8 compile memcpy(d, s, 4) to the inline "mov"es or XMM moves.
*/
#define ngx_memcpy(dst, src, n) (void) memcpy(dst, src, n)
-#define ngx_cpymem(dst, src, n) (((u_char *) memcpy(dst, src, n)) + (n))
+#define ngx_cpymem(dst, src, n) ((u_char *) memcpy(dst, src, n)) + (n)
#endif
@@ -164,7 +161,6 @@
ngx_int_t ngx_dns_strcmp(u_char *s1, u_char *s2);
ngx_int_t ngx_atoi(u_char *line, size_t n);
-ngx_int_t ngx_atofp(u_char *line, size_t n, size_t point);
ssize_t ngx_atosz(u_char *line, size_t n);
off_t ngx_atoof(u_char *line, size_t n);
time_t ngx_atotm(u_char *line, size_t n);
@@ -178,7 +174,6 @@
void ngx_encode_base64(ngx_str_t *dst, ngx_str_t *src);
ngx_int_t ngx_decode_base64(ngx_str_t *dst, ngx_str_t *src);
-ngx_int_t ngx_decode_base64url(ngx_str_t *dst, ngx_str_t *src);
uint32_t ngx_utf8_decode(u_char **p, size_t n);
size_t ngx_utf8_length(u_char *p, size_t n);
@@ -201,17 +196,6 @@
uintptr_t ngx_escape_html(u_char *dst, u_char *src, size_t size);
-typedef struct {
- ngx_rbtree_node_t node;
- ngx_str_t str;
-} ngx_str_node_t;
-
-
-void ngx_str_rbtree_insert_value(ngx_rbtree_node_t *temp,
- ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel);
-ngx_str_node_t *ngx_str_rbtree_lookup(ngx_rbtree_t *rbtree, ngx_str_t *name,
- uint32_t hash);
-
void ngx_sort(void *base, size_t n, size_t size,
ngx_int_t (*cmp)(const void *, const void *));
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/core/ngx_times.c
^
|
@@ -28,17 +28,6 @@
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")];
@@ -61,17 +50,15 @@
ngx_cached_time = &cached_time[0];
- ngx_time_update();
+ ngx_time_update(0, 0);
}
void
-ngx_time_update(void)
+ngx_time_update(time_t sec, ngx_uint_t msec)
{
u_char *p0, *p1, *p2;
ngx_tm_t tm, gmt;
- time_t sec;
- ngx_uint_t msec;
ngx_time_t *tp;
struct timeval tv;
@@ -79,10 +66,12 @@
return;
}
- ngx_gettimeofday(&tv);
+ if (sec == 0) {
+ 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;
@@ -123,14 +112,12 @@
#elif (NGX_HAVE_GMTOFF)
ngx_localtime(sec, &tm);
- cached_gmtoff = (ngx_int_t) (tm.ngx_tm_gmtoff / 60);
- tp->gmtoff = cached_gmtoff;
+ tp->gmtoff = (ngx_int_t) (tm.ngx_tm_gmtoff / 60);
#else
ngx_localtime(sec, &tm);
- cached_gmtoff = ngx_timezone(tm.ngx_tm_isdst);
- tp->gmtoff = cached_gmtoff;
+ tp->gmtoff = ngx_timezone(tm.ngx_tm_isdst);
#endif
@@ -164,57 +151,6 @@
}
-#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.8.29.tar.gz/src/core/ngx_times.h
^
|
@@ -20,8 +20,7 @@
void ngx_time_init(void);
-void ngx_time_update(void);
-void ngx_time_sigsafe_update(void);
+void ngx_time_update(time_t sec, ngx_uint_t msec);
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.8.29.tar.gz/src/event/modules/ngx_devpoll_module.c
^
|
@@ -371,8 +371,8 @@
err = (events == -1) ? ngx_errno : 0;
- if (flags & NGX_UPDATE_TIME || ngx_event_timer_alarm) {
- ngx_time_update();
+ if (flags & NGX_UPDATE_TIME) {
+ ngx_time_update(0, 0);
}
if (err) {
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/event/modules/ngx_epoll_module.c
^
|
@@ -531,8 +531,8 @@
err = (events == -1) ? ngx_errno : 0;
- if (flags & NGX_UPDATE_TIME || ngx_event_timer_alarm) {
- ngx_time_update();
+ if (flags & NGX_UPDATE_TIME) {
+ ngx_time_update(0, 0);
}
if (err) {
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/event/modules/ngx_eventport_module.c
^
|
@@ -405,7 +405,7 @@
err = ngx_errno;
if (flags & NGX_UPDATE_TIME) {
- ngx_time_update();
+ ngx_time_update(0, 0);
}
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();
+ ngx_time_update(0, 0);
continue;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/event/modules/ngx_kqueue_module.c
^
|
@@ -537,8 +537,8 @@
err = (events == -1) ? ngx_errno : 0;
- if (flags & NGX_UPDATE_TIME || ngx_event_timer_alarm) {
- ngx_time_update();
+ if (flags & NGX_UPDATE_TIME) {
+ ngx_time_update(0, 0);
}
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
@@ -589,7 +589,7 @@
#if (NGX_HAVE_TIMER_EVENT)
if (event_list[i].filter == EVFILT_TIMER) {
- ngx_time_update();
+ ngx_time_update(0, 0);
continue;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/event/modules/ngx_poll_module.c
^
|
@@ -262,8 +262,8 @@
err = (ready == -1) ? ngx_errno : 0;
- if (flags & NGX_UPDATE_TIME || ngx_event_timer_alarm) {
- ngx_time_update();
+ if (flags & NGX_UPDATE_TIME) {
+ ngx_time_update(0, 0);
}
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/event/modules/ngx_rtsig_module.c
^
|
@@ -323,7 +323,7 @@
"rtsig signo:%d", signo);
if (flags & NGX_UPDATE_TIME) {
- ngx_time_update();
+ ngx_time_update(0, 0);
}
if (err == NGX_EAGAIN) {
@@ -349,7 +349,7 @@
signo, si.si_fd, si.si_band);
if (flags & NGX_UPDATE_TIME) {
- ngx_time_update();
+ ngx_time_update(0, 0);
}
rtscf = ngx_event_get_conf(ngx_cycle->conf_ctx, ngx_rtsig_module);
@@ -419,7 +419,7 @@
} else if (signo == SIGALRM) {
- ngx_time_update();
+ ngx_time_update(0, 0);
return NGX_OK;
@@ -671,7 +671,7 @@
}
if (flags & NGX_UPDATE_TIME) {
- ngx_time_update();
+ ngx_time_update(0, 0);
}
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/event/modules/ngx_select_module.c
^
|
@@ -262,8 +262,8 @@
err = (ready == -1) ? ngx_errno : 0;
- if (flags & NGX_UPDATE_TIME || ngx_event_timer_alarm) {
- ngx_time_update();
+ if (flags & NGX_UPDATE_TIME) {
+ ngx_time_update(0, 0);
}
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/event/modules/ngx_win32_select_module.c
^
|
@@ -269,7 +269,7 @@
err = (ready == -1) ? ngx_socket_errno : 0;
if (flags & NGX_UPDATE_TIME) {
- ngx_time_update();
+ ngx_time_update(0, 0);
}
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/event/ngx_event.c
^
|
@@ -562,6 +562,8 @@
{
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
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/event/ngx_event_openssl.c
^
|
@@ -106,8 +106,6 @@
ENGINE_load_builtin_engines();
- OpenSSL_add_all_algorithms();
-
ngx_ssl_connection_index = SSL_get_ex_new_index(0, NULL, NULL, NULL, NULL);
if (ngx_ssl_connection_index == -1) {
@@ -561,9 +559,6 @@
#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);
@@ -1312,16 +1307,11 @@
n = ERR_GET_REASON(ERR_peek_error());
/* handshake failures */
- if (n == SSL_R_BLOCK_CIPHER_PAD_IS_WRONG /* 129 */
- || n == SSL_R_DIGEST_CHECK_FAILED /* 149 */
- || n == SSL_R_LENGTH_MISMATCH /* 159 */
+ if (n == SSL_R_DIGEST_CHECK_FAILED /* 149 */
|| 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 */
@@ -1434,8 +1424,6 @@
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) {
/*
@@ -1467,6 +1455,8 @@
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) {
@@ -2235,17 +2225,21 @@
X509 *cert;
if (SSL_get_verify_result(c->ssl->connection) != X509_V_OK) {
- ngx_str_set(s, "FAILED");
+ s->len = sizeof("FAILED") - 1;
+ s->data = (u_char *) "FAILED";
+
return NGX_OK;
}
cert = SSL_get_peer_certificate(c->ssl->connection);
if (cert) {
- ngx_str_set(s, "SUCCESS");
+ s->len = sizeof("SUCCESS") - 1;
+ s->data = (u_char *) "SUCCESS";
} else {
- ngx_str_set(s, "NONE");
+ s->len = sizeof("NONE") - 1;
+ s->data = (u_char *) "NONE";
}
X509_free(cert);
@@ -2317,6 +2311,5 @@
static void
ngx_openssl_exit(ngx_cycle_t *cycle)
{
- EVP_cleanup();
ENGINE_cleanup();
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/event/ngx_event_openssl.h
^
|
@@ -15,7 +15,6 @@
#include <openssl/err.h>
#include <openssl/conf.h>
#include <openssl/engine.h>
-#include <openssl/evp.h>
#define NGX_SSL_NAME "OpenSSL"
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_access_module.c
^
|
@@ -190,7 +190,7 @@
ml = ngx_inet6_ntop(rule6[i].mask.s6_addr, mt, NGX_INET6_ADDRSTRLEN);
al = ngx_inet6_ntop(rule6[i].addr.s6_addr, at, NGX_INET6_ADDRSTRLEN);
- ngx_log_debug6(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+ ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"access: %*s %*s %*s", cl, ct, ml, mt, al, at);
}
#endif
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_auth_basic_module.c
^
|
@@ -348,7 +348,8 @@
}
r->headers_out.www_authenticate->hash = 1;
- ngx_str_set(&r->headers_out.www_authenticate->key, "WWW-Authenticate");
+ r->headers_out.www_authenticate->key.len = sizeof("WWW-Authenticate") - 1;
+ r->headers_out.www_authenticate->key.data = (u_char *) "WWW-Authenticate";
r->headers_out.www_authenticate->value = *realm;
return NGX_HTTP_UNAUTHORIZED;
@@ -424,7 +425,9 @@
u_char *basic, *p;
if (ngx_strcmp(realm->data, "off") == 0) {
- ngx_str_set(realm, "");
+ realm->len = 0;
+ realm->data = (u_char *) "";
+
return NGX_CONF_OK;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_autoindex_module.c
^
|
@@ -160,6 +160,10 @@
return NGX_DECLINED;
}
+ if (r->zero_in_uri) {
+ return NGX_DECLINED;
+ }
+
if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {
return NGX_DECLINED;
}
@@ -231,7 +235,8 @@
r->headers_out.status = NGX_HTTP_OK;
r->headers_out.content_type_len = sizeof("text/html") - 1;
- ngx_str_set(&r->headers_out.content_type, "text/html");
+ r->headers_out.content_type.len = sizeof("text/html") - 1;
+ r->headers_out.content_type.data = (u_char *) "text/html";
rc = ngx_http_send_header(r);
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_chunked_filter_module.c
^
|
@@ -50,10 +50,9 @@
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))
{
@@ -65,14 +64,7 @@
r->keepalive = 0;
} else {
- clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
-
- if (clcf->chunked_transfer_encoding) {
- r->chunked = 1;
-
- } else {
- r->keepalive = 0;
- }
+ r->chunked = 1;
}
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_dav_module.c
^
|
@@ -146,6 +146,10 @@
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)) {
@@ -321,13 +325,13 @@
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http delete filename: \"%s\"", path.data);
- if (ngx_link_info(path.data, &fi) == NGX_FILE_ERROR) {
+ if (ngx_file_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_link_info_n, path.data);
+ rc, ngx_file_info_n, path.data);
}
if (ngx_is_dir(&fi)) {
@@ -354,7 +358,7 @@
/*
* we do not need to test (r->uri.data[r->uri.len - 1] == '/')
- * because ngx_link_info("/file/") returned NGX_ENOTDIR above
+ * because ngx_file_info("/file/") returned NGX_ENOTDIR above
*/
depth = ngx_http_dav_depth(r, 0);
@@ -535,13 +539,6 @@
return NGX_HTTP_BAD_REQUEST;
}
- p = dest->value.data;
- /* there is always '\0' even after empty header value */
- if (p[0] == '/') {
- last = p + dest->value.len;
- goto destination_done;
- }
-
len = r->headers_in.server.len;
if (len == 0) {
@@ -688,12 +685,12 @@
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http copy to: \"%s\"", copy.path.data);
- if (ngx_link_info(copy.path.data, &fi) == NGX_FILE_ERROR) {
+ if (ngx_file_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_link_info_n,
+ NGX_HTTP_NOT_FOUND, ngx_file_info_n,
copy.path.data);
}
@@ -722,9 +719,9 @@
dir = ngx_is_dir(&fi);
}
- if (ngx_link_info(path.data, &fi) == NGX_FILE_ERROR) {
+ if (ngx_file_info(path.data, &fi) == NGX_FILE_ERROR) {
return ngx_http_dav_error(r->connection->log, ngx_errno,
- NGX_HTTP_NOT_FOUND, ngx_link_info_n,
+ NGX_HTTP_NOT_FOUND, ngx_file_info_n,
path.data);
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_degradation_module.c
^
|
@@ -198,14 +198,9 @@
"invalid sbrk size \"%V\"", &value[1]);
return NGX_CONF_ERROR;
}
-
- return NGX_CONF_OK;
}
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "invalid parameter \"%V\"", &value[1]);
-
- return NGX_CONF_ERROR;
+ return NGX_CONF_OK;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_empty_gif_module.c
^
|
@@ -105,14 +105,12 @@
};
-static ngx_str_t ngx_http_gif_type = ngx_string("image/gif");
-
-
static ngx_int_t
ngx_http_empty_gif_handler(ngx_http_request_t *r)
{
- ngx_int_t rc;
- ngx_http_complex_value_t cv;
+ ngx_int_t rc;
+ ngx_buf_t *b;
+ ngx_chain_t out;
if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {
return NGX_HTTP_NOT_ALLOWED;
@@ -124,13 +122,42 @@
return rc;
}
- ngx_memzero(&cv, sizeof(ngx_http_complex_value_t));
+ r->headers_out.content_type_len = sizeof("image/gif") - 1;
+ r->headers_out.content_type.len = sizeof("image/gif") - 1;
+ r->headers_out.content_type.data = (u_char *) "image/gif";
+
+ if (r->method == NGX_HTTP_HEAD) {
+ r->headers_out.status = NGX_HTTP_OK;
+ r->headers_out.content_length_n = sizeof(ngx_empty_gif);
+ r->headers_out.last_modified_time = 23349600;
+
+ return ngx_http_send_header(r);
+ }
+
+ b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
+ if (b == NULL) {
+ return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ }
+
+ out.buf = b;
+ out.next = NULL;
+
+ b->pos = ngx_empty_gif;
+ b->last = ngx_empty_gif + sizeof(ngx_empty_gif);
+ b->memory = 1;
+ b->last_buf = 1;
- cv.value.len = sizeof(ngx_empty_gif);
- cv.value.data = ngx_empty_gif;
+ r->headers_out.status = NGX_HTTP_OK;
+ r->headers_out.content_length_n = sizeof(ngx_empty_gif);
r->headers_out.last_modified_time = 23349600;
- return ngx_http_send_response(r, NGX_HTTP_OK, &ngx_http_gif_type, &cv);
+ rc = ngx_http_send_header(r);
+
+ if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
+ return rc;
+ }
+
+ return ngx_http_output_filter(r, &out);
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_fastcgi_module.c
^
|
@@ -8,22 +8,6 @@
#include <ngx_core.h>
#include <ngx_http.h>
-#define NGX_FASTCGI_MPX_REQLIMIT __SHRT_MAX__+__SHRT_MAX__
-#define NGX_HTTP_FASTCGI_KEEP_CONN 1
-//#define NGX_FASTCGI_MPX_DEBUG 1
-
-#ifndef NGX_FASTCGI_MPX_DEBUG
-#define NGX_FASTCGI_MPX_DEBUG 0
-#endif
-
-#if ((NGX_DEBUG) || (NGX_FASTCGI_MPX_DEBUG))
-#define DLOG(r, fmt, ...) \
- ngx_log_error(NGX_LOG_DEBUG, (r)->connection->log, 0, \
- "[ngx_http_fastcgi_module:%d] " fmt, __LINE__, ##__VA_ARGS__)
-#else
-#define DLOG(...)
-#endif
-
typedef struct {
ngx_http_upstream_conf_t upstream;
@@ -47,8 +31,6 @@
ngx_regex_t *split_regex;
ngx_str_t split_name;
#endif
-
- ngx_http_request_t *requests[NGX_FASTCGI_MPX_REQLIMIT];
} ngx_http_fastcgi_loc_conf_t;
@@ -86,7 +68,6 @@
ngx_str_t script_name;
ngx_str_t path_info;
- short rid;
} ngx_http_fastcgi_ctx_t;
@@ -513,7 +494,7 @@
{ 0, /* role_hi */
NGX_HTTP_FASTCGI_RESPONDER, /* role_lo */
- NGX_HTTP_FASTCGI_KEEP_CONN, /* flags */
+ 0, /* NGX_HTTP_FASTCGI_KEEP_CONN */ /* flags */
{ 0, 0, 0, 0, 0 } }, /* reserved[5] */
{ 1, /* version */
@@ -571,61 +552,6 @@
};
-static ngx_inline short
-ngx_http_fastcgi_retain_request(ngx_http_request_t *r,
- ngx_http_fastcgi_ctx_t *f, ngx_http_fastcgi_loc_conf_t *c)
-{
- if (f == NULL) {
- f = ngx_http_get_module_ctx(r, ngx_http_fastcgi_module);
- }
- if (f->rid != 0) {
- // should assert this?
- return 0;
- }
- if (c == NULL) {
- c = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module);
- }
-
- int i;
-
- f->rid = 0;
-
- for (i=0; i<NGX_FASTCGI_MPX_REQLIMIT; i++) {
- if (c->requests[i] == NULL) {
- f->rid = (short)i+1;
- DLOG(r, "RETAIN rid %d", f->rid);
- c->requests[i] = r;
- break;
- }
- }
-
- return f->rid;
-}
-
-
-static ngx_inline void
-ngx_http_fastcgi_release_request(ngx_http_request_t *r,
- ngx_http_fastcgi_ctx_t *f, ngx_http_fastcgi_loc_conf_t *c)
-{
- if (f == NULL) {
- f = ngx_http_get_module_ctx(r, ngx_http_fastcgi_module);
- }
- if (f->rid < 1)
- return;
- if (c == NULL) {
- c = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module);
- }
-
- if (f != NULL) {
- DLOG(r, "RELEASE rid %d", f->rid);
- if (c != NULL) {
- c->requests[f->rid-1] = NULL;
- }
- f->rid = 0;
- }
-}
-
-
static ngx_int_t
ngx_http_fastcgi_handler(ngx_http_request_t *r)
{
@@ -650,27 +576,18 @@
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
- flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module);
-
- u = r->upstream;
-
- /* todo: store requests[] map per upstream peer, not in location scope */
-
- if (ngx_http_fastcgi_retain_request(r, f, flcf) == 0) {
- ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
- "ngx_http_fastcgi_module: max number of concurrent "
- "requests hit (%d requests)", NGX_FASTCGI_MPX_REQLIMIT);
- return NGX_HTTP_SERVICE_UNAVAILABLE;
- }
-
ngx_http_set_ctx(r, f, ngx_http_fastcgi_module);
+ flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module);
+
if (flcf->fastcgi_lengths) {
if (ngx_http_fastcgi_eval(r, flcf) != NGX_OK) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
}
+ u = r->upstream;
+
u->schema.len = sizeof("fastcgi://") - 1;
u->schema.data = (u_char *) "fastcgi://";
@@ -696,7 +613,6 @@
u->pipe->input_filter = ngx_http_fastcgi_input_filter;
u->pipe->input_ctx = r;
- // end
rc = ngx_http_read_client_request_body(r, ngx_http_upstream_init);
@@ -801,10 +717,6 @@
ngx_http_fastcgi_header_t *h;
ngx_http_fastcgi_loc_conf_t *flcf;
ngx_http_script_len_code_pt lcode;
- ngx_http_fastcgi_ctx_t *f;
-
- f = ngx_http_get_module_ctx(r, ngx_http_fastcgi_module);
- //DLOG(r, "create rid %d", f->rid);
len = 0;
@@ -892,12 +804,7 @@
ngx_memcpy(b->pos, &ngx_http_fastcgi_request_start,
sizeof(ngx_http_fastcgi_request_start_t));
-
- ((ngx_http_fastcgi_request_start_t *)b->pos)->h0.request_id_hi =
- (u_char) ((f->rid >> 8) & 0xff);
- ((ngx_http_fastcgi_request_start_t *)b->pos)->h0.request_id_lo =
- (u_char) (f->rid & 0xff);
-
+
h = (ngx_http_fastcgi_header_t *)
(b->pos + sizeof(ngx_http_fastcgi_header_t)
+ sizeof(ngx_http_fastcgi_begin_request_t));
@@ -1031,10 +938,8 @@
h->version = 1;
h->type = NGX_HTTP_FASTCGI_PARAMS;
-
- h->request_id_hi = (u_char) ((f->rid >> 8) & 0xff);
- h->request_id_lo = (u_char) (f->rid & 0xff);
-
+ h->request_id_hi = 0;
+ h->request_id_lo = 1;
h->content_length_hi = 0;
h->content_length_lo = 0;
h->padding_length = 0;
@@ -1101,8 +1006,8 @@
h->version = 1;
h->type = NGX_HTTP_FASTCGI_STDIN;
- h->request_id_hi = (u_char) ((f->rid >> 8) & 0xff);
- h->request_id_lo = (u_char) (f->rid & 0xff);
+ h->request_id_hi = 0;
+ h->request_id_lo = 1;
h->content_length_hi = (u_char) ((len >> 8) & 0xff);
h->content_length_lo = (u_char) (len & 0xff);
h->padding_length = (u_char) padding;
@@ -1150,8 +1055,8 @@
h->version = 1;
h->type = NGX_HTTP_FASTCGI_STDIN;
- h->request_id_hi = (u_char) ((f->rid >> 8) & 0xff);
- h->request_id_lo = (u_char) (f->rid & 0xff);
+ h->request_id_hi = 0;
+ h->request_id_lo = 1;
h->content_length_hi = 0;
h->content_length_lo = 0;
h->padding_length = 0;
@@ -1166,21 +1071,18 @@
static ngx_int_t
ngx_http_fastcgi_reinit_request(ngx_http_request_t *r)
{
- ngx_http_fastcgi_ctx_t *f;
-
- f = ngx_http_get_module_ctx(r, ngx_http_fastcgi_module);
+ ngx_http_fastcgi_ctx_t *f;
- if (f == NULL) {
- return NGX_OK;
- }
+ f = ngx_http_get_module_ctx(r, ngx_http_fastcgi_module);
- DLOG(r, "reinit rid %d", f->rid);
+ if (f == NULL) {
+ return NGX_OK;
+ }
- f->state = ngx_http_fastcgi_st_version;
- f->fastcgi_stdout = 0;
- f->rid = 0;
+ f->state = ngx_http_fastcgi_st_version;
+ f->fastcgi_stdout = 0;
- return NGX_OK;
+ return NGX_OK;
}
@@ -1610,8 +1512,6 @@
if (f->type == NGX_HTTP_FASTCGI_STDOUT && f->length == 0) {
f->state = ngx_http_fastcgi_st_version;
p->upstream_done = 1;
- // only done in finalize_request:
- //ngx_http_fastcgi_release_request(r, f, NULL);
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, p->log, 0,
"http fastcgi closed stdout");
@@ -1622,8 +1522,6 @@
if (f->type == NGX_HTTP_FASTCGI_END_REQUEST) {
f->state = ngx_http_fastcgi_st_version;
p->upstream_done = 1;
- // only done in finalize_request:
- //ngx_http_fastcgi_release_request(r, f, NULL);
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, p->log, 0,
"http fastcgi sent end request");
@@ -1808,7 +1706,6 @@
ngx_http_fastcgi_ctx_t *f)
{
u_char ch, *p;
- //u_char rid_hi;
ngx_http_fastcgi_state_e state;
state = f->state;
@@ -1852,12 +1749,22 @@
/* we support the single request per connection */
case ngx_http_fastcgi_st_request_id_hi:
- //rid_hi = ch;
+ if (ch != 0) {
+ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+ "upstream sent unexpected FastCGI "
+ "request id high byte: %d", ch);
+ return NGX_ERROR;
+ }
state = ngx_http_fastcgi_st_request_id_lo;
break;
case ngx_http_fastcgi_st_request_id_lo:
- //DLOG(r, "r rid %d, rec rid %d", f->rid, (rid_hi << 8) + ch);
+ if (ch != 1) {
+ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+ "upstream sent unexpected FastCGI "
+ "request id low byte: %d", ch);
+ return NGX_ERROR;
+ }
state = ngx_http_fastcgi_st_content_length_hi;
break;
@@ -1903,58 +1810,20 @@
static void
ngx_http_fastcgi_abort_request(ngx_http_request_t *r)
{
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "abort http fastcgi request");
- return;
+ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+ "abort http fastcgi request");
+
+ return;
}
static void
-ngx_http_fastcgi_finalize_request(ngx_http_request_t *r, ngx_int_t status)
+ngx_http_fastcgi_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
{
- if (status == NGX_HTTP_CLIENT_CLOSED_REQUEST) {
- DLOG(r, "ABORTED");
- ngx_http_fastcgi_header_t *h;
- ngx_buf_t *b;
- ngx_chain_t *cl;
- size_t size;
-
- size = sizeof(ngx_http_fastcgi_header_t);
-
- b = ngx_create_temp_buf(r->pool, size);
- if (b == NULL) {
- return;
- }
-
- cl = ngx_alloc_chain_link(r->pool);
- if (cl == NULL) {
- return;
- }
-
- cl->buf = b;
- cl->next = NULL;
-
- r->upstream->request_bufs = cl;
- b->last = b->pos + size;
-
- ngx_http_fastcgi_ctx_t *f;
- f = ngx_http_get_module_ctx(r, ngx_http_fastcgi_module);
-
- h = ((ngx_http_fastcgi_header_t *)b->pos);
- h->version = 1;
- h->type = NGX_HTTP_FASTCGI_ABORT_REQUEST;
- h->request_id_hi = (u_char) ((f->rid >> 8) & 0xff);
- h->request_id_lo = (u_char) (f->rid & 0xff);
- h->content_length_hi = 0;
- h->content_length_lo = 0;
- h->padding_length = 0;
- h->reserved = 0;
- }
- ngx_http_fastcgi_release_request(r, NULL, NULL);
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "finalize http fastcgi request");
+ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+ "finalize http fastcgi request");
- return;
+ return;
}
@@ -1986,10 +1855,6 @@
if (conf == NULL) {
return NULL;
}
-
- int i;
- for (i=0; i<NGX_FASTCGI_MPX_REQLIMIT; i++)
- conf->requests[i] = NULL;
/*
* set by ngx_pcalloc():
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_flv_module.c
^
|
@@ -80,6 +80,10 @@
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.8.29.tar.gz/src/http/modules/ngx_http_geo_module.c
^
|
@@ -10,53 +10,41 @@
typedef struct {
- ngx_http_variable_value_t *value;
u_short start;
u_short end;
+ ngx_http_variable_value_t *value;
} ngx_http_geo_range_t;
typedef struct {
- ngx_http_geo_range_t **low;
- ngx_http_variable_value_t *default_value;
-} ngx_http_geo_high_ranges_t;
+ ngx_http_geo_range_t *ranges;
+ ngx_uint_t n;
+} ngx_http_geo_low_ranges_t;
typedef struct {
- ngx_str_node_t sn;
- ngx_http_variable_value_t *value;
- size_t offset;
-} ngx_http_geo_variable_value_node_t;
+ ngx_http_geo_low_ranges_t low[0x10000];
+ ngx_http_variable_value_t *default_value;
+} ngx_http_geo_high_ranges_t;
typedef struct {
ngx_http_variable_value_t *value;
ngx_str_t *net;
- ngx_http_geo_high_ranges_t high;
+ ngx_http_geo_high_ranges_t *high;
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;
-
- size_t data_size;
-
- ngx_str_t include_name;
- ngx_uint_t includes;
- ngx_uint_t entries;
-
- unsigned ranges:1;
- unsigned outside_entries:1;
- unsigned allow_binary_include:1;
- unsigned binary_include:1;
} ngx_http_geo_conf_ctx_t;
typedef struct {
union {
ngx_radix_tree_t *tree;
- ngx_http_geo_high_ranges_t high;
+ ngx_http_geo_high_ranges_t *high;
} u;
ngx_array_t *proxies;
@@ -85,13 +73,6 @@
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 char *ngx_http_geo_include(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx,
- ngx_str_t *name);
-static ngx_int_t ngx_http_geo_include_binary_base(ngx_conf_t *cf,
- ngx_http_geo_conf_ctx_t *ctx, ngx_str_t *name);
-static void ngx_http_geo_create_binary_base(ngx_http_geo_conf_ctx_t *ctx);
-static u_char *ngx_http_geo_copy_values(u_char *base, u_char *p,
- ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel);
static ngx_command_t ngx_http_geo_commands[] = {
@@ -138,20 +119,6 @@
};
-typedef struct {
- u_char GEORNG[6];
- u_char version;
- u_char ptr_size;
- uint32_t endianess;
- uint32_t crc32;
-} ngx_http_geo_header_t;
-
-
-static ngx_http_geo_header_t ngx_http_geo_header = {
- { 'G', 'E', 'O', 'R', 'N', 'G' }, 0, sizeof(void *), 0x12345678, 0
-};
-
-
/* AF_INET only */
static ngx_int_t
@@ -181,24 +148,23 @@
ngx_http_geo_ctx_t *ctx = (ngx_http_geo_ctx_t *) data;
in_addr_t addr;
- ngx_uint_t n;
+ ngx_uint_t i, n;
ngx_http_geo_range_t *range;
- *v = *ctx->u.high.default_value;
+ *v = *ctx->u.high->default_value;
addr = ngx_http_geo_addr(r, ctx);
- range = ctx->u.high.low[addr >> 16];
+ range = ctx->u.high->low[addr >> 16].ranges;
- if (range) {
- n = addr & 0xffff;
- do {
- if (n >= (ngx_uint_t) range->start && n <= (ngx_uint_t) range->end)
- {
- *v = *range->value;
- break;
- }
- } while ((++range)->value);
+ n = addr & 0xffff;
+
+ for (i = 0; i < ctx->u.high->low[addr >> 16].n; i++) {
+ if (n >= (ngx_uint_t) range[i].start
+ && n <= (ngx_uint_t) range[i].end)
+ {
+ *v = *range[i].value;
+ }
}
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
@@ -290,7 +256,6 @@
ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
char *rv;
- void **p;
size_t len;
ngx_str_t *value, name;
ngx_uint_t i;
@@ -337,20 +302,18 @@
return NGX_CONF_ERROR;
}
- ngx_memzero(&ctx, sizeof(ngx_http_geo_conf_ctx_t));
-
ctx.temp_pool = ngx_create_pool(16384, cf->log);
if (ctx.temp_pool == NULL) {
return NGX_CONF_ERROR;
}
- ngx_rbtree_init(&ctx.rbtree, &ctx.sentinel, ngx_str_rbtree_insert_value);
+ ngx_rbtree_init(&ctx.rbtree, &ctx.sentinel,
+ ngx_http_variable_value_rbtree_insert);
+ ctx.high = NULL;
+ ctx.tree = NULL;
+ ctx.proxies = NULL;
ctx.pool = cf->pool;
- ctx.data_size = sizeof(ngx_http_geo_header_t)
- + sizeof(ngx_http_variable_value_t)
- + 0x10000 * sizeof(ngx_http_geo_range_t *);
- ctx.allow_binary_include = 1;
save = *cf;
cf->pool = pool;
@@ -364,35 +327,25 @@
geo->proxies = ctx.proxies;
- if (ctx.high.low) {
+ if (ctx.high) {
- if (!ctx.binary_include) {
- for (i = 0; i < 0x10000; i++) {
- a = (ngx_array_t *) ctx.high.low[i];
+ for (i = 0; i < 0x10000; i++) {
+ a = (ngx_array_t *) ctx.high->low[i].ranges;
- if (a == NULL || a->nelts == 0) {
- continue;
- }
+ if (a == NULL || a->nelts == 0) {
+ continue;
+ }
- len = a->nelts * sizeof(ngx_http_geo_range_t);
+ ctx.high->low[i].n = a->nelts;
- ctx.high.low[i] = ngx_palloc(cf->pool, len + sizeof(void *));
- if (ctx.high.low[i] == NULL) {
- return NGX_CONF_ERROR;
- }
+ len = a->nelts * sizeof(ngx_http_geo_range_t);
- p = (void **) ngx_cpymem(ctx.high.low[i], a->elts, len);
- *p = NULL;
- ctx.data_size += len + sizeof(void *);
+ ctx.high->low[i].ranges = ngx_palloc(cf->pool, len);
+ if (ctx.high->low[i].ranges == NULL ){
+ return NGX_CONF_ERROR;
}
- if (ctx.allow_binary_include
- && !ctx.outside_entries
- && ctx.entries > 100000
- && ctx.includes == 1)
- {
- ngx_http_geo_create_binary_base(&ctx);
- }
+ ngx_memcpy(ctx.high->low[i].ranges, a->elts, len);
}
geo->u.high = ctx.high;
@@ -400,13 +353,13 @@
var->get_handler = ngx_http_geo_range_variable;
var->data = (uintptr_t) geo;
- if (ctx.high.default_value == NULL) {
- ctx.high.default_value = &ngx_http_variable_null_value;
- }
-
ngx_destroy_pool(ctx.temp_pool);
ngx_destroy_pool(pool);
+ if (ctx.high->default_value == NULL) {
+ ctx.high->default_value = &ngx_http_variable_null_value;
+ }
+
} else {
if (ctx.tree == NULL) {
ctx.tree = ngx_radix_tree_create(cf->pool, -1);
@@ -443,7 +396,7 @@
ngx_http_geo(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
{
char *rv;
- ngx_str_t *value;
+ ngx_str_t *value, file;
ngx_cidr_t cidr;
ngx_http_geo_conf_ctx_t *ctx;
@@ -462,7 +415,11 @@
goto failed;
}
- ctx->ranges = 1;
+ ctx->high = ngx_pcalloc(ctx->pool,
+ sizeof(ngx_http_geo_high_ranges_t));
+ if (ctx->high == NULL) {
+ goto failed;
+ }
rv = NGX_CONF_OK;
@@ -478,7 +435,20 @@
if (ngx_strcmp(value[0].data, "include") == 0) {
- rv = ngx_http_geo_include(cf, ctx, &value[1]);
+ file.len = value[1].len++;
+
+ file.data = ngx_pstrdup(ctx->temp_pool, &value[1]);
+ if (file.data == NULL) {
+ goto failed;
+ }
+
+ if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK){
+ goto failed;
+ }
+
+ ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
+
+ rv = ngx_conf_parse(cf, &file);
goto done;
@@ -493,7 +463,7 @@
goto done;
}
- if (ctx->ranges) {
+ if (ctx->high) {
rv = ngx_http_geo_range(cf, ctx, value);
} else {
@@ -518,44 +488,29 @@
ngx_http_geo_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx,
ngx_str_t *value)
{
- u_char *p, *last;
- in_addr_t start, end;
- ngx_str_t *net;
- ngx_uint_t del;
+ u_char *p, *last;
+ in_addr_t start, end;
+ ngx_str_t *net;
+ ngx_uint_t del;
+ ngx_http_variable_value_t *old;
if (ngx_strcmp(value[0].data, "default") == 0) {
- if (ctx->high.default_value) {
- ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
- "duplicate default geo range value: \"%V\", old value: \"%v\"",
- &value[1], ctx->high.default_value);
- }
+ old = ctx->high->default_value;
- ctx->high.default_value = ngx_http_geo_value(cf, ctx, &value[1]);
- if (ctx->high.default_value == NULL) {
+ ctx->high->default_value = ngx_http_geo_value(cf, ctx, &value[1]);
+ if (ctx->high->default_value == NULL) {
return NGX_CONF_ERROR;
}
- return NGX_CONF_OK;
- }
-
- if (ctx->binary_include) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "binary geo range base \"%s\" may not be mixed with usual entries",
- ctx->include_name.data);
- return NGX_CONF_ERROR;
- }
-
- if (ctx->high.low == NULL) {
- ctx->high.low = ngx_pcalloc(ctx->pool,
- 0x10000 * sizeof(ngx_http_geo_range_t *));
- if (ctx->high.low == NULL) {
- return NGX_CONF_ERROR;
+ if (old) {
+ ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
+ "duplicate range \"%V\", value: \"%v\", old value: \"%v\"",
+ &value[0], ctx->high->default_value, old);
}
- }
- ctx->entries++;
- ctx->outside_entries = 1;
+ return NGX_CONF_OK;
+ }
if (ngx_strcmp(value[0].data, "delete") == 0) {
net = &value[1];
@@ -634,7 +589,7 @@
ngx_array_t *a;
ngx_http_geo_range_t *range;
- for (n = start; n <= end; n = (n + 0x10000) & 0xffff0000) {
+ for (n = start; n <= end; n += 0x10000) {
h = n >> 16;
@@ -651,7 +606,7 @@
e = 0xffff;
}
- a = (ngx_array_t *) ctx->high.low[h];
+ a = (ngx_array_t *) ctx->high->low[h].ranges;
if (a == NULL) {
a = ngx_array_create(ctx->temp_pool, 64,
@@ -660,7 +615,7 @@
return NGX_CONF_ERROR;
}
- ctx->high.low[h] = (ngx_http_geo_range_t *) a;
+ ctx->high->low[h].ranges = (ngx_http_geo_range_t *) a;
}
i = a->nelts;
@@ -848,7 +803,7 @@
e = 0xffff;
}
- a = (ngx_array_t *) ctx->high.low[h];
+ a = (ngx_array_t *) ctx->high->low[h].ranges;
if (a == NULL) {
warn = 1;
@@ -974,17 +929,16 @@
ngx_http_geo_value(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx,
ngx_str_t *value)
{
- uint32_t hash;
- ngx_http_variable_value_t *val;
- ngx_http_geo_variable_value_node_t *gvvn;
+ uint32_t hash;
+ ngx_http_variable_value_t *val;
+ ngx_http_variable_value_node_t *vvn;
hash = ngx_crc32_long(value->data, value->len);
- gvvn = (ngx_http_geo_variable_value_node_t *)
- ngx_str_rbtree_lookup(&ctx->rbtree, value, hash);
+ val = ngx_http_variable_value_lookup(&ctx->rbtree, value, hash);
- if (gvvn) {
- return gvvn->value;
+ if (val) {
+ return val;
}
val = ngx_palloc(ctx->pool, sizeof(ngx_http_variable_value_t));
@@ -1002,22 +956,16 @@
val->no_cacheable = 0;
val->not_found = 0;
- gvvn = ngx_palloc(ctx->temp_pool,
- sizeof(ngx_http_geo_variable_value_node_t));
- if (gvvn == NULL) {
+ vvn = ngx_palloc(ctx->temp_pool, sizeof(ngx_http_variable_value_node_t));
+ if (vvn == NULL) {
return NULL;
}
- gvvn->sn.node.key = hash;
- gvvn->sn.str.len = val->len;
- gvvn->sn.str.data = val->data;
- gvvn->value = val;
- gvvn->offset = 0;
+ vvn->node.key = hash;
+ vvn->len = val->len;
+ vvn->value = val;
- ngx_rbtree_insert(&ctx->rbtree, &gvvn->sn.node);
-
- ctx->data_size += ngx_align(sizeof(ngx_http_variable_value_t) + value->len,
- sizeof(void *));
+ ngx_rbtree_insert(&ctx->rbtree, &vvn->node);
return val;
}
@@ -1082,335 +1030,3 @@
return NGX_OK;
}
-
-
-static char *
-ngx_http_geo_include(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx,
- ngx_str_t *name)
-{
- char *rv;
- ngx_str_t file;
-
- file.len = name->len + 4;
- file.data = ngx_pnalloc(ctx->temp_pool, name->len + 5);
- if (file.data == NULL) {
- return NGX_CONF_ERROR;
- }
-
- ngx_sprintf(file.data, "%V.bin%Z", name);
-
- if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) {
- return NGX_CONF_ERROR;
- }
-
- if (ctx->ranges) {
- ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
-
- switch (ngx_http_geo_include_binary_base(cf, ctx, &file)) {
- case NGX_OK:
- return NGX_CONF_OK;
- case NGX_ERROR:
- return NGX_CONF_ERROR;
- default:
- break;
- }
- }
-
- file.len -= 4;
- file.data[file.len] = '\0';
-
- ctx->include_name = file;
-
- if (ctx->outside_entries) {
- ctx->allow_binary_include = 0;
- }
-
- ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
-
- rv = ngx_conf_parse(cf, &file);
-
- ctx->includes++;
- ctx->outside_entries = 0;
-
- return rv;
-}
-
-
-static ngx_int_t
-ngx_http_geo_include_binary_base(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx,
- ngx_str_t *name)
-{
- u_char *base, ch;
- time_t mtime;
- size_t size, len;
- ssize_t n;
- uint32_t crc32;
- ngx_err_t err;
- ngx_int_t rc;
- ngx_uint_t i;
- ngx_file_t file;
- ngx_file_info_t fi;
- ngx_http_geo_range_t *range, **ranges;
- ngx_http_geo_header_t *header;
- ngx_http_variable_value_t *vv;
-
- ngx_memzero(&file, sizeof(ngx_file_t));
- file.name = *name;
- file.log = cf->log;
-
- file.fd = ngx_open_file(name->data, NGX_FILE_RDONLY, 0, 0);
- if (file.fd == NGX_INVALID_FILE) {
- err = ngx_errno;
- if (err != NGX_ENOENT) {
- ngx_conf_log_error(NGX_LOG_CRIT, cf, err,
- ngx_open_file_n " \"%s\" failed", name->data);
- }
- return NGX_DECLINED;
- }
-
- if (ctx->outside_entries) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "binary geo range base \"%s\" may not be mixed with usual entries",
- name->data);
- rc = NGX_ERROR;
- goto done;
- }
-
- if (ctx->binary_include) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "second binary geo range base \"%s\" may not be mixed with \"%s\"",
- name->data, ctx->include_name.data);
- rc = NGX_ERROR;
- goto done;
- }
-
- if (ngx_fd_info(file.fd, &fi) == NGX_FILE_ERROR) {
- ngx_conf_log_error(NGX_LOG_CRIT, cf, ngx_errno,
- ngx_fd_info_n " \"%s\" failed", name->data);
- goto failed;
- }
-
- size = (size_t) ngx_file_size(&fi);
- mtime = ngx_file_mtime(&fi);
-
- ch = name->data[name->len - 4];
- name->data[name->len - 4] = '\0';
-
- if (ngx_file_info(name->data, &fi) == NGX_FILE_ERROR) {
- ngx_conf_log_error(NGX_LOG_CRIT, cf, ngx_errno,
- ngx_file_info_n " \"%s\" failed", name->data);
- goto failed;
- }
-
- name->data[name->len - 4] = ch;
-
- if (mtime < ngx_file_mtime(&fi)) {
- ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
- "stale binary geo range base \"%s\"", name->data);
- goto failed;
- }
-
- base = ngx_palloc(ctx->pool, size);
- if (base == NULL) {
- goto failed;
- }
-
- n = ngx_read_file(&file, base, size, 0);
-
- if (n == NGX_ERROR) {
- ngx_conf_log_error(NGX_LOG_CRIT, cf, ngx_errno,
- ngx_read_file_n " \"%s\" failed", name->data);
- goto failed;
- }
-
- if ((size_t) n != size) {
- ngx_conf_log_error(NGX_LOG_CRIT, cf, 0,
- ngx_read_file_n " \"%s\" returned only %z bytes instead of %z",
- name->data, n, size);
- goto failed;
- }
-
- header = (ngx_http_geo_header_t *) base;
-
- if (size < 16 || ngx_memcmp(&ngx_http_geo_header, header, 12) != 0) {
- ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
- "incompatible binary geo range base \"%s\"", name->data);
- goto failed;
- }
-
- ngx_crc32_init(crc32);
-
- vv = (ngx_http_variable_value_t *) (base + sizeof(ngx_http_geo_header_t));
-
- while(vv->data) {
- len = ngx_align(sizeof(ngx_http_variable_value_t) + vv->len,
- sizeof(void *));
- ngx_crc32_update(&crc32, (u_char *) vv, len);
- vv->data += (size_t) base;
- vv = (ngx_http_variable_value_t *) ((u_char *) vv + len);
- }
- ngx_crc32_update(&crc32, (u_char *) vv, sizeof(ngx_http_variable_value_t));
- vv++;
-
- ranges = (ngx_http_geo_range_t **) vv;
-
- for (i = 0; i < 0x10000; i++) {
- ngx_crc32_update(&crc32, (u_char *) &ranges[i], sizeof(void *));
- if (ranges[i]) {
- ranges[i] = (ngx_http_geo_range_t *)
- ((u_char *) ranges[i] + (size_t) base);
- }
- }
-
- range = (ngx_http_geo_range_t *) &ranges[0x10000];
-
- while ((u_char *) range < base + size) {
- while (range->value) {
- ngx_crc32_update(&crc32, (u_char *) range,
- sizeof(ngx_http_geo_range_t));
- range->value = (ngx_http_variable_value_t *)
- ((u_char *) range->value + (size_t) base);
- range++;
- }
- ngx_crc32_update(&crc32, (u_char *) range, sizeof(void *));
- range = (ngx_http_geo_range_t *) ((u_char *) range + sizeof(void *));
- }
-
- ngx_crc32_final(crc32);
-
- if (crc32 != header->crc32) {
- ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
- "CRC32 mismatch in binary geo range base \"%s\"", name->data);
- goto failed;
- }
-
- ngx_conf_log_error(NGX_LOG_NOTICE, cf, 0,
- "using binary geo range base \"%s\"", name->data);
-
- ctx->include_name = *name;
- ctx->binary_include = 1;
- ctx->high.low = ranges;
- rc = NGX_OK;
-
- goto done;
-
-failed:
-
- rc = NGX_DECLINED;
-
-done:
-
- if (ngx_close_file(file.fd) == NGX_FILE_ERROR) {
- ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
- ngx_close_file_n " \"%s\" failed", name->data);
- }
-
- return rc;
-}
-
-
-static void
-ngx_http_geo_create_binary_base(ngx_http_geo_conf_ctx_t *ctx)
-{
- u_char *p;
- uint32_t hash;
- ngx_str_t s;
- ngx_uint_t i;
- ngx_file_mapping_t fm;
- ngx_http_geo_range_t *r, *range, **ranges;
- ngx_http_geo_header_t *header;
- ngx_http_geo_variable_value_node_t *gvvn;
-
- fm.name = ngx_pnalloc(ctx->temp_pool, ctx->include_name.len + 5);
- if (fm.name == NULL) {
- return;
- }
-
- ngx_sprintf(fm.name, "%V.bin%Z", &ctx->include_name);
-
- fm.size = ctx->data_size;
- fm.log = ctx->pool->log;
-
- ngx_log_error(NGX_LOG_NOTICE, fm.log, 0,
- "creating binary geo range base \"%s\"", fm.name);
-
- if (ngx_create_file_mapping(&fm) != NGX_OK) {
- return;
- }
-
- p = ngx_cpymem(fm.addr, &ngx_http_geo_header,
- sizeof(ngx_http_geo_header_t));
-
- p = ngx_http_geo_copy_values(fm.addr, p, ctx->rbtree.root,
- ctx->rbtree.sentinel);
-
- p += sizeof(ngx_http_variable_value_t);
-
- ranges = (ngx_http_geo_range_t **) p;
-
- p += 0x10000 * sizeof(ngx_http_geo_range_t *);
-
- for (i = 0; i < 0x10000; i++) {
- r = ctx->high.low[i];
- if (r == NULL) {
- continue;
- }
-
- range = (ngx_http_geo_range_t *) p;
- ranges[i] = (ngx_http_geo_range_t *) (p - (u_char *) fm.addr);
-
- do {
- s.len = r->value->len;
- s.data = r->value->data;
- hash = ngx_crc32_long(s.data, s.len);
- gvvn = (ngx_http_geo_variable_value_node_t *)
- ngx_str_rbtree_lookup(&ctx->rbtree, &s, hash);
-
- range->value = (ngx_http_variable_value_t *) gvvn->offset;
- range->start = r->start;
- range->end = r->end;
- range++;
-
- } while ((++r)->value);
-
- range->value = NULL;
-
- p = (u_char *) range + sizeof(void *);
- }
-
- header = fm.addr;
- header->crc32 = ngx_crc32_long((u_char *) fm.addr
- + sizeof(ngx_http_geo_header_t),
- fm.size - sizeof(ngx_http_geo_header_t));
-
- ngx_close_file_mapping(&fm);
-}
-
-
-static u_char *
-ngx_http_geo_copy_values(u_char *base, u_char *p, ngx_rbtree_node_t *node,
- ngx_rbtree_node_t *sentinel)
-{
- ngx_http_variable_value_t *vv;
- ngx_http_geo_variable_value_node_t *gvvn;
-
- if (node == sentinel) {
- return p;
- }
-
- gvvn = (ngx_http_geo_variable_value_node_t *) node;
- gvvn->offset = p - base;
-
- vv = (ngx_http_variable_value_t *) p;
- *vv = *gvvn->value;
- p += sizeof(ngx_http_variable_value_t);
- vv->data = (u_char *) (p - base);
-
- p = ngx_cpymem(p, gvvn->sn.str.data, gvvn->sn.str.len);
-
- p = ngx_align_ptr(p, sizeof(void *));
-
- p = ngx_http_geo_copy_values(base, p, node->left, sentinel);
-
- return ngx_http_geo_copy_values(base, p, node->right, sentinel);
-}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_geoip_module.c
^
|
@@ -30,13 +30,6 @@
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_region_name_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 ngx_int_t ngx_http_geoip_city_int_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);
@@ -100,42 +93,29 @@
static ngx_http_variable_t ngx_http_geoip_vars[] = {
- { ngx_string("geoip_country_code"), NULL,
- ngx_http_geoip_country_variable,
+ { 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,
+ { 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,
+ { 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,
+ { 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,
+ { 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_region_name"), NULL,
- ngx_http_geoip_region_name_variable,
- 0, 0, 0 },
-
{ ngx_string("geoip_city"), NULL,
ngx_http_geoip_city_variable,
offsetof(GeoIPRecord, city), 0, 0 },
@@ -144,22 +124,6 @@
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_string("geoip_dma_code"), NULL,
- ngx_http_geoip_city_int_variable,
- offsetof(GeoIPRecord, dma_code), 0, 0 },
-
- { ngx_string("geoip_area_code"), NULL,
- ngx_http_geoip_city_int_variable,
- offsetof(GeoIPRecord, area_code), 0, 0 },
-
{ ngx_null_string, NULL, NULL, 0, 0, 0 }
};
@@ -215,74 +179,43 @@
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;
+ u_long addr;
+ char *val;
+ size_t len;
+ GeoIPRecord *gr;
+ struct sockaddr_in *sin;
+ ngx_http_geoip_conf_t *gcf;
- gr = ngx_http_geoip_get_city_record(r);
- if (gr == NULL) {
- goto not_found;
- }
+ gcf = ngx_http_get_module_main_conf(r, ngx_http_geoip_module);
- val = *(char **) ((char *) gr + data);
- if (val == NULL) {
- goto no_value;
+ if (gcf->city == NULL) {
+ goto not_found;
}
- len = ngx_strlen(val);
- v->data = ngx_pnalloc(r->pool, len);
- if (v->data == NULL) {
- GeoIPRecord_delete(gr);
- return NGX_ERROR;
+ if (r->connection->sockaddr->sa_family != AF_INET) {
+ goto not_found;
}
- 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;
-}
-
+ sin = (struct sockaddr_in *) r->connection->sockaddr;
+ addr = ntohl(sin->sin_addr.s_addr);
-static ngx_int_t
-ngx_http_geoip_region_name_variable(ngx_http_request_t *r,
- ngx_http_variable_value_t *v, uintptr_t data)
-{
- size_t len;
- const char *val;
- GeoIPRecord *gr;
+ gr = GeoIP_record_by_ipnum(gcf->city, addr);
- gr = ngx_http_geoip_get_city_record(r);
if (gr == NULL) {
goto not_found;
}
- val = GeoIP_region_name_by_code(gr->country_code, gr->region);
-
- GeoIPRecord_delete(gr);
+ val = *(char **) ((char *) gr + data);
if (val == NULL) {
- goto not_found;
+ goto no_value;
}
len = ngx_strlen(val);
v->data = ngx_pnalloc(r->pool, len);
+
if (v->data == NULL) {
+ GeoIPRecord_delete(gr);
return NGX_ERROR;
}
@@ -293,92 +226,19 @@
v->no_cacheable = 0;
v->not_found = 0;
- return NGX_OK;
-
-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 ngx_int_t
-ngx_http_geoip_city_int_variable(ngx_http_request_t *r,
- ngx_http_variable_value_t *v, uintptr_t data)
-{
- int 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);
- if (v->data == NULL) {
- GeoIPRecord_delete(gr);
- return NGX_ERROR;
- }
-
- val = *(int *) ((char *) gr + data);
-
- v->len = ngx_sprintf(v->data, "%d", val) - v->data;
+no_value:
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);
+not_found:
- return GeoIP_record_by_ipnum(gcf->city, addr);
- }
+ v->not_found = 1;
- return NULL;
+ return NGX_OK;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_gzip_filter_module.c
^
|
@@ -243,6 +243,7 @@
conf = ngx_http_get_module_loc_conf(r, ngx_http_gzip_filter_module);
if (!conf->enable
+ || r->header_only
|| (r->headers_out.status != NGX_HTTP_OK
&& r->headers_out.status != NGX_HTTP_FORBIDDEN
&& r->headers_out.status != NGX_HTTP_NOT_FOUND)
@@ -250,8 +251,7 @@
&& 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
- || r->header_only)
+ || ngx_http_test_content_type(r, &conf->types) == NULL)
{
return ngx_http_next_header_filter(r);
}
@@ -285,8 +285,11 @@
}
h->hash = 1;
- ngx_str_set(&h->key, "Content-Encoding");
- ngx_str_set(&h->value, "gzip");
+ h->key.len = sizeof("Content-Encoding") - 1;
+ h->key.data = (u_char *) "Content-Encoding";
+ h->value.len = sizeof("gzip") - 1;
+ h->value.data = (u_char *) "gzip";
+
r->headers_out.content_encoding = h;
r->main_filter_need_in_memory = 1;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_gzip_static_module.c
^
|
@@ -89,6 +89,10 @@
return NGX_DECLINED;
}
+ if (r->zero_in_uri) {
+ return NGX_DECLINED;
+ }
+
gzcf = ngx_http_get_module_loc_conf(r, ngx_http_gzip_static_module);
if (!gzcf->enable) {
@@ -176,7 +180,7 @@
#if !(NGX_WIN32) /* the not regular files are probably Unix specific */
if (!of.is_file) {
- ngx_log_error(NGX_LOG_CRIT, log, 0,
+ ngx_log_error(NGX_LOG_CRIT, log, ngx_errno,
"\"%s\" is not a regular file", path.data);
return NGX_HTTP_NOT_FOUND;
@@ -208,10 +212,12 @@
}
h->hash = 1;
- ngx_str_set(&h->key, "Content-Encoding");
- ngx_str_set(&h->value, "gzip");
- r->headers_out.content_encoding = h;
+ h->key.len = sizeof("Content-Encoding") - 1;
+ h->key.data = (u_char *) "Content-Encoding";
+ h->value.len = sizeof("gzip") - 1;
+ h->value.data = (u_char *) "gzip";
+ r->headers_out.content_encoding = h;
r->ignore_content_encoding = 1;
/* we need to allocate all before the header would be sent */
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_image_filter_module.c
^
|
@@ -38,13 +38,12 @@
ngx_uint_t filter;
ngx_uint_t width;
ngx_uint_t height;
- ngx_uint_t jpeg_quality;
+ ngx_int_t jpeg_quality;
ngx_flag_t transparency;
ngx_http_complex_value_t *wcv;
ngx_http_complex_value_t *hcv;
- ngx_http_complex_value_t *jqcv;
size_t buffer_size;
} ngx_http_image_filter_conf_t;
@@ -64,7 +63,6 @@
ngx_uint_t phase;
ngx_uint_t type;
- ngx_uint_t force;
} ngx_http_image_filter_ctx_t;
@@ -100,8 +98,6 @@
void *child);
static char *ngx_http_image_filter(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
-static char *ngx_http_image_filter_jpeg_quality(ngx_conf_t *cf,
- ngx_command_t *cmd, void *conf);
static ngx_int_t ngx_http_image_filter_init(ngx_conf_t *cf);
@@ -116,9 +112,9 @@
{ ngx_string("image_filter_jpeg_quality"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_http_image_filter_jpeg_quality,
+ ngx_conf_set_num_slot,
NGX_HTTP_LOC_CONF_OFFSET,
- 0,
+ offsetof(ngx_http_image_filter_conf_t, jpeg_quality),
NULL },
{ ngx_string("image_filter_transparency"),
@@ -231,7 +227,7 @@
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"image filter: too big response: %O", len);
- return NGX_HTTP_UNSUPPORTED_MEDIA_TYPE;
+ return NGX_ERROR;
}
if (len == -1) {
@@ -505,8 +501,7 @@
if (rc == NGX_OK
&& ctx->width <= ctx->max_width
- && ctx->height <= ctx->max_height
- && !ctx->force)
+ && ctx->height <= ctx->max_height)
{
return ngx_http_image_asis(r, ctx);
}
@@ -532,7 +527,8 @@
ngx_http_clean_header(r);
r->headers_out.status = NGX_HTTP_OK;
- ngx_str_set(&r->headers_out.content_type, "text/plain");
+ r->headers_out.content_type.len = sizeof("text/plain") - 1;
+ r->headers_out.content_type.data = (u_char *) "text/plain";
r->headers_out.content_type_lowcase = NULL;
if (ctx == NULL) {
@@ -605,7 +601,6 @@
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;
@@ -616,38 +611,26 @@
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[0], p[1]);
+ "JPEG: %02xd %02xd", *p, *(p + 1));
p++;
- if ((*p == 0xc0 || *p == 0xc1 || *p == 0xc2 || *p == 0xc3
- || *p == 0xc9 || *p == 0xca || *p == 0xcb)
- && (width == 0 || height == 0))
+ if (*p == 0xc0 || *p == 0xc1 || *p == 0xc2 || *p == 0xc3
+ || *p == 0xc9 || *p == 0xca || *p == 0xcb)
{
- width = p[6] * 256 + p[7];
- height = p[4] * 256 + p[5];
+ goto found;
}
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"JPEG: %02xd %02xd", p[1], 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;
+ p += p[1] * 256 + p[2];
continue;
}
@@ -655,16 +638,12 @@
p++;
}
- if (width == 0 || height == 0) {
- return NGX_DECLINED;
- }
+ return NGX_DECLINED;
- 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);
- }
+ found:
+
+ width = p[6] * 256 + p[7];
+ height = p[4] * 256 + p[5];
break;
@@ -729,8 +708,7 @@
conf = ngx_http_get_module_loc_conf(r, ngx_http_image_filter_module);
- if (!ctx->force
- && (ngx_uint_t) sx <= ctx->max_width
+ if ((ngx_uint_t) sx <= ctx->max_width
&& (ngx_uint_t) sy <= ctx->max_height)
{
gdImageDestroy(src);
@@ -992,7 +970,6 @@
{
char *failed;
u_char *out;
- ngx_int_t jq;
ngx_http_image_filter_conf_t *conf;
out = NULL;
@@ -1001,13 +978,7 @@
case NGX_HTTP_IMAGE_JPEG:
conf = ngx_http_get_module_loc_conf(r, ngx_http_image_filter_module);
-
- jq = ngx_http_image_filter_get_value(r, conf->jqcv, conf->jpeg_quality);
- if (jq <= 0) {
- return NULL;
- }
-
- out = gdImageJpegPtr(img, size, jq);
+ out = gdImageJpegPtr(img, size, conf->jpeg_quality);
failed = "gdImageJpegPtr() failed";
break;
@@ -1089,7 +1060,7 @@
}
conf->filter = NGX_CONF_UNSET_UINT;
- conf->jpeg_quality = NGX_CONF_UNSET_UINT;
+ conf->jpeg_quality = NGX_CONF_UNSET;
conf->transparency = NGX_CONF_UNSET;
conf->buffer_size = NGX_CONF_UNSET_SIZE;
@@ -1118,11 +1089,7 @@
}
/* 75 is libjpeg default quality */
- ngx_conf_merge_uint_value(conf->jpeg_quality, prev->jpeg_quality, 75);
-
- if (conf->jqcv == NULL) {
- conf->jqcv = prev->jqcv;
- }
+ ngx_conf_merge_value(conf->jpeg_quality, prev->jpeg_quality, 75);
ngx_conf_merge_value(conf->transparency, prev->transparency, 1);
@@ -1242,53 +1209,6 @@
}
-static char *
-ngx_http_image_filter_jpeg_quality(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf)
-{
- ngx_http_image_filter_conf_t *imcf = conf;
-
- ngx_str_t *value;
- ngx_int_t n;
- ngx_http_complex_value_t cv;
- ngx_http_compile_complex_value_t ccv;
-
- value = cf->args->elts;
-
- ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
-
- ccv.cf = cf;
- ccv.value = &value[1];
- ccv.complex_value = &cv;
-
- if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
- return NGX_CONF_ERROR;
- }
-
- if (cv.lengths == NULL) {
- n = ngx_http_image_filter_value(&value[1]);
-
- if (n <= 0) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "invalid parameter \"%V\"", &value[1]);
- return NGX_CONF_ERROR;
- }
-
- imcf->jpeg_quality = (ngx_uint_t) n;
-
- } else {
- imcf->jqcv = ngx_palloc(cf->pool, sizeof(ngx_http_complex_value_t));
- if (imcf->jqcv == NULL) {
- return NGX_CONF_ERROR;
- }
-
- *imcf->jqcv = cv;
- }
-
- return NGX_CONF_OK;
-}
-
-
static ngx_int_t
ngx_http_image_filter_init(ngx_conf_t *cf)
{
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_index_module.c
^
|
@@ -116,6 +116,10 @@
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);
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_limit_req_module.c
^
|
@@ -229,8 +229,7 @@
r->read_event_handler = ngx_http_test_reading;
r->write_event_handler = ngx_http_limit_req_delay;
- ngx_add_timer(r->connection->write,
- (ngx_msec_t) excess * 1000 / ctx->rate);
+ ngx_add_timer(r->connection->write, (ngx_msec_t) excess);
return NGX_AGAIN;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_log_module.c
^
|
@@ -533,7 +533,7 @@
ms = (ngx_msec_int_t)
((tp->sec - r->start_sec) * 1000 + (tp->msec - r->start_msec));
- ms = ngx_max(ms, 0);
+ ms = (ms >= 0) ? ms : 0;
return ngx_sprintf(buf, "%T.%03M", ms / 1000, ms % 1000);
}
@@ -747,7 +747,8 @@
return NULL;
}
- ngx_str_set(&fmt->name, "combined");
+ fmt->name.len = sizeof("combined") - 1;
+ fmt->name.data = (u_char *) "combined";
fmt->flushes = NULL;
@@ -921,7 +922,8 @@
}
} else {
- ngx_str_set(&name, "combined");
+ name.len = sizeof("combined") - 1;
+ name.data = (u_char *) "combined";
lmcf->combined_used = 1;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_map_module.c
^
|
@@ -374,7 +374,7 @@
if (ngx_strcmp(value[0].data, "include") == 0) {
file = value[1];
- if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) {
+ if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK){
return NGX_CONF_ERROR;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_memcached_module.c
^
|
@@ -38,6 +38,11 @@
static char *ngx_http_memcached_pass(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
+static char *ngx_http_memcached_upstream_max_fails_unsupported(ngx_conf_t *cf,
+ ngx_command_t *cmd, void *conf);
+static char *ngx_http_memcached_upstream_fail_timeout_unsupported(ngx_conf_t *cf,
+ ngx_command_t *cmd, void *conf);
+
static ngx_conf_bitmask_t ngx_http_memcached_next_upstream_masks[] = {
{ ngx_string("error"), NGX_HTTP_UPSTREAM_FT_ERROR },
@@ -60,7 +65,7 @@
{ ngx_string("memcached_bind"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_http_upstream_bind_set_slot,
+ ngx_http_upsteam_bind_set_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_memcached_loc_conf_t, upstream.local),
NULL },
@@ -100,6 +105,20 @@
offsetof(ngx_http_memcached_loc_conf_t, upstream.next_upstream),
&ngx_http_memcached_next_upstream_masks },
+ { ngx_string("memcached_upstream_max_fails"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+ ngx_http_memcached_upstream_max_fails_unsupported,
+ 0,
+ 0,
+ NULL },
+
+ { ngx_string("memcached_upstream_fail_timeout"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+ ngx_http_memcached_upstream_fail_timeout_unsupported,
+ 0,
+ 0,
+ NULL },
+
ngx_null_command
};
@@ -170,7 +189,9 @@
u = r->upstream;
- ngx_str_set(&u->schema, "memcached://");
+ u->schema.len = sizeof("memcached://") - 1;
+ u->schema.data = (u_char *) "memcached://";
+
u->output.tag = (ngx_buf_tag_t) &ngx_http_memcached_module;
mlcf = ngx_http_get_module_loc_conf(r, ngx_http_memcached_module);
@@ -411,20 +432,15 @@
if (ngx_strncmp(b->last,
ngx_http_memcached_end + NGX_HTTP_MEMCACHED_END - ctx->rest,
- bytes)
+ ctx->rest)
!= 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 -= bytes;
- ctx->rest -= bytes;
+ u->length = 0;
+ ctx->rest = 0;
return NGX_OK;
}
@@ -621,3 +637,29 @@
return NGX_CONF_OK;
}
+
+
+static char *
+ngx_http_memcached_upstream_max_fails_unsupported(ngx_conf_t *cf,
+ ngx_command_t *cmd, void *conf)
+{
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "\"memcached_upstream_max_fails\" is not supported, "
+ "use the \"max_fails\" parameter of the \"server\" directive ",
+ "inside the \"upstream\" block");
+
+ return NGX_CONF_ERROR;
+}
+
+
+static char *
+ngx_http_memcached_upstream_fail_timeout_unsupported(ngx_conf_t *cf,
+ ngx_command_t *cmd, void *conf)
+{
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "\"memcached_upstream_fail_timeout\" is not supported, "
+ "use the \"fail_timeout\" parameter of the \"server\" directive ",
+ "inside the \"upstream\" block");
+
+ return NGX_CONF_ERROR;
+}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_proxy_module.c
^
|
@@ -51,6 +51,7 @@
ngx_hash_t headers_set_hash;
ngx_array_t *headers_source;
+ ngx_array_t *headers_names;
ngx_array_t *proxy_lengths;
ngx_array_t *proxy_values;
@@ -77,12 +78,20 @@
typedef struct {
- ngx_http_status_t status;
+ ngx_uint_t status;
+ ngx_uint_t status_count;
+ u_char *status_start;
+ u_char *status_end;
+
ngx_http_proxy_vars_t vars;
+
size_t internal_body_length;
} ngx_http_proxy_ctx_t;
+#define NGX_HTTP_PROXY_PARSE_NO_HEADER 20
+
+
static ngx_int_t ngx_http_proxy_eval(ngx_http_request_t *r,
ngx_http_proxy_ctx_t *ctx, ngx_http_proxy_loc_conf_t *plcf);
#if (NGX_HTTP_CACHE)
@@ -91,6 +100,8 @@
static ngx_int_t ngx_http_proxy_create_request(ngx_http_request_t *r);
static ngx_int_t ngx_http_proxy_reinit_request(ngx_http_request_t *r);
static ngx_int_t ngx_http_proxy_process_status_line(ngx_http_request_t *r);
+static ngx_int_t ngx_http_proxy_parse_status_line(ngx_http_request_t *r,
+ ngx_http_proxy_ctx_t *ctx);
static ngx_int_t ngx_http_proxy_process_header(ngx_http_request_t *r);
static void ngx_http_proxy_abort_request(ngx_http_request_t *r);
static void ngx_http_proxy_finalize_request(ngx_http_request_t *r,
@@ -131,6 +142,11 @@
static char *ngx_http_proxy_lowat_check(ngx_conf_t *cf, void *post, void *data);
+static char *ngx_http_proxy_upstream_max_fails_unsupported(ngx_conf_t *cf,
+ ngx_command_t *cmd, void *conf);
+static char *ngx_http_proxy_upstream_fail_timeout_unsupported(ngx_conf_t *cf,
+ ngx_command_t *cmd, void *conf);
+
#if (NGX_HTTP_SSL)
static ngx_int_t ngx_http_proxy_set_ssl(ngx_conf_t *cf,
ngx_http_proxy_loc_conf_t *plcf);
@@ -157,6 +173,15 @@
};
+static ngx_conf_bitmask_t ngx_http_proxy_ignore_headers_masks[] = {
+ { ngx_string("X-Accel-Redirect"), NGX_HTTP_UPSTREAM_IGN_XA_REDIRECT },
+ { ngx_string("X-Accel-Expires"), NGX_HTTP_UPSTREAM_IGN_XA_EXPIRES },
+ { ngx_string("Expires"), NGX_HTTP_UPSTREAM_IGN_EXPIRES },
+ { ngx_string("Cache-Control"), NGX_HTTP_UPSTREAM_IGN_CACHE_CONTROL },
+ { ngx_null_string, 0 }
+};
+
+
ngx_module_t ngx_http_proxy_module;
@@ -206,7 +231,7 @@
{ ngx_string("proxy_bind"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_http_upstream_bind_set_slot,
+ ngx_http_upsteam_bind_set_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_proxy_loc_conf_t, upstream.local),
NULL },
@@ -319,14 +344,14 @@
#if (NGX_HTTP_CACHE)
{ ngx_string("proxy_cache"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
ngx_http_proxy_cache,
NGX_HTTP_LOC_CONF_OFFSET,
0,
NULL },
{ ngx_string("proxy_cache_key"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
ngx_http_proxy_cache_key,
NGX_HTTP_LOC_CONF_OFFSET,
0,
@@ -339,20 +364,6 @@
0,
&ngx_http_proxy_module },
- { ngx_string("proxy_cache_bypass"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
- ngx_http_set_predicate_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_bypass),
- NULL },
-
- { ngx_string("proxy_no_cache"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
- ngx_http_set_predicate_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,
@@ -411,15 +422,29 @@
offsetof(ngx_http_proxy_loc_conf_t, upstream.next_upstream),
&ngx_http_proxy_next_upstream_masks },
- { ngx_string("proxy_pass_header"),
+ { ngx_string("proxy_upstream_max_fails"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+ ngx_http_proxy_upstream_max_fails_unsupported,
+ 0,
+ 0,
+ NULL },
+
+ { ngx_string("proxy_upstream_fail_timeout"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+ ngx_http_proxy_upstream_fail_timeout_unsupported,
+ 0,
+ 0,
+ NULL },
+
+ { ngx_string("proxy_pass_header"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
ngx_conf_set_str_array_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_proxy_loc_conf_t, upstream.pass_headers),
NULL },
{ ngx_string("proxy_hide_header"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
ngx_conf_set_str_array_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_proxy_loc_conf_t, upstream.hide_headers),
@@ -430,7 +455,7 @@
ngx_conf_set_bitmask_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_proxy_loc_conf_t, upstream.ignore_headers),
- &ngx_http_upstream_ignore_headers_masks },
+ &ngx_http_proxy_ignore_headers_masks },
#if (NGX_HTTP_SSL)
@@ -512,13 +537,28 @@
{ ngx_string("Expect"), ngx_string("") },
{ ngx_string("If-Modified-Since"), ngx_string("") },
{ ngx_string("If-Unmodified-Since"), ngx_string("") },
- { ngx_string("If-None-Match"), ngx_string("") },
+ { ngx_string("If-Match-None"), ngx_string("") },
{ ngx_string("If-Match"), ngx_string("") },
{ ngx_string("Range"), ngx_string("") },
{ ngx_string("If-Range"), ngx_string("") },
{ ngx_null_string, ngx_null_string }
};
+
+static ngx_str_t ngx_http_proxy_hide_cache_headers[] = {
+ ngx_string("Date"),
+ ngx_string("Server"),
+ ngx_string("X-Pad"),
+ 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
@@ -572,7 +612,7 @@
u = r->upstream;
- if (plcf->proxy_lengths == NULL) {
+ if (plcf->proxy_lengths == 0) {
ctx->vars = plcf->vars;
u->schema = plcf->vars.schema;
#if (NGX_HTTP_SSL)
@@ -597,7 +637,6 @@
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;
@@ -884,7 +923,7 @@
loc_len = (r->valid_location && ctx->vars.uri.len) ?
plcf->location.len : 0;
- if (r->quoted_uri || r->space_in_uri || r->internal) {
+ if (r->quoted_uri || r->internal) {
escape = 2 * ngx_escape_uri(NULL, r->uri.data + loc_len,
r->uri.len - loc_len, NGX_ESCAPE_URI);
}
@@ -1153,13 +1192,12 @@
return NGX_OK;
}
- ctx->status.code = 0;
- ctx->status.count = 0;
- ctx->status.start = NULL;
- ctx->status.end = NULL;
+ ctx->status = 0;
+ ctx->status_count = 0;
+ ctx->status_start = NULL;
+ ctx->status_end = NULL;
r->upstream->process_header = ngx_http_proxy_process_status_line;
- r->state = 0;
return NGX_OK;
}
@@ -1168,7 +1206,6 @@
static ngx_int_t
ngx_http_proxy_process_status_line(ngx_http_request_t *r)
{
- size_t len;
ngx_int_t rc;
ngx_http_upstream_t *u;
ngx_http_proxy_ctx_t *ctx;
@@ -1179,15 +1216,15 @@
return NGX_ERROR;
}
- u = r->upstream;
-
- rc = ngx_http_parse_status_line(r, &u->buffer, &ctx->status);
+ rc = ngx_http_proxy_parse_status_line(r, ctx);
if (rc == NGX_AGAIN) {
return rc;
}
- if (rc == NGX_ERROR) {
+ u = r->upstream;
+
+ if (rc == NGX_HTTP_PROXY_PARSE_NO_HEADER) {
#if (NGX_HTTP_CACHE)
@@ -1214,20 +1251,20 @@
}
if (u->state) {
- u->state->status = ctx->status.code;
+ u->state->status = ctx->status;
}
- u->headers_in.status_n = ctx->status.code;
-
- len = ctx->status.end - ctx->status.start;
- u->headers_in.status_line.len = len;
+ u->headers_in.status_n = ctx->status;
- u->headers_in.status_line.data = ngx_pnalloc(r->pool, len);
+ u->headers_in.status_line.len = ctx->status_end - ctx->status_start;
+ u->headers_in.status_line.data = ngx_pnalloc(r->pool,
+ u->headers_in.status_line.len);
if (u->headers_in.status_line.data == NULL) {
return NGX_ERROR;
}
- ngx_memcpy(u->headers_in.status_line.data, ctx->status.start, len);
+ ngx_memcpy(u->headers_in.status_line.data, ctx->status_start,
+ u->headers_in.status_line.len);
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http proxy status %ui \"%V\"",
@@ -1240,6 +1277,214 @@
static ngx_int_t
+ngx_http_proxy_parse_status_line(ngx_http_request_t *r,
+ ngx_http_proxy_ctx_t *ctx)
+{
+ u_char ch;
+ u_char *p;
+ ngx_http_upstream_t *u;
+ enum {
+ sw_start = 0,
+ sw_H,
+ sw_HT,
+ sw_HTT,
+ sw_HTTP,
+ sw_first_major_digit,
+ sw_major_digit,
+ sw_first_minor_digit,
+ sw_minor_digit,
+ sw_status,
+ sw_space_after_status,
+ sw_status_text,
+ sw_almost_done
+ } state;
+
+ u = r->upstream;
+
+ state = r->state;
+
+ for (p = u->buffer.pos; p < u->buffer.last; p++) {
+ ch = *p;
+
+ switch (state) {
+
+ /* "HTTP/" */
+ case sw_start:
+ switch (ch) {
+ case 'H':
+ state = sw_H;
+ break;
+ default:
+ return NGX_HTTP_PROXY_PARSE_NO_HEADER;
+ }
+ break;
+
+ case sw_H:
+ switch (ch) {
+ case 'T':
+ state = sw_HT;
+ break;
+ default:
+ return NGX_HTTP_PROXY_PARSE_NO_HEADER;
+ }
+ break;
+
+ case sw_HT:
+ switch (ch) {
+ case 'T':
+ state = sw_HTT;
+ break;
+ default:
+ return NGX_HTTP_PROXY_PARSE_NO_HEADER;
+ }
+ break;
+
+ case sw_HTT:
+ switch (ch) {
+ case 'P':
+ state = sw_HTTP;
+ break;
+ default:
+ return NGX_HTTP_PROXY_PARSE_NO_HEADER;
+ }
+ break;
+
+ case sw_HTTP:
+ switch (ch) {
+ case '/':
+ state = sw_first_major_digit;
+ break;
+ default:
+ return NGX_HTTP_PROXY_PARSE_NO_HEADER;
+ }
+ break;
+
+ /* the first digit of major HTTP version */
+ case sw_first_major_digit:
+ if (ch < '1' || ch > '9') {
+ return NGX_HTTP_PROXY_PARSE_NO_HEADER;
+ }
+
+ state = sw_major_digit;
+ break;
+
+ /* the major HTTP version or dot */
+ case sw_major_digit:
+ if (ch == '.') {
+ state = sw_first_minor_digit;
+ break;
+ }
+
+ if (ch < '0' || ch > '9') {
+ return NGX_HTTP_PROXY_PARSE_NO_HEADER;
+ }
+
+ break;
+
+ /* the first digit of minor HTTP version */
+ case sw_first_minor_digit:
+ if (ch < '0' || ch > '9') {
+ return NGX_HTTP_PROXY_PARSE_NO_HEADER;
+ }
+
+ state = sw_minor_digit;
+ break;
+
+ /* the minor HTTP version or the end of the request line */
+ case sw_minor_digit:
+ if (ch == ' ') {
+ state = sw_status;
+ break;
+ }
+
+ if (ch < '0' || ch > '9') {
+ return NGX_HTTP_PROXY_PARSE_NO_HEADER;
+ }
+
+ break;
+
+ /* HTTP status code */
+ case sw_status:
+ if (ch == ' ') {
+ break;
+ }
+
+ if (ch < '0' || ch > '9') {
+ return NGX_HTTP_PROXY_PARSE_NO_HEADER;
+ }
+
+ ctx->status = ctx->status * 10 + ch - '0';
+
+ if (++ctx->status_count == 3) {
+ state = sw_space_after_status;
+ ctx->status_start = p - 2;
+ }
+
+ break;
+
+ /* space or end of line */
+ case sw_space_after_status:
+ switch (ch) {
+ case ' ':
+ state = sw_status_text;
+ break;
+ case '.': /* IIS may send 403.1, 403.2, etc */
+ state = sw_status_text;
+ break;
+ case CR:
+ state = sw_almost_done;
+ break;
+ case LF:
+ goto done;
+ default:
+ return NGX_HTTP_PROXY_PARSE_NO_HEADER;
+ }
+ break;
+
+ /* any text until end of line */
+ case sw_status_text:
+ switch (ch) {
+ case CR:
+ state = sw_almost_done;
+
+ break;
+ case LF:
+ goto done;
+ }
+ break;
+
+ /* end of status line */
+ case sw_almost_done:
+ ctx->status_end = p - 1;
+ switch (ch) {
+ case LF:
+ goto done;
+ default:
+ return NGX_HTTP_PROXY_PARSE_NO_HEADER;
+ }
+ }
+ }
+
+ u->buffer.pos = p;
+ r->state = state;
+
+ return NGX_AGAIN;
+
+done:
+
+ u->buffer.pos = p + 1;
+
+ if (ctx->status_end == NULL) {
+ ctx->status_end = p;
+ }
+
+ r->state = sw_start;
+
+ return NGX_OK;
+}
+
+
+static ngx_int_t
ngx_http_proxy_process_header(ngx_http_request_t *r)
{
ngx_int_t rc;
@@ -1321,8 +1566,10 @@
h->hash = ngx_hash(ngx_hash(ngx_hash(ngx_hash(
ngx_hash('s', 'e'), 'r'), 'v'), 'e'), 'r');
- ngx_str_set(&h->key, "Server");
- ngx_str_null(&h->value);
+ h->key.len = sizeof("Server") - 1;
+ h->key.data = (u_char *) "Server";
+ h->value.len = 0;
+ h->value.data = NULL;
h->lowcase_key = (u_char *) "server";
}
@@ -1334,8 +1581,10 @@
h->hash = ngx_hash(ngx_hash(ngx_hash('d', 'a'), 't'), 'e');
- ngx_str_set(&h->key, "Date");
- ngx_str_null(&h->value);
+ h->key.len = sizeof("Date") - 1;
+ h->key.data = (u_char *) "Date";
+ h->value.len = 0;
+ h->value.data = NULL;
h->lowcase_key = (u_char *) "date";
}
@@ -1531,14 +1780,16 @@
return NGX_DECLINED;
}
- len = pr->replacement.text.len + h->value.len - pr->redirect.len;
+ len = prefix + pr->replacement.text.len + h->value.len - pr->redirect.len;
data = ngx_pnalloc(r->pool, len);
if (data == NULL) {
return NGX_ERROR;
}
- p = ngx_copy(data, h->value.data, prefix);
+ p = data;
+
+ p = ngx_copy(p, h->value.data, prefix);
if (pr->replacement.text.len) {
p = ngx_copy(p, pr->replacement.text.data, pr->replacement.text.len);
@@ -1576,7 +1827,7 @@
e.ip = pr->replacement.vars.lengths;
e.request = r;
- len = h->value.len - pr->redirect.len;
+ len = prefix + h->value.len - pr->redirect.len;
while (*(uintptr_t *) e.ip) {
lcode = *(ngx_http_script_len_code_pt *) e.ip;
@@ -1588,7 +1839,9 @@
return NGX_ERROR;
}
- p = ngx_copy(data, h->value.data, prefix);
+ p = data;
+
+ p = ngx_copy(p, h->value.data, prefix);
e.ip = pr->replacement.vars.values;
e.pos = p;
@@ -1660,7 +1913,7 @@
* conf->body_set_len = NULL;
* conf->body_set = NULL;
* conf->body_source = { 0, NULL };
- * conf->redirects = NULL;
+ * conf->rewrite_locations = NULL;
*/
conf->upstream.store = NGX_CONF_UNSET;
@@ -1685,8 +1938,6 @@
#if (NGX_HTTP_CACHE)
conf->upstream.cache = NGX_CONF_UNSET_PTR;
conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT;
- conf->upstream.cache_bypass = NGX_CONF_UNSET_PTR;
- conf->upstream.no_cache = NGX_CONF_UNSET_PTR;
conf->upstream.cache_valid = NGX_CONF_UNSET_PTR;
#endif
@@ -1718,9 +1969,9 @@
ngx_http_proxy_loc_conf_t *conf = child;
size_t size;
+ ngx_str_t *h;
ngx_keyval_t *s;
ngx_hash_init_t hash;
- ngx_http_core_loc_conf_t *clcf;
ngx_http_proxy_redirect_t *pr;
ngx_http_script_compile_t sc;
@@ -1911,18 +2162,6 @@
|NGX_HTTP_UPSTREAM_FT_OFF;
}
- ngx_conf_merge_ptr_value(conf->upstream.cache_bypass,
- prev->upstream.cache_bypass, NULL);
-
- ngx_conf_merge_ptr_value(conf->upstream.no_cache,
- prev->upstream.no_cache, NULL);
-
- if (conf->upstream.no_cache && conf->upstream.cache_bypass == NULL) {
- ngx_log_error(NGX_LOG_WARN, cf->log, 0,
- "\"proxy_no_cache\" functionality has been changed in 0.8.46, "
- "now it should be used together with \"proxy_cache_bypass\"");
- }
-
ngx_conf_merge_ptr_value(conf->upstream.cache_valid,
prev->upstream.cache_valid, NULL);
@@ -1981,11 +2220,18 @@
pr->replacement.text = conf->location;
} else {
- ngx_str_null(&pr->replacement.text);
+ pr->replacement.text.len = 0;
+ pr->replacement.text.data = NULL;
}
}
}
+ /* STUB */
+ if (prev->proxy_lengths) {
+ conf->proxy_lengths = prev->proxy_lengths;
+ conf->proxy_values = prev->proxy_values;
+ }
+
#if (NGX_HTTP_SSL)
if (conf->upstream.ssl == NULL) {
conf->upstream.ssl = prev->upstream.ssl;
@@ -2005,8 +2251,18 @@
hash.bucket_size = conf->headers_hash_bucket_size;
hash.name = "proxy_headers_hash";
+#if (NGX_HTTP_CACHE)
+
+ h = conf->upstream.cache ? ngx_http_proxy_hide_cache_headers:
+ ngx_http_proxy_hide_headers;
+#else
+
+ h = ngx_http_proxy_hide_headers;
+
+#endif
+
if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream,
- &prev->upstream, ngx_http_proxy_hide_headers, &hash)
+ &prev->upstream, h, &hash)
!= NGX_OK)
{
return NGX_CONF_ERROR;
@@ -2017,18 +2273,6 @@
conf->vars = prev->vars;
}
- if (conf->proxy_lengths == NULL) {
- conf->proxy_lengths = prev->proxy_lengths;
- conf->proxy_values = prev->proxy_values;
- }
-
- if (conf->upstream.upstream || conf->proxy_lengths) {
- clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
- if (clcf->handler == NULL && clcf->lmt_excpt) {
- clcf->handler = ngx_http_proxy_handler;
- conf->location = prev->location;
- }
- }
if (conf->body_source.data == NULL) {
conf->body_source = prev->body_source;
@@ -2065,8 +2309,10 @@
return NGX_CONF_ERROR;
}
- ngx_str_set(&s->key, "Content-Length");
- ngx_str_set(&s->value, "$proxy_internal_body_length");
+ s->key.len = sizeof("Content-Length") - 1;
+ s->key.data = (u_char *) "Content-Length";
+ s->value.len = sizeof("$proxy_internal_body_length") - 1;
+ s->value.data = (u_char *) "$proxy_internal_body_length";
}
if (ngx_http_proxy_merge_headers(cf, conf, prev) != NGX_OK) {
@@ -2085,7 +2331,6 @@
size_t size;
uintptr_t *code;
ngx_uint_t i;
- ngx_array_t headers_names;
ngx_keyval_t *src, *s, *h;
ngx_hash_key_t *hk;
ngx_hash_init_t hash;
@@ -2110,9 +2355,8 @@
}
- if (ngx_array_init(&headers_names, cf->temp_pool, 4, sizeof(ngx_hash_key_t))
- != NGX_OK)
- {
+ conf->headers_names = ngx_array_create(cf->pool, 4, sizeof(ngx_hash_key_t));
+ if (conf->headers_names == NULL) {
return NGX_ERROR;
}
@@ -2173,7 +2417,7 @@
src = conf->headers_source->elts;
for (i = 0; i < conf->headers_source->nelts; i++) {
- hk = ngx_array_push(&headers_names);
+ hk = ngx_array_push(conf->headers_names);
if (hk == NULL) {
return NGX_ERROR;
}
@@ -2321,7 +2565,14 @@
hash.pool = cf->pool;
hash.temp_pool = NULL;
- return ngx_hash_init(&hash, headers_names.elts, headers_names.nelts);
+ if (ngx_hash_init(&hash, conf->headers_names->elts,
+ conf->headers_names->nelts)
+ != NGX_OK)
+ {
+ return NGX_ERROR;
+ }
+
+ return NGX_OK;
}
@@ -2503,16 +2754,9 @@
}
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_redirect default\" must go "
+ "\"proxy_rewrite_location default\" must go "
"after the \"proxy_pass\" directive");
return NGX_CONF_ERROR;
}
@@ -2524,7 +2768,8 @@
pr->replacement.text = plcf->location;
} else {
- ngx_str_null(&pr->replacement.text);
+ pr->replacement.text.len = 0;
+ pr->replacement.text.data = NULL;
}
return NGX_CONF_OK;
@@ -2713,6 +2958,32 @@
}
+static char *
+ngx_http_proxy_upstream_max_fails_unsupported(ngx_conf_t *cf,
+ ngx_command_t *cmd, void *conf)
+{
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "\"proxy_upstream_max_fails\" is not supported, "
+ "use the \"max_fails\" parameter of the \"server\" directive ",
+ "inside the \"upstream\" block");
+
+ return NGX_CONF_ERROR;
+}
+
+
+static char *
+ngx_http_proxy_upstream_fail_timeout_unsupported(ngx_conf_t *cf,
+ ngx_command_t *cmd, void *conf)
+{
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "\"proxy_upstream_fail_timeout\" is not supported, "
+ "use the \"fail_timeout\" parameter of the \"server\" directive ",
+ "inside the \"upstream\" block");
+
+ return NGX_CONF_ERROR;
+}
+
+
#if (NGX_HTTP_SSL)
static ngx_int_t
@@ -2758,10 +3029,12 @@
v->host_header = u->host;
if (u->default_port == 80) {
- ngx_str_set(&v->port, "80");
+ v->port.len = sizeof("80") - 1;
+ v->port.data = (u_char *) "80";
} else {
- ngx_str_set(&v->port, "443");
+ v->port.len = sizeof("443") - 1;
+ v->port.data = (u_char *) "443";
}
} else {
@@ -2773,8 +3046,10 @@
v->key_start.len += v->host_header.len;
} else {
- ngx_str_set(&v->host_header, "localhost");
- ngx_str_null(&v->port);
+ v->host_header.len = sizeof("localhost") - 1;
+ v->host_header.data = (u_char *) "localhost";
+ v->port.len = 0;
+ v->port.data = (u_char *) "";
v->key_start.len += sizeof("unix:") - 1 + u->host.len + 1;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_random_index_module.c
^
|
@@ -86,6 +86,10 @@
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;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_range_filter_module.c
^
|
@@ -224,8 +224,10 @@
}
r->headers_out.accept_ranges->hash = 1;
- ngx_str_set(&r->headers_out.accept_ranges->key, "Accept-Ranges");
- ngx_str_set(&r->headers_out.accept_ranges->value, "bytes");
+ r->headers_out.accept_ranges->key.len = sizeof("Accept-Ranges") - 1;
+ r->headers_out.accept_ranges->key.data = (u_char *) "Accept-Ranges";
+ r->headers_out.accept_ranges->value.len = sizeof("bytes") - 1;
+ r->headers_out.accept_ranges->value.data = (u_char *) "bytes";
return ngx_http_next_header_filter(r);
}
@@ -353,7 +355,8 @@
r->headers_out.content_range = content_range;
content_range->hash = 1;
- ngx_str_set(&content_range->key, "Content-Range");
+ content_range->key.len = sizeof("Content-Range") - 1;
+ content_range->key.data = (u_char *) "Content-Range";
content_range->value.data = ngx_pnalloc(r->pool,
sizeof("bytes -/") - 1 + 3 * NGX_OFF_T_LEN);
@@ -517,7 +520,8 @@
r->headers_out.content_range = content_range;
content_range->hash = 1;
- ngx_str_set(&content_range->key, "Content-Range");
+ content_range->key.len = sizeof("Content-Range") - 1;
+ content_range->key.data = (u_char *) "Content-Range";
content_range->value.data = ngx_pnalloc(r->pool,
sizeof("bytes */") - 1 + NGX_OFF_T_LEN);
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_referer_module.c
^
|
@@ -124,27 +124,18 @@
len = r->headers_in.referer->value.len;
ref = r->headers_in.referer->value.data;
- 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;
+ if (len < sizeof("http://i.ru") - 1
+ || (ngx_strncasecmp(ref, (u_char *) "http://", 7) != 0))
+ {
+ if (rlcf->blocked_referer) {
+ goto valid;
}
- }
- if (rlcf->blocked_referer) {
- goto valid;
+ goto invalid;
}
- goto invalid;
-
-valid_scheme:
-
+ last = ref + len;
+ ref += 7;
i = 0;
key = 0;
@@ -363,7 +354,8 @@
ngx_http_server_name_t *sn;
ngx_http_core_srv_conf_t *cscf;
- ngx_str_set(&name, "invalid_referer");
+ name.len = sizeof("invalid_referer") - 1;
+ name.data = (u_char *) "invalid_referer";
var = ngx_http_add_variable(cf, &name,
NGX_HTTP_VAR_CHANGEABLE|NGX_HTTP_VAR_NOHASH);
@@ -406,7 +398,8 @@
continue;
}
- ngx_str_null(&uri);
+ uri.len = 0;
+ uri.data = NULL;
if (ngx_strcmp(value[i].data, "server_names") == 0) {
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_rewrite_module.c
^
|
@@ -52,7 +52,7 @@
{ ngx_string("return"),
NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
- |NGX_CONF_TAKE12,
+ |NGX_CONF_TAKE1,
ngx_http_rewrite_return,
NGX_HTTP_LOC_CONF_OFFSET,
0,
@@ -341,10 +341,13 @@
last = 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)
- {
+ 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) {
regex->status = NGX_HTTP_MOVED_TEMPORARILY;
regex->redirect = 1;
last = 1;
@@ -433,10 +436,8 @@
{
ngx_http_rewrite_loc_conf_t *lcf = conf;
- u_char *p;
- ngx_str_t *value, *v;
- ngx_http_script_return_code_t *ret;
- ngx_http_compile_complex_value_t ccv;
+ ngx_str_t *value;
+ ngx_http_script_return_code_t *ret;
ret = ngx_http_script_start_code(cf->pool, &lcf->codes,
sizeof(ngx_http_script_return_code_t));
@@ -446,46 +447,12 @@
value = cf->args->elts;
- ngx_memzero(ret, sizeof(ngx_http_script_return_code_t));
-
ret->code = ngx_http_script_return_code;
+ ret->null = (uintptr_t) NULL;
- p = value[1].data;
-
- ret->status = ngx_atoi(p, value[1].len);
+ ret->status = ngx_atoi(value[1].data, value[1].len);
if (ret->status == (uintptr_t) NGX_ERROR) {
-
- if (cf->args->nelts == 2
- && (ngx_strncmp(p, "http://", sizeof("http://") - 1) == 0
- || ngx_strncmp(p, "https://", sizeof("https://") - 1) == 0
- || ngx_strncmp(p, "$scheme", sizeof("$scheme") - 1) == 0))
- {
- ret->status = NGX_HTTP_MOVED_TEMPORARILY;
- v = &value[1];
-
- } else {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "invalid return code \"%V\"", &value[1]);
- return NGX_CONF_ERROR;
- }
-
- } else {
-
- if (cf->args->nelts == 2) {
- return NGX_CONF_OK;
- }
-
- v = &value[2];
- }
-
- ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
-
- ccv.cf = cf;
- ccv.value = v;
- ccv.complex_value = &ret->text;
-
- if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
return NGX_CONF_ERROR;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_secure_link_module.c
^
|
@@ -11,22 +11,10 @@
typedef struct {
- ngx_http_complex_value_t *variable;
- ngx_http_complex_value_t *md5;
- ngx_str_t secret;
+ ngx_str_t secret;
} ngx_http_secure_link_conf_t;
-typedef struct {
- ngx_str_t expires;
-} ngx_http_secure_link_ctx_t;
-
-
-static ngx_int_t ngx_http_secure_link_old_variable(ngx_http_request_t *r,
- ngx_http_secure_link_conf_t *conf, ngx_http_variable_value_t *v,
- uintptr_t data);
-static ngx_int_t ngx_http_secure_link_expires_variable(ngx_http_request_t *r,
- ngx_http_variable_value_t *v, uintptr_t data);
static void *ngx_http_secure_link_create_conf(ngx_conf_t *cf);
static char *ngx_http_secure_link_merge_conf(ngx_conf_t *cf, void *parent,
void *child);
@@ -35,20 +23,6 @@
static ngx_command_t ngx_http_secure_link_commands[] = {
- { ngx_string("secure_link"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_http_set_complex_value_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_secure_link_conf_t, variable),
- NULL },
-
- { ngx_string("secure_link_md5"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_http_set_complex_value_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_secure_link_conf_t, md5),
- NULL },
-
{ ngx_string("secure_link_secret"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_conf_set_str_slot,
@@ -91,122 +65,27 @@
};
-static ngx_str_t ngx_http_secure_link_name = ngx_string("secure_link");
-static ngx_str_t ngx_http_secure_link_expires_name =
- ngx_string("secure_link_expires");
+static ngx_str_t ngx_http_secure_link = ngx_string("secure_link");
static ngx_int_t
ngx_http_secure_link_variable(ngx_http_request_t *r,
- ngx_http_variable_value_t *v, uintptr_t data)
+ ngx_http_variable_value_t *v, uintptr_t data)
{
- u_char *p, *last;
- ngx_str_t val, hash;
- time_t expires;
- ngx_md5_t md5;
- ngx_http_secure_link_ctx_t *ctx;
+ u_char *p, *start, *end, *last;
+ size_t len;
+ ngx_int_t n;
+ ngx_uint_t i;
+ ngx_md5_t md5;
ngx_http_secure_link_conf_t *conf;
- u_char hash_buf[16], md5_buf[16];
+ u_char hash[16];
conf = ngx_http_get_module_loc_conf(r, ngx_http_secure_link_module);
- if (conf->secret.len) {
- return ngx_http_secure_link_old_variable(r, conf, v, data);
- }
-
- if (conf->variable == NULL || conf->md5 == NULL) {
- goto not_found;
- }
-
- if (ngx_http_complex_value(r, conf->variable, &val) != NGX_OK) {
- return NGX_ERROR;
- }
-
- ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "secure link: \"%V\"", &val);
-
- last = val.data + val.len;
-
- p = ngx_strlchr(val.data, last, ',');
- expires = 0;
-
- if (p) {
- val.len = p++ - val.data;
-
- expires = ngx_atotm(p, last - p);
- if (expires <= 0) {
- goto not_found;
- }
-
- ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_secure_link_ctx_t));
- if (ctx == NULL) {
- return NGX_ERROR;
- }
-
- ngx_http_set_ctx(r, ctx, ngx_http_secure_link_module);
-
- ctx->expires.len = last - p;
- ctx->expires.data = p;
- }
-
- if (val.len > 24) {
- goto not_found;
- }
-
- hash.len = 16;
- hash.data = hash_buf;
-
- if (ngx_decode_base64url(&hash, &val) != NGX_OK) {
- goto not_found;
- }
-
- if (hash.len != 16) {
- goto not_found;
- }
-
- if (ngx_http_complex_value(r, conf->md5, &val) != NGX_OK) {
- return NGX_ERROR;
- }
-
- ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "secure link md5: \"%V\"", &val);
-
- ngx_md5_init(&md5);
- ngx_md5_update(&md5, val.data, val.len);
- ngx_md5_final(md5_buf, &md5);
-
- if (ngx_memcmp(hash_buf, md5_buf, 16) != 0) {
+ if (conf->secret.len == 0) {
goto not_found;
}
- v->data = (u_char *) ((expires && expires < ngx_time()) ? "0" : "1");
- v->len = 1;
- v->valid = 1;
- v->no_cacheable = 0;
- v->not_found = 0;
-
- return NGX_OK;
-
-not_found:
-
- v->not_found = 1;
-
- return NGX_OK;
-}
-
-
-static ngx_int_t
-ngx_http_secure_link_old_variable(ngx_http_request_t *r,
- ngx_http_secure_link_conf_t *conf, ngx_http_variable_value_t *v,
- uintptr_t data)
-{
- u_char *p, *start, *end, *last;
- size_t len;
- ngx_int_t n;
- ngx_uint_t i;
- ngx_md5_t md5;
- u_char hash[16];
-
p = &r->unparsed_uri.data[1];
last = r->unparsed_uri.data + r->unparsed_uri.len;
@@ -266,29 +145,6 @@
}
-static ngx_int_t
-ngx_http_secure_link_expires_variable(ngx_http_request_t *r,
- ngx_http_variable_value_t *v, uintptr_t data)
-{
- ngx_http_secure_link_ctx_t *ctx;
-
- ctx = ngx_http_get_module_ctx(r, ngx_http_secure_link_module);
-
- if (ctx) {
- v->len = ctx->expires.len;
- v->valid = 1;
- v->no_cacheable = 0;
- v->not_found = 0;
- v->data = ctx->expires.data;
-
- } else {
- v->not_found = 1;
- }
-
- return NGX_OK;
-}
-
-
static void *
ngx_http_secure_link_create_conf(ngx_conf_t *cf)
{
@@ -302,9 +158,7 @@
/*
* set by ngx_pcalloc():
*
- * conf->variable = NULL;
- * conf->md5 = NULL;
- * conf->secret = { 0, NULL };
+ * conf->secret = { 0, NULL }
*/
return conf;
@@ -319,14 +173,6 @@
ngx_conf_merge_str_value(conf->secret, prev->secret, "");
- if (conf->variable == NULL) {
- conf->variable = prev->variable;
- }
-
- if (conf->md5 == NULL) {
- conf->md5 = prev->md5;
- }
-
return NGX_CONF_OK;
}
@@ -336,19 +182,12 @@
{
ngx_http_variable_t *var;
- var = ngx_http_add_variable(cf, &ngx_http_secure_link_name, 0);
+ var = ngx_http_add_variable(cf, &ngx_http_secure_link, NGX_HTTP_VAR_NOHASH);
if (var == NULL) {
return NGX_ERROR;
}
var->get_handler = ngx_http_secure_link_variable;
- var = ngx_http_add_variable(cf, &ngx_http_secure_link_expires_name, 0);
- if (var == NULL) {
- return NGX_ERROR;
- }
-
- var->get_handler = ngx_http_secure_link_expires_variable;
-
return NGX_OK;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_ssi_filter_module.c
^
|
@@ -14,6 +14,7 @@
#define NGX_HTTP_SSI_ADD_PREFIX 1
#define NGX_HTTP_SSI_ADD_ZERO 2
+#define NGX_HTTP_SSI_EXPR_TEST 4
typedef struct {
@@ -70,8 +71,6 @@
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,
@@ -348,9 +347,13 @@
ctx->params.nalloc = NGX_HTTP_SSI_PARAMS_N;
ctx->params.pool = r->pool;
- ngx_str_set(&ctx->timefmt, "%A, %d-%b-%Y %H:%M:%S %Z");
- ngx_str_set(&ctx->errmsg,
- "[an error occurred while processing the directive]");
+ ctx->timefmt.len = sizeof("%A, %d-%b-%Y %H:%M:%S %Z") - 1;
+ ctx->timefmt.data = (u_char *) "%A, %d-%b-%Y %H:%M:%S %Z";
+
+ ctx->errmsg.len =
+ sizeof("[an error occurred while processing the directive]") - 1;
+ ctx->errmsg.data = (u_char *)
+ "[an error occurred while processing the directive]";
r->filter_need_in_memory = 1;
@@ -433,7 +436,7 @@
while (ctx->in || ctx->buf) {
- if (ctx->buf == NULL) {
+ if (ctx->buf == NULL ){
ctx->buf = ctx->in->buf;
ctx->in = ctx->in->next;
ctx->pos = ctx->buf->pos;
@@ -795,7 +798,6 @@
}
if (rc == NGX_DONE || rc == NGX_AGAIN || rc == NGX_ERROR) {
- ngx_http_ssi_buffered(r, ctx);
return rc;
}
}
@@ -948,21 +950,14 @@
}
}
- 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;
}
@@ -1706,7 +1701,8 @@
val = ngx_http_ssi_get_variable(r, &var, key);
if (val == NULL) {
- vv = ngx_http_get_variable(r, &var, key);
+ vv = ngx_http_get_variable(r, &var, key,
+ flags & NGX_HTTP_SSI_EXPR_TEST);
if (vv == NULL) {
return NGX_ERROR;
}
@@ -1910,7 +1906,8 @@
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"ssi include: \"%V\"", uri);
- ngx_str_null(&args);
+ args.len = 0;
+ args.data = NULL;
flags = NGX_HTTP_LOG_UNSAFE;
if (ngx_http_parse_unsafe_uri(r, uri, &args, &flags) != NGX_OK) {
@@ -2064,9 +2061,9 @@
out = data;
if (!r->header_sent) {
- 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_set_content_type(r) != NGX_OK) {
+ return NGX_ERROR;
+ }
if (ngx_http_send_header(r) == NGX_ERROR) {
return NGX_ERROR;
@@ -2113,7 +2110,7 @@
value = ngx_http_ssi_get_variable(r, var, key);
if (value == NULL) {
- vv = ngx_http_get_variable(r, var, key);
+ vv = ngx_http_get_variable(r, var, key, 1);
if (vv == NULL) {
return NGX_HTTP_SSI_ERROR;
@@ -2164,10 +2161,11 @@
}
}
- p = value->data;
-
switch (ctx->encoding) {
+ case NGX_HTTP_SSI_NO_ENCODING:
+ break;
+
case NGX_HTTP_SSI_URL_ENCODING:
len = 2 * ngx_escape_uri(NULL, value->data, value->len,
NGX_ESCAPE_HTML);
@@ -2179,9 +2177,11 @@
}
(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:
@@ -2194,13 +2194,11 @@
}
(void) ngx_escape_html(p, value->data, value->len);
- }
- len += value->len;
- break;
+ value->len += len;
+ value->data = p;
+ }
- default: /* NGX_HTTP_SSI_NO_ENCODING */
- len = value->len;
break;
}
@@ -2215,8 +2213,8 @@
}
b->memory = 1;
- b->pos = p;
- b->last = p + len;
+ b->pos = value->data;
+ b->last = value->data + value->len;
cl->buf = b;
cl->next = NULL;
@@ -2364,7 +2362,7 @@
p++;
}
- flags = 0;
+ flags = (p == last) ? NGX_HTTP_SSI_EXPR_TEST : 0;
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"left: \"%V\"", &left);
@@ -2617,7 +2615,8 @@
return NGX_ERROR;
}
- v->len = ngx_sprintf(v->data, "%T", tp->sec) - v->data;
+ v->len = ngx_sprintf(v->data, "%T", tp->sec + (gmt ? 0 : tp->gmtoff))
+ - v->data;
return NGX_OK;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_ssl_module.c
^
|
@@ -314,7 +314,8 @@
* sscf->dhparam = { 0, NULL };
* sscf->client_certificate = { 0, NULL };
* sscf->crl = { 0, NULL };
- * sscf->ciphers = { 0, NULL };
+ * sscf->ciphers.len = 0;
+ * sscf->ciphers.data = NULL;
* sscf->shm_zone = NULL;
*/
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_static_module.c
^
|
@@ -66,6 +66,10 @@
return NGX_DECLINED;
}
+ if (r->zero_in_uri) {
+ return NGX_DECLINED;
+ }
+
log = r->connection->log;
/*
@@ -185,7 +189,7 @@
#if !(NGX_WIN32) /* the not regular files are probably Unix specific */
if (!of.is_file) {
- ngx_log_error(NGX_LOG_CRIT, log, 0,
+ ngx_log_error(NGX_LOG_CRIT, log, ngx_errno,
"\"%s\" is not a regular file", path.data);
return NGX_HTTP_NOT_FOUND;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_stub_status_module.c
^
|
@@ -75,7 +75,8 @@
return rc;
}
- ngx_str_set(&r->headers_out.content_type, "text/plain");
+ r->headers_out.content_type.len = sizeof("text/plain") - 1;
+ r->headers_out.content_type.data = (u_char *) "text/plain";
if (r->method == NGX_HTTP_HEAD) {
r->headers_out.status = NGX_HTTP_OK;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_sub_filter_module.c
^
|
@@ -29,8 +29,6 @@
typedef struct {
ngx_str_t match;
- ngx_str_t saved;
- ngx_str_t looked;
ngx_uint_t once; /* unsigned once:1 */
@@ -49,6 +47,8 @@
ngx_str_t sub;
ngx_uint_t state;
+ size_t saved;
+ size_t looked;
} ngx_http_sub_ctx_t;
@@ -147,16 +147,6 @@
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;
@@ -220,7 +210,7 @@
while (ctx->in || ctx->buf) {
- if (ctx->buf == NULL) {
+ if (ctx->buf == NULL ){
ctx->buf = ctx->in->buf;
ctx->in = ctx->in->next;
ctx->pos = ctx->buf->pos;
@@ -236,13 +226,13 @@
while (ctx->pos < ctx->buf->last) {
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "saved: \"%V\" state: %d", &ctx->saved, ctx->state);
+ "saved: %d 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: \"%V\" %p-%p",
- rc, &ctx->looked, ctx->copy_start, ctx->copy_end);
+ "parse: %d, looked: %d %p-%p",
+ rc, ctx->looked, ctx->copy_start, ctx->copy_end);
if (rc == NGX_ERROR) {
return rc;
@@ -251,9 +241,9 @@
if (ctx->copy_start != ctx->copy_end) {
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "saved: \"%V\"", &ctx->saved);
+ "saved: %d", ctx->saved);
- if (ctx->saved.len) {
+ if (ctx->saved) {
if (ctx->free) {
cl = ctx->free;
@@ -275,19 +265,14 @@
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.len = 0;
+ ctx->saved = 0;
}
if (ctx->free) {
@@ -420,8 +405,7 @@
ctx->buf = NULL;
- ctx->saved.len = ctx->looked.len;
- ngx_memcpy(ctx->saved.data, ctx->looked.data, ctx->looked.len);
+ ctx->saved = ctx->looked;
}
if (ctx->out == NULL && ctx->busy == NULL) {
@@ -512,7 +496,7 @@
ctx->copy_start = ctx->pos;
ctx->copy_end = ctx->buf->last;
ctx->pos = ctx->buf->last;
- ctx->looked.len = 0;
+ ctx->looked = 0;
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "once");
@@ -520,7 +504,7 @@
}
state = ctx->state;
- looked = ctx->looked.len;
+ looked = ctx->looked;
last = ctx->buf->last;
copy_end = ctx->copy_end;
@@ -538,7 +522,6 @@
for ( ;; ) {
if (ch == match) {
copy_end = p;
- ctx->looked.data[0] = *p;
looked = 1;
state = sub_match_state;
@@ -555,7 +538,7 @@
ctx->state = state;
ctx->pos = p;
- ctx->looked.len = looked;
+ ctx->looked = looked;
ctx->copy_end = p;
if (ctx->copy_start == NULL) {
@@ -572,17 +555,16 @@
/* 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.len = 0;
+ ctx->saved = 0;
}
ctx->state = sub_start_state;
ctx->pos = p + 1;
- ctx->looked.len = 0;
+ ctx->looked = 0;
ctx->copy_end = copy_end;
if (ctx->copy_start == NULL && copy_end) {
@@ -594,7 +576,6 @@
} else if (ch == ctx->match.data[0]) {
copy_end = p;
- ctx->looked.data[0] = *p;
looked = 1;
} else {
@@ -606,7 +587,7 @@
ctx->state = state;
ctx->pos = p;
- ctx->looked.len = looked;
+ ctx->looked = looked;
ctx->copy_end = (state == sub_start_state) ? p : copy_end;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_userid_filter_module.c
^
|
@@ -47,8 +47,6 @@
ngx_http_variable_value_t *v, ngx_str_t *name, uint32_t *uid);
static ngx_int_t ngx_http_userid_set_uid(ngx_http_request_t *r,
ngx_http_userid_ctx_t *ctx, ngx_http_userid_conf_t *conf);
-static ngx_int_t ngx_http_userid_create_uid(ngx_http_request_t *r,
- ngx_http_userid_ctx_t *ctx, ngx_http_userid_conf_t *conf);
static ngx_int_t ngx_http_userid_add_variables(ngx_conf_t *cf);
static ngx_int_t ngx_http_userid_init(ngx_conf_t *cf);
@@ -201,7 +199,7 @@
conf = ngx_http_get_module_loc_conf(r, ngx_http_userid_filter_module);
- if (conf->enable < NGX_HTTP_USERID_V1) {
+ if (conf->enable <= NGX_HTTP_USERID_LOG) {
return ngx_http_next_header_filter(r);
}
@@ -211,6 +209,23 @@
return NGX_ERROR;
}
+ if (ctx->uid_got[3] != 0) {
+
+ if (conf->mark == '\0') {
+ return ngx_http_next_header_filter(r);
+
+ } else {
+ if (ctx->cookie.len > 23
+ && ctx->cookie.data[22] == conf->mark
+ && ctx->cookie.data[23] == '=')
+ {
+ return ngx_http_next_header_filter(r);
+ }
+ }
+ }
+
+ /* ctx->status == NGX_DECLINED */
+
if (ngx_http_userid_set_uid(r, ctx, conf) == NGX_OK) {
return ngx_http_next_header_filter(r);
}
@@ -233,16 +248,18 @@
return NGX_OK;
}
- ctx = ngx_http_userid_get_uid(r->main, conf);
+ ctx = ngx_http_userid_get_uid(r, conf);
if (ctx == NULL) {
return NGX_ERROR;
}
if (ctx->uid_got[3] != 0) {
- return ngx_http_userid_variable(r->main, v, &conf->name, ctx->uid_got);
+ return ngx_http_userid_variable(r, v, &conf->name, ctx->uid_got);
}
+ /* ctx->status == NGX_DECLINED */
+
v->not_found = 1;
return NGX_OK;
@@ -256,29 +273,16 @@
ngx_http_userid_ctx_t *ctx;
ngx_http_userid_conf_t *conf;
- conf = ngx_http_get_module_loc_conf(r->main, ngx_http_userid_filter_module);
+ ctx = ngx_http_get_module_ctx(r, ngx_http_userid_filter_module);
- if (conf->enable < NGX_HTTP_USERID_V1) {
+ if (ctx == NULL || ctx->uid_set[3] == 0) {
v->not_found = 1;
return NGX_OK;
}
- ctx = ngx_http_userid_get_uid(r->main, conf);
-
- if (ctx == NULL) {
- return NGX_ERROR;
- }
-
- if (ngx_http_userid_create_uid(r->main, ctx, conf) != NGX_OK) {
- return NGX_ERROR;
- }
-
- if (ctx->uid_set[3] == 0) {
- v->not_found = 1;
- return NGX_OK;
- }
+ conf = ngx_http_get_module_loc_conf(r, ngx_http_userid_filter_module);
- return ngx_http_userid_variable(r->main, v, &conf->name, ctx->uid_set);
+ return ngx_http_userid_variable(r, v, &conf->name, ctx->uid_set);
}
@@ -356,17 +360,82 @@
ngx_http_userid_set_uid(ngx_http_request_t *r, ngx_http_userid_ctx_t *ctx,
ngx_http_userid_conf_t *conf)
{
- u_char *cookie, *p;
- size_t len;
- ngx_str_t src, dst;
- ngx_table_elt_t *set_cookie, *p3p;
+ u_char *cookie, *p;
+ size_t len;
+ ngx_str_t src, dst;
+ ngx_table_elt_t *set_cookie, *p3p;
+ ngx_connection_t *c;
+ struct sockaddr_in *sin;
+#if (NGX_HAVE_INET6)
+ struct sockaddr_in6 *sin6;
+#endif
- if (ngx_http_userid_create_uid(r, ctx, conf) != NGX_OK) {
- return NGX_ERROR;
- }
+ /*
+ * TODO: in the threaded mode the sequencers should be in TLS and their
+ * ranges should be divided between threads
+ */
- if (ctx->uid_set[3] == 0) {
- return NGX_OK;
+ if (ctx->uid_got[3] == 0) {
+
+ if (conf->enable == NGX_HTTP_USERID_V1) {
+ if (conf->service == NGX_CONF_UNSET) {
+ ctx->uid_set[0] = 0;
+ } else {
+ ctx->uid_set[0] = conf->service;
+ }
+ ctx->uid_set[1] = (uint32_t) ngx_time();
+ ctx->uid_set[2] = start_value;
+ ctx->uid_set[3] = sequencer_v1;
+ sequencer_v1 += 0x100;
+
+ } else {
+ if (conf->service == NGX_CONF_UNSET) {
+
+ c = r->connection;
+
+ if (ngx_connection_local_sockaddr(c, NULL, 0) != NGX_OK) {
+ return NGX_ERROR;
+ }
+
+ switch (c->local_sockaddr->sa_family) {
+
+#if (NGX_HAVE_INET6)
+ case AF_INET6:
+ sin6 = (struct sockaddr_in6 *) c->local_sockaddr;
+
+ p = (u_char *) &ctx->uid_set[0];
+
+ *p++ = sin6->sin6_addr.s6_addr[12];
+ *p++ = sin6->sin6_addr.s6_addr[13];
+ *p++ = sin6->sin6_addr.s6_addr[14];
+ *p = sin6->sin6_addr.s6_addr[15];
+
+ break;
+#endif
+ default: /* AF_INET */
+ sin = (struct sockaddr_in *) c->local_sockaddr;
+ ctx->uid_set[0] = sin->sin_addr.s_addr;
+ break;
+ }
+
+ } else {
+ ctx->uid_set[0] = htonl(conf->service);
+ }
+
+ ctx->uid_set[1] = htonl((uint32_t) ngx_time());
+ ctx->uid_set[2] = htonl(start_value);
+ ctx->uid_set[3] = htonl(sequencer_v2);
+ sequencer_v2 += 0x100;
+ if (sequencer_v2 < 0x03030302) {
+ sequencer_v2 = 0x03030302;
+ }
+ }
+
+ } else {
+ ctx->uid_set[0] = ctx->uid_got[0];
+ ctx->uid_set[1] = ctx->uid_got[1];
+ ctx->uid_set[2] = ctx->uid_got[2];
+ ctx->uid_set[3] = ctx->uid_got[3];
}
len = conf->name.len + 1 + ngx_base64_encoded_length(16) + conf->path.len;
@@ -424,7 +493,8 @@
}
set_cookie->hash = 1;
- ngx_str_set(&set_cookie->key, "Set-Cookie");
+ set_cookie->key.len = sizeof("Set-Cookie") - 1;
+ set_cookie->key.data = (u_char *) "Set-Cookie";
set_cookie->value.len = p - cookie;
set_cookie->value.data = cookie;
@@ -441,7 +511,8 @@
}
p3p->hash = 1;
- ngx_str_set(&p3p->key, "P3P");
+ p3p->key.len = sizeof("P3P") - 1;
+ p3p->key.data = (u_char *) "P3P";
p3p->value = conf->p3p;
return NGX_OK;
@@ -449,102 +520,6 @@
static ngx_int_t
-ngx_http_userid_create_uid(ngx_http_request_t *r, ngx_http_userid_ctx_t *ctx,
- ngx_http_userid_conf_t *conf)
-{
- ngx_connection_t *c;
- struct sockaddr_in *sin;
-#if (NGX_HAVE_INET6)
- u_char *p;
- struct sockaddr_in6 *sin6;
-#endif
-
- if (ctx->uid_set[3] != 0) {
- return NGX_OK;
- }
-
- if (ctx->uid_got[3] != 0) {
-
- if (conf->mark == '\0'
- || (ctx->cookie.len > 23
- && ctx->cookie.data[22] == conf->mark
- && ctx->cookie.data[23] == '='))
- {
- return NGX_OK;
- }
-
- ctx->uid_set[0] = ctx->uid_got[0];
- ctx->uid_set[1] = ctx->uid_got[1];
- ctx->uid_set[2] = ctx->uid_got[2];
- ctx->uid_set[3] = ctx->uid_got[3];
-
- return NGX_OK;
- }
-
- /*
- * TODO: in the threaded mode the sequencers should be in TLS and their
- * ranges should be divided between threads
- */
-
- if (conf->enable == NGX_HTTP_USERID_V1) {
- if (conf->service == NGX_CONF_UNSET) {
- ctx->uid_set[0] = 0;
- } else {
- ctx->uid_set[0] = conf->service;
- }
- ctx->uid_set[1] = (uint32_t) ngx_time();
- ctx->uid_set[2] = start_value;
- ctx->uid_set[3] = sequencer_v1;
- sequencer_v1 += 0x100;
-
- } else {
- if (conf->service == NGX_CONF_UNSET) {
-
- c = r->connection;
-
- if (ngx_connection_local_sockaddr(c, NULL, 0) != NGX_OK) {
- return NGX_ERROR;
- }
-
- switch (c->local_sockaddr->sa_family) {
-
-#if (NGX_HAVE_INET6)
- case AF_INET6:
- sin6 = (struct sockaddr_in6 *) c->local_sockaddr;
-
- p = (u_char *) &ctx->uid_set[0];
-
- *p++ = sin6->sin6_addr.s6_addr[12];
- *p++ = sin6->sin6_addr.s6_addr[13];
- *p++ = sin6->sin6_addr.s6_addr[14];
- *p = sin6->sin6_addr.s6_addr[15];
-
- break;
-#endif
- default: /* AF_INET */
- sin = (struct sockaddr_in *) c->local_sockaddr;
- ctx->uid_set[0] = sin->sin_addr.s_addr;
- break;
- }
-
- } else {
- ctx->uid_set[0] = htonl(conf->service);
- }
-
- ctx->uid_set[1] = htonl((uint32_t) ngx_time());
- ctx->uid_set[2] = htonl(start_value);
- ctx->uid_set[3] = htonl(sequencer_v2);
- sequencer_v2 += 0x100;
- if (sequencer_v2 < 0x03030302) {
- sequencer_v2 = 0x03030302;
- }
- }
-
- return NGX_OK;
-}
-
-
-static ngx_int_t
ngx_http_userid_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
ngx_str_t *name, uint32_t *uid)
{
@@ -570,14 +545,14 @@
{
ngx_http_variable_t *var;
- var = ngx_http_add_variable(cf, &ngx_http_userid_got, 0);
+ var = ngx_http_add_variable(cf, &ngx_http_userid_got, NGX_HTTP_VAR_NOHASH);
if (var == NULL) {
return NGX_ERROR;
}
var->get_handler = ngx_http_userid_got_variable;
- var = ngx_http_add_variable(cf, &ngx_http_userid_set, 0);
+ var = ngx_http_add_variable(cf, &ngx_http_userid_set, NGX_HTTP_VAR_NOHASH);
if (var == NULL) {
return NGX_ERROR;
}
@@ -601,10 +576,14 @@
/*
* set by ngx_pcalloc():
*
- * conf->name = { 0, NULL };
- * conf->domain = { 0, NULL };
- * conf->path = { 0, NULL };
- * conf->p3p = { 0, NULL };
+ * conf->name.len = 0;
+ * conf->name.date = NULL;
+ * conf->domain.len = 0;
+ * conf->domain.date = NULL;
+ * conf->path.len = 0;
+ * conf->path.date = NULL;
+ * conf->p3p.len = 0;
+ * conf->p3p.date = NULL;
*/
conf->enable = NGX_CONF_UNSET_UINT;
@@ -663,7 +642,9 @@
u_char *p, *new;
if (ngx_strcmp(domain->data, "none") == 0) {
- ngx_str_set(domain, "");
+ domain->len = 0;
+ domain->data = (u_char *) "";
+
return NGX_CONF_OK;
}
@@ -746,7 +727,8 @@
ngx_str_t *p3p = data;
if (ngx_strcmp(p3p->data, "none") == 0) {
- ngx_str_set(p3p, "");
+ p3p->len = 0;
+ p3p->data = (u_char *) "";
}
return NGX_CONF_OK;
@@ -798,3 +780,4 @@
return NGX_OK;
}
+
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/ngx_http_xslt_filter_module.c
^
|
@@ -54,6 +54,7 @@
typedef struct {
xmlDocPtr doc;
xmlParserCtxtPtr ctxt;
+ xmlSAXHandler *sax;
ngx_http_request_t *request;
ngx_array_t params;
@@ -67,8 +68,49 @@
ngx_http_xslt_filter_ctx_t *ctx, ngx_buf_t *b);
+static void ngx_http_xslt_sax_start_document(void *data);
+static void ngx_http_xslt_sax_end_document(void *data);
+static void ngx_http_xslt_sax_internal_subset(void *data, const xmlChar *name,
+ const xmlChar *externalId, const xmlChar *systemId);
static void ngx_http_xslt_sax_external_subset(void *data, const xmlChar *name,
const xmlChar *externalId, const xmlChar *systemId);
+static void ngx_http_xslt_sax_entity_decl(void *data, const xmlChar *name,
+ int type, const xmlChar *publicId, const xmlChar *systemId,
+ xmlChar *content);
+static void ngx_http_xslt_sax_attribute_decl(void *data, const xmlChar *elem,
+ const xmlChar *fullname, int type, int def, const xmlChar *defaultValue,
+ xmlEnumerationPtr tree);
+static void ngx_http_xslt_sax_element_decl(void *data, const xmlChar * name,
+ int type, xmlElementContentPtr content);
+static void ngx_http_xslt_sax_notation_decl(void *data, const xmlChar *name,
+ const xmlChar *publicId, const xmlChar *systemId);
+static void ngx_http_xslt_sax_unparsed_entity_decl(void *data,
+ const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId,
+ const xmlChar *notationName);
+static void ngx_http_xslt_sax_start_element(void *data,
+ const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI,
+ int nb_namespaces, const xmlChar **namespaces, int nb_attributes,
+ int nb_defaulted, const xmlChar **attributes);
+static void ngx_http_xslt_sax_end_element(void *data,
+ const xmlChar * localname ATTRIBUTE_UNUSED,
+ const xmlChar * prefix ATTRIBUTE_UNUSED,
+ const xmlChar * URI ATTRIBUTE_UNUSED);
+static void ngx_http_xslt_sax_characters(void *data, const xmlChar *p, int len);
+static void ngx_http_xslt_sax_cdata_block(void *data, const xmlChar *p,
+ int len);
+static xmlEntityPtr ngx_http_xslt_sax_get_entity(void *data,
+ const xmlChar *name);
+static xmlEntityPtr ngx_http_xslt_sax_get_parameter_entity(void *data,
+ const xmlChar *name);
+static xmlParserInputPtr ngx_http_xslt_sax_resolve_entity(void *data,
+ const xmlChar *publicId, const xmlChar *systemId);
+static void ngx_http_xslt_sax_reference(void *data, const xmlChar *name);
+static void ngx_http_xslt_sax_comment(void *data, const xmlChar *value);
+static void ngx_http_xslt_sax_processing_instruction(void *data,
+ const xmlChar *target, const xmlChar *pidata);
+static int ngx_http_xslt_sax_is_standalone(void *data);
+static int ngx_http_xslt_sax_has_internal_subset(void *data);
+static int ngx_http_xslt_sax_has_external_subset(void *data);
static void ngx_cdecl ngx_http_xslt_sax_error(void *data, const char *msg, ...);
@@ -226,7 +268,7 @@
if (ngx_http_xslt_add_chunk(r, ctx, cl->buf) != NGX_OK) {
- if (ctx->ctxt->myDoc) {
+ if (ctx->ctxt->myDoc){
#if (NGX_HTTP_XSLT_REUSE_DTD)
ctx->ctxt->myDoc->extSubset = NULL;
@@ -324,8 +366,9 @@
ngx_http_xslt_add_chunk(ngx_http_request_t *r, ngx_http_xslt_filter_ctx_t *ctx,
ngx_buf_t *b)
{
- int err;
- xmlParserCtxtPtr ctxt;
+ int err;
+ xmlSAXHandler *sax;
+ xmlParserCtxtPtr ctxt;
if (ctx->ctxt == NULL) {
@@ -336,12 +379,50 @@
return NGX_ERROR;
}
- ctxt->sax->externalSubset = ngx_http_xslt_sax_external_subset;
- ctxt->sax->setDocumentLocator = NULL;
- ctxt->sax->warning = NULL;
- ctxt->sax->error = ngx_http_xslt_sax_error;
- ctxt->sax->fatalError = ngx_http_xslt_sax_error;
- ctxt->sax->_private = ctx;
+ ctx->sax = ngx_palloc(r->pool, sizeof(xmlSAXHandler));
+ if (ctx->sax == NULL) {
+ return NGX_ERROR;
+ }
+
+ sax = ctxt->sax;
+
+ ngx_memcpy(ctx->sax, sax, sizeof(xmlSAXHandler));
+
+ sax->startDocument = ngx_http_xslt_sax_start_document;
+ sax->endDocument = ngx_http_xslt_sax_end_document;
+
+ sax->internalSubset = ngx_http_xslt_sax_internal_subset;
+ sax->externalSubset = ngx_http_xslt_sax_external_subset;
+ sax->entityDecl = ngx_http_xslt_sax_entity_decl;
+ sax->attributeDecl = ngx_http_xslt_sax_attribute_decl;
+ sax->elementDecl = ngx_http_xslt_sax_element_decl;
+ sax->notationDecl = ngx_http_xslt_sax_notation_decl;
+ sax->unparsedEntityDecl = ngx_http_xslt_sax_unparsed_entity_decl;
+ sax->setDocumentLocator = NULL;
+
+ sax->startElementNs = ngx_http_xslt_sax_start_element;
+ sax->endElementNs = ngx_http_xslt_sax_end_element;
+
+ sax->characters = 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;
+ sax->getParameterEntity = ngx_http_xslt_sax_get_parameter_entity;
+ sax->reference = ngx_http_xslt_sax_reference;
+ sax->comment = ngx_http_xslt_sax_comment;
+ sax->processingInstruction = ngx_http_xslt_sax_processing_instruction;
+
+ sax->isStandalone = ngx_http_xslt_sax_is_standalone;
+ sax->hasInternalSubset = ngx_http_xslt_sax_has_internal_subset;
+ sax->hasExternalSubset = ngx_http_xslt_sax_has_external_subset;
+
+ sax->warning = NULL;
+ sax->error = ngx_http_xslt_sax_error;
+ sax->fatalError = ngx_http_xslt_sax_error;
+
+ ctxt->userData = ctx;
+
ctxt->replaceEntities = 1;
ctxt->loadsubset = 1;
@@ -365,18 +446,44 @@
static void
+ngx_http_xslt_sax_start_document(void *data)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ ctx->sax->startDocument(ctx->ctxt);
+}
+
+
+static void
+ngx_http_xslt_sax_end_document(void *data)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ ctx->sax->endDocument(ctx->ctxt);
+}
+
+
+static void
+ngx_http_xslt_sax_internal_subset(void *data, const xmlChar *name,
+ const xmlChar *externalId, const xmlChar *systemId)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ ctx->sax->internalSubset(ctx->ctxt, name, externalId, systemId);
+}
+
+
+static void
ngx_http_xslt_sax_external_subset(void *data, const xmlChar *name,
const xmlChar *externalId, const xmlChar *systemId)
{
- xmlParserCtxtPtr ctxt = data;
+ ngx_http_xslt_filter_ctx_t *ctx = data;
xmlDocPtr doc;
xmlDtdPtr dtd;
ngx_http_request_t *r;
- ngx_http_xslt_filter_ctx_t *ctx;
ngx_http_xslt_filter_loc_conf_t *conf;
- ctx = ctxt->sax->_private;
r = ctx->request;
conf = ngx_http_get_module_loc_conf(r, ngx_http_xslt_filter_module);
@@ -387,7 +494,7 @@
externalId ? externalId : (xmlChar *) "",
systemId ? systemId : (xmlChar *) "");
- doc = ctxt->myDoc;
+ doc = ctx->ctxt->myDoc;
#if (NGX_HTTP_XSLT_REUSE_DTD)
@@ -415,17 +522,194 @@
}
+static void
+ngx_http_xslt_sax_entity_decl(void *data, const xmlChar *name, int type,
+ const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ ctx->sax->entityDecl(ctx->ctxt, name, type, publicId, systemId, content);
+}
+
+
+static void
+ngx_http_xslt_sax_attribute_decl(void *data, const xmlChar *elem,
+ const xmlChar *fullname, int type, int def, const xmlChar *defaultValue,
+ xmlEnumerationPtr tree)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ ctx->sax->attributeDecl(ctx->ctxt, elem, fullname, type, def, defaultValue,
+ tree);
+}
+
+
+static void
+ngx_http_xslt_sax_element_decl(void *data, const xmlChar * name, int type,
+ xmlElementContentPtr content)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ ctx->sax->elementDecl(ctx->ctxt, name, type, content);
+}
+
+
+static void
+ngx_http_xslt_sax_notation_decl(void *data, const xmlChar *name,
+ const xmlChar *publicId, const xmlChar *systemId)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ ctx->sax->notationDecl(ctx->ctxt, name, publicId, systemId);
+}
+
+
+static void
+ngx_http_xslt_sax_unparsed_entity_decl(void *data, const xmlChar *name,
+ const xmlChar *publicId, const xmlChar *systemId,
+ const xmlChar *notationName)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ ctx->sax->unparsedEntityDecl(ctx->ctxt, name, publicId, systemId,
+ notationName);
+}
+
+
+static void
+ngx_http_xslt_sax_start_element(void *data, const xmlChar *localname,
+ const xmlChar *prefix, const xmlChar *URI, int nb_namespaces,
+ const xmlChar **namespaces, int nb_attributes, int nb_defaulted,
+ const xmlChar **attributes)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ ctx->sax->startElementNs(ctx->ctxt, localname, prefix, URI, nb_namespaces,
+ namespaces, nb_attributes, nb_defaulted, attributes);
+}
+
+
+static void
+ngx_http_xslt_sax_end_element(void *data,
+ const xmlChar * localname ATTRIBUTE_UNUSED,
+ const xmlChar * prefix ATTRIBUTE_UNUSED,
+ const xmlChar * URI ATTRIBUTE_UNUSED)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ ctx->sax->endElementNs(ctx->ctxt, localname, prefix, URI);
+}
+
+
+static void
+ngx_http_xslt_sax_characters(void *data, const xmlChar *p, int len)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ ctx->sax->characters(ctx->ctxt, p, len);
+}
+
+
+static void
+ngx_http_xslt_sax_cdata_block(void *data, const xmlChar *p, int len)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ ctx->sax->cdataBlock(ctx->ctxt, p, len);
+}
+
+
+static xmlEntityPtr
+ngx_http_xslt_sax_get_entity(void *data, const xmlChar *name)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ return ctx->sax->getEntity(ctx->ctxt, name);
+}
+
+
+static xmlEntityPtr
+ngx_http_xslt_sax_get_parameter_entity(void *data, const xmlChar *name)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ return ctx->sax->getParameterEntity(ctx->ctxt, name);
+}
+
+
+static xmlParserInputPtr
+ngx_http_xslt_sax_resolve_entity(void *data, const xmlChar *publicId,
+ const xmlChar *systemId)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ return ctx->sax->resolveEntity(ctx->ctxt, publicId, systemId);
+}
+
+
+static void
+ngx_http_xslt_sax_reference(void *data, const xmlChar *name)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ ctx->sax->reference(ctx->ctxt, name);
+}
+
+
+static void
+ngx_http_xslt_sax_comment(void *data, const xmlChar *value)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ ctx->sax->comment(ctx->ctxt, value);
+}
+
+
+static void
+ngx_http_xslt_sax_processing_instruction(void *data, const xmlChar *target,
+ const xmlChar *pidata)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ ctx->sax->processingInstruction(ctx->ctxt, target, pidata);
+}
+
+
+static int
+ngx_http_xslt_sax_is_standalone(void *data)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ return ctx->sax->isStandalone(ctx->ctxt);
+}
+
+
+static int
+ngx_http_xslt_sax_has_internal_subset(void *data)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ return ctx->sax->hasInternalSubset(ctx->ctxt);
+}
+
+
+static int
+ngx_http_xslt_sax_has_external_subset(void *data)
+{
+ ngx_http_xslt_filter_ctx_t *ctx = data;
+
+ return ctx->sax->hasExternalSubset(ctx->ctxt);
+}
+
+
static void ngx_cdecl
ngx_http_xslt_sax_error(void *data, const char *msg, ...)
{
- xmlParserCtxtPtr ctxt = data;
-
- size_t n;
- va_list args;
- ngx_http_xslt_filter_ctx_t *ctx;
- u_char buf[NGX_MAX_ERROR_STR];
+ ngx_http_xslt_filter_ctx_t *ctx = data;
- ctx = ctxt->sax->_private;
+ size_t n;
+ va_list args;
+ u_char buf[NGX_MAX_ERROR_STR];
buf[0] = '\0';
@@ -553,7 +837,8 @@
} else if (doc_type == XML_HTML_DOCUMENT_NODE) {
r->headers_out.content_type_len = sizeof("text/html") - 1;
- ngx_str_set(&r->headers_out.content_type, "text/html");
+ r->headers_out.content_type.len = sizeof("text/html") - 1;
+ r->headers_out.content_type.data = (u_char *) "text/html";
}
r->headers_out.content_type_lowcase = NULL;
@@ -859,6 +1144,7 @@
if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
return NGX_CONF_ERROR;
}
+
}
return NGX_CONF_OK;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/perl/nginx.pm
^
|
@@ -14,7 +14,6 @@
HTTP_OK
HTTP_CREATED
- HTTP_ACCEPTED
HTTP_NO_CONTENT
HTTP_PARTIAL_CONTENT
@@ -48,7 +47,7 @@
HTTP_INSUFFICIENT_STORAGE
);
-our $VERSION = '0.8.52';
+our $VERSION = '0.8.29';
require XSLoader;
XSLoader::load('nginx', $VERSION);
@@ -60,7 +59,6 @@
use constant HTTP_OK => 200;
use constant HTTP_CREATED => 201;
-use constant HTTP_ACCEPTED => 202;
use constant HTTP_NO_CONTENT => 204;
use constant HTTP_PARTIAL_CONTENT => 206;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/perl/nginx.xs
^
|
@@ -848,7 +848,7 @@
#endif
- vv = ngx_http_get_variable(r, &var, hash);
+ vv = ngx_http_get_variable(r, &var, hash, 1);
if (vv == NULL) {
XSRETURN_UNDEF;
}
@@ -944,7 +944,6 @@
ngx_add_timer(r->connection->write, sleep);
r->write_event_handler = ngx_http_perl_sleep_handler;
- r->main->count++;
void
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/modules/perl/ngx_http_perl_module.c
^
|
@@ -30,6 +30,12 @@
} 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);
@@ -168,6 +174,10 @@
static ngx_int_t
ngx_http_perl_handler(ngx_http_request_t *r)
{
+ if (r->zero_in_uri) {
+ return NGX_HTTP_NOT_FOUND;
+ }
+
r->main->count++;
ngx_http_perl_handle_request(r);
@@ -477,7 +487,8 @@
return NGX_CONF_ERROR;
}
- ngx_str_set(m, NGX_PERL_MODULES);
+ m->len = sizeof(NGX_PERL_MODULES) - 1;
+ m->data = NGX_PERL_MODULES;
}
#endif
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/ngx_http.c
^
|
@@ -26,9 +26,6 @@
static ngx_int_t ngx_http_add_server(ngx_conf_t *cf,
ngx_http_core_srv_conf_t *cscf, ngx_http_conf_addr_t *addr);
-static char *ngx_http_merge_servers(ngx_conf_t *cf,
- ngx_http_core_main_conf_t *cmcf, ngx_http_module_t *module,
- ngx_uint_t ctx_index);
static char *ngx_http_merge_locations(ngx_conf_t *cf,
ngx_queue_t *locations, void **loc_conf, ngx_http_module_t *module,
ngx_uint_t ctx_index);
@@ -266,9 +263,39 @@
}
}
- rv = ngx_http_merge_servers(cf, cmcf, module, mi);
- if (rv != NGX_CONF_OK) {
- goto failed;
+ for (s = 0; s < cmcf->servers.nelts; s++) {
+
+ /* merge the server{}s' srv_conf's */
+
+ if (module->merge_srv_conf) {
+ rv = module->merge_srv_conf(cf, ctx->srv_conf[mi],
+ cscfp[s]->ctx->srv_conf[mi]);
+ if (rv != NGX_CONF_OK) {
+ goto failed;
+ }
+ }
+
+ if (module->merge_loc_conf) {
+
+ /* merge the server{}'s loc_conf */
+
+ rv = module->merge_loc_conf(cf, ctx->loc_conf[mi],
+ cscfp[s]->ctx->loc_conf[mi]);
+ if (rv != NGX_CONF_OK) {
+ goto failed;
+ }
+
+ /* merge the locations{}' loc_conf's */
+
+ clcf = cscfp[s]->ctx->loc_conf[ngx_http_core_module.ctx_index];
+
+ rv = ngx_http_merge_locations(cf, clcf->locations,
+ cscfp[s]->ctx->loc_conf,
+ module, mi);
+ if (rv != NGX_CONF_OK) {
+ goto failed;
+ }
+ }
}
}
@@ -482,7 +509,7 @@
if (cmcf->phase_engine.server_rewrite_index == (ngx_uint_t) -1) {
cmcf->phase_engine.server_rewrite_index = n;
}
- checker = ngx_http_core_rewrite_phase;
+ checker = ngx_http_core_generic_phase;
break;
@@ -499,7 +526,7 @@
if (cmcf->phase_engine.location_rewrite_index == (ngx_uint_t) -1) {
cmcf->phase_engine.location_rewrite_index = n;
}
- checker = ngx_http_core_rewrite_phase;
+ checker = ngx_http_core_generic_phase;
break;
@@ -559,74 +586,11 @@
static char *
-ngx_http_merge_servers(ngx_conf_t *cf, ngx_http_core_main_conf_t *cmcf,
- ngx_http_module_t *module, ngx_uint_t ctx_index)
-{
- char *rv;
- ngx_uint_t s;
- ngx_http_conf_ctx_t *ctx, saved;
- ngx_http_core_loc_conf_t *clcf;
- ngx_http_core_srv_conf_t **cscfp;
-
- cscfp = cmcf->servers.elts;
- ctx = (ngx_http_conf_ctx_t *) cf->ctx;
- saved = *ctx;
- rv = NGX_CONF_OK;
-
- for (s = 0; s < cmcf->servers.nelts; s++) {
-
- /* merge the server{}s' srv_conf's */
-
- ctx->srv_conf = cscfp[s]->ctx->srv_conf;
-
- if (module->merge_srv_conf) {
- rv = module->merge_srv_conf(cf, saved.srv_conf[ctx_index],
- cscfp[s]->ctx->srv_conf[ctx_index]);
- if (rv != NGX_CONF_OK) {
- goto failed;
- }
- }
-
- if (module->merge_loc_conf) {
-
- /* merge the server{}'s loc_conf */
-
- ctx->loc_conf = cscfp[s]->ctx->loc_conf;
-
- rv = module->merge_loc_conf(cf, saved.loc_conf[ctx_index],
- cscfp[s]->ctx->loc_conf[ctx_index]);
- if (rv != NGX_CONF_OK) {
- goto failed;
- }
-
- /* merge the locations{}' loc_conf's */
-
- clcf = cscfp[s]->ctx->loc_conf[ngx_http_core_module.ctx_index];
-
- rv = ngx_http_merge_locations(cf, clcf->locations,
- cscfp[s]->ctx->loc_conf,
- module, ctx_index);
- if (rv != NGX_CONF_OK) {
- goto failed;
- }
- }
- }
-
-failed:
-
- *ctx = saved;
-
- return rv;
-}
-
-
-static char *
ngx_http_merge_locations(ngx_conf_t *cf, ngx_queue_t *locations,
void **loc_conf, ngx_http_module_t *module, ngx_uint_t ctx_index)
{
char *rv;
ngx_queue_t *q;
- ngx_http_conf_ctx_t *ctx, saved;
ngx_http_core_loc_conf_t *clcf;
ngx_http_location_queue_t *lq;
@@ -634,9 +598,6 @@
return NGX_CONF_OK;
}
- ctx = (ngx_http_conf_ctx_t *) cf->ctx;
- saved = *ctx;
-
for (q = ngx_queue_head(locations);
q != ngx_queue_sentinel(locations);
q = ngx_queue_next(q))
@@ -644,7 +605,6 @@
lq = (ngx_http_location_queue_t *) q;
clcf = lq->exact ? lq->exact : lq->inclusive;
- ctx->loc_conf = clcf->loc_conf;
rv = module->merge_loc_conf(cf, loc_conf[ctx_index],
clcf->loc_conf[ctx_index]);
@@ -659,8 +619,6 @@
}
}
- *ctx = saved;
-
return NGX_CONF_OK;
}
@@ -1159,13 +1117,13 @@
}
}
- sa = &lsopt->u.sockaddr;
+ sa = (struct sockaddr *) &lsopt->sockaddr;
switch (sa->sa_family) {
#if (NGX_HAVE_INET6)
case AF_INET6:
- sin6 = &lsopt->u.sockaddr_in6;
+ sin6 = (struct sockaddr_in6 *) sa;
p = sin6->sin6_port;
break;
#endif
@@ -1177,7 +1135,7 @@
#endif
default: /* AF_INET */
- sin = &lsopt->u.sockaddr_in;
+ sin = (struct sockaddr_in *) sa;
p = sin->sin_port;
break;
}
@@ -1221,16 +1179,13 @@
#if (NGX_HAVE_UNIX_DOMAIN)
struct sockaddr_un *saun;
#endif
-#if (NGX_HTTP_SSL)
- ngx_uint_t ssl;
-#endif
/*
* we can not compare whole sockaddr struct's as kernel
* may fill some fields in inherited sockaddr struct's
*/
- sa = &lsopt->u.sockaddr;
+ sa = (struct sockaddr *) &lsopt->sockaddr;
switch (sa->sa_family) {
@@ -1254,13 +1209,13 @@
break;
}
- p = lsopt->u.sockaddr_data + off;
+ p = lsopt->sockaddr + off;
addr = port->addrs.elts;
for (i = 0; i < port->addrs.nelts; i++) {
- if (ngx_memcmp(p, addr[i].opt.u.sockaddr_data + off, len) != 0) {
+ if (ngx_memcmp(p, (u_char *) addr[i].opt.sockaddr + off, len) != 0) {
continue;
}
@@ -1273,10 +1228,6 @@
/* preserve default_server bit during listen options overwriting */
default_server = addr[i].opt.default_server;
-#if (NGX_HTTP_SSL)
- ssl = lsopt->ssl || addr[i].opt.ssl;
-#endif
-
if (lsopt->set) {
if (addr[i].opt.set) {
@@ -1303,9 +1254,6 @@
}
addr[i].opt.default_server = default_server;
-#if (NGX_HTTP_SSL)
- addr[i].opt.ssl = ssl;
-#endif
return NGX_OK;
}
@@ -1726,7 +1674,7 @@
ngx_http_core_loc_conf_t *clcf;
ngx_http_core_srv_conf_t *cscf;
- ls = ngx_create_listening(cf, &addr->opt.u.sockaddr, addr->opt.socklen);
+ ls = ngx_create_listening(cf, addr->opt.sockaddr, addr->opt.socklen);
if (ls == NULL) {
return NULL;
}
@@ -1772,10 +1720,6 @@
ls->ipv6only = addr->opt.ipv6only;
#endif
-#if (NGX_HAVE_SETFIB)
- ls->setfib = addr->opt.setfib;
-#endif
-
return ls;
}
@@ -1799,7 +1743,7 @@
for (i = 0; i < hport->naddrs; i++) {
- sin = &addr[i].opt.u.sockaddr_in;
+ sin = (struct sockaddr_in *) addr[i].opt.sockaddr;
addrs[i].addr = sin->sin_addr.s_addr;
addrs[i].conf.default_server = addr[i].default_server;
#if (NGX_HTTP_SSL)
@@ -1860,7 +1804,7 @@
for (i = 0; i < hport->naddrs; i++) {
- sin6 = &addr[i].opt.u.sockaddr_in6;
+ sin6 = (struct sockaddr_in6 *) addr[i].opt.sockaddr;
addrs6[i].addr6 = sin6->sin6_addr;
addrs6[i].conf.default_server = addr[i].default_server;
#if (NGX_HTTP_SSL)
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/ngx_http.h
^
|
@@ -51,14 +51,6 @@
};
-typedef struct {
- ngx_uint_t code;
- ngx_uint_t count;
- u_char *start;
- u_char *end;
-} ngx_http_status_t;
-
-
#define ngx_http_get_module_ctx(r, module) (r)->ctx[module.ctx_index]
#define ngx_http_set_ctx(r, c, module) r->ctx[module.ctx_index] = c;
@@ -78,8 +70,6 @@
ngx_int_t ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b);
ngx_int_t ngx_http_parse_complex_uri(ngx_http_request_t *r,
ngx_uint_t merge_slashes);
-ngx_int_t ngx_http_parse_status_line(ngx_http_request_t *r, ngx_buf_t *b,
- ngx_http_status_t *status);
ngx_int_t ngx_http_parse_unsafe_uri(ngx_http_request_t *r, ngx_str_t *uri,
ngx_str_t *args, ngx_uint_t *flags);
ngx_int_t ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b,
@@ -104,7 +94,7 @@
void ngx_http_request_empty_handler(ngx_http_request_t *r);
-#define ngx_http_ephemeral(r) (void *) (&r->uri_start)
+#define ngx_http_ephemeral(r) (ngx_http_ephemeral_t *) (&r->uri_start)
#define NGX_HTTP_LAST 1
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/ngx_http_cache.h
^
|
@@ -14,12 +14,11 @@
#define NGX_HTTP_CACHE_MISS 1
-#define NGX_HTTP_CACHE_BYPASS 2
-#define NGX_HTTP_CACHE_EXPIRED 3
-#define NGX_HTTP_CACHE_STALE 4
-#define NGX_HTTP_CACHE_UPDATING 5
-#define NGX_HTTP_CACHE_HIT 6
-#define NGX_HTTP_CACHE_SCARCE 7
+#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_SCARCE 6
#define NGX_HTTP_CACHE_KEY_LEN 16
@@ -43,8 +42,7 @@
unsigned error:10;
unsigned exists:1;
unsigned updating:1;
- unsigned deleting:1;
- /* 11 unused bits */
+ /* 12 unused bits */
ngx_file_uniq_t uniq;
time_t expire;
@@ -79,7 +77,6 @@
ngx_http_file_cache_node_t *node;
unsigned updated:1;
- unsigned updating:1;
unsigned exists:1;
unsigned temp_file:1;
};
@@ -124,14 +121,12 @@
};
-ngx_int_t ngx_http_file_cache_new(ngx_http_request_t *r);
-ngx_int_t ngx_http_file_cache_create(ngx_http_request_t *r);
void ngx_http_file_cache_create_key(ngx_http_request_t *r);
ngx_int_t ngx_http_file_cache_open(ngx_http_request_t *r);
void ngx_http_file_cache_set_header(ngx_http_request_t *r, u_char *buf);
void ngx_http_file_cache_update(ngx_http_request_t *r, ngx_temp_file_t *tf);
ngx_int_t ngx_http_cache_send(ngx_http_request_t *);
-void ngx_http_file_cache_free(ngx_http_cache_t *c, ngx_temp_file_t *tf);
+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,
@@ -139,7 +134,6 @@
char *ngx_http_file_cache_valid_set_slot(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
-
extern ngx_str_t ngx_http_cache_status[];
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/ngx_http_config.h
^
|
@@ -56,6 +56,10 @@
#define ngx_http_get_module_srv_conf(r, module) (r)->srv_conf[module.ctx_index]
#define ngx_http_get_module_loc_conf(r, module) (r)->loc_conf[module.ctx_index]
+/*
+ * ngx_http_conf_get_module_srv_conf() and ngx_http_conf_get_module_loc_conf()
+ * must not be used at the merge phase because cf->ctx points to http{}'s ctx
+ */
#define ngx_http_conf_get_module_main_conf(cf, module) \
((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/ngx_http_copy_filter_module.c
^
|
@@ -126,9 +126,7 @@
}
#endif
- if (in && in->buf && ngx_buf_size(in->buf)) {
- r->request_output = 1;
- }
+ r->request_output = 1;
}
#if (NGX_HAVE_FILE_AIO)
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/ngx_http_core_module.c
^
|
@@ -599,13 +599,6 @@
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,
@@ -790,24 +783,14 @@
break;
}
- if (r->keepalive) {
+ if (r->keepalive && r->headers_in.msie && r->method == NGX_HTTP_POST) {
- 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;
- }
+ /*
+ * MSIE may wait for some time if an response for
+ * a POST request was sent over a keepalive connection
+ */
- } 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;
- }
+ r->keepalive = 0;
}
if (r->headers_in.content_length_n > 0) {
@@ -824,6 +807,10 @@
r->phase_handler = cmcf->phase_engine.server_rewrite_index;
}
+ if (r->unparsed_uri.len) {
+ r->valid_unparsed_uri = 1;
+ }
+
r->valid_location = 1;
#if (NGX_HTTP_GZIP)
r->gzip_tested = 0;
@@ -865,7 +852,7 @@
/*
* generic phase checker,
- * used by the post read and pre-access phases
+ * used by the post read, server rewrite, rewrite, and pre-access phases
*/
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
@@ -896,29 +883,6 @@
ngx_int_t
-ngx_http_core_rewrite_phase(ngx_http_request_t *r, ngx_http_phase_handler_t *ph)
-{
- ngx_int_t rc;
-
- ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "rewrite phase: %ui", r->phase_handler);
-
- rc = ph->handler(r);
-
- if (rc == NGX_DECLINED) {
- r->phase_handler++;
- return NGX_AGAIN;
- }
-
- /* rc == NGX_OK || rc == NGX_ERROR || rc == NGX_HTTP_... */
-
- ngx_http_finalize_request(r, rc);
-
- return NGX_OK;
-}
-
-
-ngx_int_t
ngx_http_core_find_config_phase(ngx_http_request_t *r,
ngx_http_phase_handler_t *ph)
{
@@ -1171,7 +1135,7 @@
tf = clcf->try_files;
- alias = clcf->alias;
+ alias = clcf->alias ? clcf->name.len : 0;
for ( ;; ) {
@@ -1241,9 +1205,8 @@
tf++;
- ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "try to use %s: \"%s\" \"%s\"",
- test_dir ? "dir" : "file", name, path.data);
+ ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+ "try to use file: \"%s\" \"%s\"", name, path.data);
if (tf->lengths == NULL && tf->name.len == 0) {
@@ -1301,13 +1264,6 @@
if (!alias) {
r->uri = path;
-#if (NGX_PCRE)
- } else if (clcf->regex) {
- if (!test_dir) {
- r->uri = path;
- r->add_uri_to_alias = 1;
- }
-#endif
} else {
r->uri.len = alias + path.len;
r->uri.data = ngx_pnalloc(r->pool, r->uri.len);
@@ -1368,7 +1324,7 @@
/* no content handler was found */
- if (r->uri.data[r->uri.len - 1] == '/') {
+ if (r->uri.data[r->uri.len - 1] == '/' && !r->zero_in_uri) {
if (ngx_http_map_uri_to_path(r, &path, &root, 0) != NULL) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
@@ -1590,14 +1546,9 @@
if (len == (size_t) node->len) {
- if (node->exact) {
- r->loc_conf = node->exact->loc_conf;
- return NGX_OK;
-
- } else {
- r->loc_conf = node->inclusive->loc_conf;
- return NGX_AGAIN;
- }
+ r->loc_conf = (node->exact) ? node->exact->loc_conf:
+ node->inclusive->loc_conf;
+ return NGX_OK;
}
/* len < node->len */
@@ -1717,7 +1668,8 @@
{
ngx_int_t i;
- ngx_str_null(&r->exten);
+ r->exten.len = 0;
+ r->exten.data = NULL;
for (i = r->uri.len - 1; i > 1; i--) {
if (r->uri.data[i] == '.' && r->uri.data[i - 1] != '/') {
@@ -1737,80 +1689,6 @@
ngx_int_t
-ngx_http_send_response(ngx_http_request_t *r, ngx_uint_t status,
- ngx_str_t *ct, ngx_http_complex_value_t *cv)
-{
- ngx_int_t rc;
- ngx_str_t val;
- ngx_buf_t *b;
- ngx_chain_t out;
-
- r->headers_out.status = status;
-
- if (status == NGX_HTTP_NO_CONTENT) {
- r->header_only = 1;
- return ngx_http_send_header(r);
- }
-
- if (ngx_http_complex_value(r, cv, &val) != NGX_OK) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
-
- if (status >= NGX_HTTP_MOVED_PERMANENTLY && status <= NGX_HTTP_SEE_OTHER) {
-
- r->headers_out.location = ngx_list_push(&r->headers_out.headers);
- if (r->headers_out.location == NULL) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
-
- r->headers_out.location->hash = 1;
- ngx_str_set(&r->headers_out.location->key, "Location");
- r->headers_out.location->value = val;
-
- return status;
- }
-
- r->headers_out.content_length_n = val.len;
-
- if (ct) {
- r->headers_out.content_type_len = ct->len;
- r->headers_out.content_type = *ct;
-
- } else {
- if (ngx_http_set_content_type(r) != NGX_OK) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
- }
-
- if (r->method == NGX_HTTP_HEAD || (r != r->main && val.len == 0)) {
- return ngx_http_send_header(r);
- }
-
- b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
- if (b == NULL) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
-
- b->pos = val.data;
- b->last = val.data + val.len;
- b->memory = val.len ? 1 : 0;
- b->last_buf = (r == r->main) ? 1 : 0;
- b->last_in_chain = 1;
-
- out.buf = b;
- out.next = NULL;
-
- rc = ngx_http_send_header(r);
-
- if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
- return rc;
- }
-
- return ngx_http_output_filter(r, &out);
-}
-
-
-ngx_int_t
ngx_http_send_header(ngx_http_request_t *r)
{
if (r->err_status) {
@@ -1854,7 +1732,7 @@
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
- alias = clcf->alias;
+ alias = clcf->alias ? clcf->name.len : 0;
if (alias && !r->valid_location) {
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
@@ -1882,9 +1760,7 @@
ngx_uint_t captures;
captures = alias && clcf->regex;
-
- reserved += captures ? r->add_uri_to_alias ? r->uri.len + 1 : 1
- : r->uri.len - alias + 1;
+ reserved += captures ? 1 : r->uri.len - alias + 1;
#else
reserved += r->uri.len - alias + 1;
#endif
@@ -1905,12 +1781,8 @@
#if (NGX_PCRE)
if (captures) {
- if (!r->add_uri_to_alias) {
- *last = '\0';
- return last;
- }
-
- alias = 0;
+ *last = '\0';
+ return last;
}
#endif
}
@@ -2152,7 +2024,6 @@
ngx_str_t *uri, ngx_str_t *args, ngx_http_request_t **psr,
ngx_http_post_subrequest_t *ps, ngx_uint_t flags)
{
- ngx_time_t *tp;
ngx_connection_t *c;
ngx_http_request_t *sr;
ngx_http_core_srv_conf_t *cscf;
@@ -2217,6 +2088,7 @@
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;
@@ -2265,10 +2137,6 @@
sr->uri_changes = NGX_HTTP_MAX_URI_CHANGES + 1;
- tp = ngx_timeofday();
- r->start_sec = tp->sec;
- r->start_msec = tp->msec;
-
r->main->subrequests++;
r->main->count++;
@@ -2302,7 +2170,8 @@
r->args = *args;
} else {
- ngx_str_null(&r->args);
+ r->args.len = 0;
+ r->args.data = NULL;
}
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
@@ -2323,7 +2192,6 @@
#endif
r->internal = 1;
- r->add_uri_to_alias = 0;
r->main->count++;
ngx_http_handler(r);
@@ -2720,8 +2588,6 @@
#if (NGX_HAVE_CASELESS_FILESYSTEM)
rc.options = NGX_REGEX_CASELESS;
-#else
- rc.options = caseless;
#endif
clcf->regex = ngx_http_regex_compile(cf, &rc);
@@ -2962,7 +2828,7 @@
prev->client_header_buffer_size, 1024);
ngx_conf_merge_bufs_value(conf->large_client_header_buffers,
prev->large_client_header_buffers,
- 4, 8192);
+ 4, ngx_pagesize);
if (conf->large_client_header_buffers.size < conf->connection_pool_size) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
@@ -2982,7 +2848,7 @@
if (!conf->listen) {
ngx_memzero(&lsopt, sizeof(ngx_http_listen_opt_t));
- sin = &lsopt.u.sockaddr_in;
+ sin = (struct sockaddr_in *) &lsopt.sockaddr;
sin->sin_family = AF_INET;
#if (NGX_WIN32)
@@ -2997,12 +2863,9 @@
lsopt.backlog = NGX_LISTEN_BACKLOG;
lsopt.rcvbuf = -1;
lsopt.sndbuf = -1;
-#if (NGX_HAVE_SETFIB)
- lsopt.setfib = -1;
-#endif
lsopt.wildcard = 1;
- (void) ngx_sock_ntop(&lsopt.u.sockaddr, lsopt.addr,
+ (void) ngx_sock_ntop((struct sockaddr *) &lsopt.sockaddr, lsopt.addr,
NGX_SOCKADDR_STRLEN, 1);
if (ngx_http_add_listen(cf, conf, &lsopt) == NGX_OK) {
@@ -3011,7 +2874,7 @@
}
if (conf->server_name.data == NULL) {
- ngx_str_set(&conf->server_name, "");
+ conf->server_name = cf->cycle->hostname;
sn = ngx_array_push(&conf->server_names);
if (sn == NULL) {
@@ -3022,7 +2885,8 @@
sn->regex = NULL;
#endif
sn->server = conf;
- ngx_str_set(&sn->name, "");
+ sn->name.len = conf->server_name.len;
+ sn->name.data = conf->server_name.data;
}
return NGX_CONF_OK;
@@ -3096,7 +2960,6 @@
clcf->log_subrequest = NGX_CONF_UNSET;
clcf->recursive_error_pages = NGX_CONF_UNSET;
clcf->server_tokens = NGX_CONF_UNSET;
- clcf->chunked_transfer_encoding = NGX_CONF_UNSET;
clcf->types_hash_max_size = NGX_CONF_UNSET_UINT;
clcf->types_hash_bucket_size = NGX_CONF_UNSET_UINT;
@@ -3111,9 +2974,9 @@
clcf->gzip_http_version = NGX_CONF_UNSET_UINT;
#if (NGX_PCRE)
clcf->gzip_disable = NGX_CONF_UNSET_PTR;
-#endif
clcf->gzip_disable_msie6 = 3;
#endif
+#endif
return clcf;
}
@@ -3149,7 +3012,8 @@
conf->root_values = prev->root_values;
if (prev->root.data == NULL) {
- ngx_str_set(&conf->root, "html");
+ conf->root.len = sizeof("html") - 1;
+ conf->root.data = (u_char *) "html";
if (ngx_conf_full_name(cf->cycle, &conf->root, 0) != NGX_OK) {
return NGX_CONF_ERROR;
@@ -3330,7 +3194,7 @@
ngx_conf_merge_value(conf->reset_timedout_connection,
prev->reset_timedout_connection, 0);
ngx_conf_merge_value(conf->server_name_in_redirect,
- prev->server_name_in_redirect, 0);
+ prev->server_name_in_redirect, 1);
ngx_conf_merge_value(conf->port_in_redirect, prev->port_in_redirect, 1);
ngx_conf_merge_value(conf->msie_padding, prev->msie_padding, 1);
ngx_conf_merge_value(conf->msie_refresh, prev->msie_refresh, 0);
@@ -3339,8 +3203,6 @@
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);
@@ -3411,18 +3273,15 @@
ngx_memzero(&lsopt, sizeof(ngx_http_listen_opt_t));
- ngx_memcpy(&lsopt.u.sockaddr, u.sockaddr, u.socklen);
+ ngx_memcpy(lsopt.sockaddr, u.sockaddr, u.socklen);
lsopt.socklen = u.socklen;
lsopt.backlog = NGX_LISTEN_BACKLOG;
lsopt.rcvbuf = -1;
lsopt.sndbuf = -1;
-#if (NGX_HAVE_SETFIB)
- lsopt.setfib = -1;
-#endif
lsopt.wildcard = u.wildcard;
- (void) ngx_sock_ntop(&lsopt.u.sockaddr, lsopt.addr,
+ (void) ngx_sock_ntop((struct sockaddr *) &lsopt.sockaddr, lsopt.addr,
NGX_SOCKADDR_STRLEN, 1);
for (n = 2; n < cf->args->nelts; n++) {
@@ -3440,19 +3299,6 @@
continue;
}
-#if (NGX_HAVE_SETFIB)
- if (ngx_strncmp(value[n].data, "setfib=", 7) == 0) {
- lsopt.setfib = ngx_atoi(value[n].data + 7, value[n].len - 7);
-
- if (lsopt.setfib == NGX_ERROR) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "invalid setfib \"%V\"", &value[n]);
- return NGX_CONF_ERROR;
- }
-
- continue;
- }
-#endif
if (ngx_strncmp(value[n].data, "backlog=", 8) == 0) {
lsopt.backlog = ngx_atoi(value[n].data + 8, value[n].len - 8);
lsopt.set = 1;
@@ -3532,7 +3378,7 @@
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
struct sockaddr *sa;
- sa = &lsopt.u.sockaddr;
+ sa = (struct sockaddr *) lsopt.sockaddr;
if (sa->sa_family == AF_INET6) {
@@ -3569,6 +3415,7 @@
if (ngx_strcmp(value[n].data, "ssl") == 0) {
#if (NGX_HTTP_SSL)
+ lsopt.set = 1;
lsopt.ssl = 1;
continue;
#else
@@ -3607,16 +3454,23 @@
ch = value[1].data[0];
if (cscf->server_name.data == NULL) {
- name = value[1];
+ if (value[1].len) {
+ name = value[1];
- if (ch == '.') {
- name.len--;
- name.data++;
- }
+ if (ch == '.') {
+ name.len--;
+ name.data++;
+ }
+
+ cscf->server_name.len = name.len;
+ cscf->server_name.data = ngx_pstrdup(cf->pool, &name);
+ if (cscf->server_name.data == NULL) {
+ return NGX_CONF_ERROR;
+ }
- cscf->server_name.len = name.len;
- cscf->server_name.data = ngx_pstrdup(cf->pool, &name);
- if (cscf->server_name.data == NULL) {
+ } else {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "the first server name must not be empty");
return NGX_CONF_ERROR;
}
}
@@ -3717,15 +3571,16 @@
ngx_http_core_loc_conf_t *clcf = conf;
ngx_str_t *value;
- ngx_int_t alias;
- ngx_uint_t n;
+ ngx_uint_t alias, n;
ngx_http_script_compile_t sc;
alias = (cmd->name.len == sizeof("alias") - 1) ? 1 : 0;
if (clcf->root.data) {
- if ((clcf->alias != 0) == alias) {
+ /* the (ngx_uint_t) cast is required by gcc 2.7.2.3 */
+
+ if ((ngx_uint_t) clcf->alias == alias) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"\"%V\" directive is duplicate",
&cmd->name);
@@ -3771,7 +3626,7 @@
return NGX_CONF_ERROR;
}
- clcf->alias = alias ? clcf->name.len : 0;
+ clcf->alias = alias;
clcf->root = value[1];
if (!alias && clcf->root.data[clcf->root.len - 1] == '/') {
@@ -3787,19 +3642,13 @@
n = ngx_http_script_variables_count(&clcf->root);
ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
- sc.variables = n;
-
-#if (NGX_PCRE)
- if (alias && clcf->regex) {
- n = 1;
- }
-#endif
if (n) {
sc.cf = cf;
sc.source = &clcf->root;
sc.lengths = &clcf->root_lengths;
sc.values = &clcf->root_values;
+ sc.variables = n;
sc.complete_lengths = 1;
sc.complete_values = 1;
@@ -3826,7 +3675,6 @@
{ (u_char *) "PROPPATCH", (uint32_t) ~NGX_HTTP_PROPPATCH },
{ (u_char *) "LOCK", (uint32_t) ~NGX_HTTP_LOCK },
{ (u_char *) "UNLOCK", (uint32_t) ~NGX_HTTP_UNLOCK },
- { (u_char *) "PATCH", (uint32_t) ~NGX_HTTP_PATCH },
{ NULL, 0 }
};
@@ -3913,7 +3761,6 @@
clcf->loc_conf = ctx->loc_conf;
clcf->name = pclcf->name;
clcf->noname = 1;
- clcf->lmt_excpt = 1;
if (ngx_http_add_location(cf, &pclcf->locations, clcf) != NGX_OK) {
return NGX_CONF_ERROR;
@@ -4022,7 +3869,8 @@
return NGX_CONF_ERROR;
}
- ngx_str_null(&args);
+ args.len = 0;
+ args.data = NULL;
if (cv.lengths == NULL && uri.data[0] == '/') {
p = (u_char *) ngx_strchr(uri.data, '?');
@@ -4050,9 +3898,9 @@
return NGX_CONF_ERROR;
}
- if (err->status < 300 || err->status > 599) {
+ if (err->status < 400 || err->status > 599) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "value \"%V\" must be between 300 and 599",
+ "value \"%V\" must be between 400 and 599",
&value[i]);
return NGX_CONF_ERROR;
}
@@ -4389,7 +4237,7 @@
for (i = 1; i < cf->args->nelts; i++) {
- if (ngx_strcmp(value[i].data, "msie6") == 0) {
+ if (ngx_strcmp(value[1].data, "msie6") == 0) {
clcf->gzip_disable_msie6 = 1;
continue;
}
@@ -4399,7 +4247,7 @@
return NGX_CONF_ERROR;
}
- rc.pattern = value[i];
+ rc.pattern = value[1];
rc.options = NGX_REGEX_CASELESS;
if (ngx_regex_compile(&rc) != NGX_OK) {
@@ -4470,15 +4318,8 @@
if (*sp < NGX_MIN_POOL_SIZE) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "the pool size must be no less than %uz",
- NGX_MIN_POOL_SIZE);
- return NGX_CONF_ERROR;
- }
+ "pool must be no less than %uz", NGX_MIN_POOL_SIZE);
- if (*sp % NGX_POOL_ALIGNMENT) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "the pool size must be a multiple of %uz",
- NGX_POOL_ALIGNMENT);
return NGX_CONF_ERROR;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/ngx_http_core_module.h
^
|
@@ -43,18 +43,7 @@
typedef struct {
- union {
- struct sockaddr sockaddr;
- struct sockaddr_in sockaddr_in;
-#if (NGX_HAVE_INET6)
- struct sockaddr_in6 sockaddr_in6;
-#endif
-#if (NGX_HAVE_UNIX_DOMAIN)
- struct sockaddr_un sockaddr_un;
-#endif
- u_char sockaddr_data[NGX_SOCKADDRLEN];
- } u;
-
+ u_char sockaddr[NGX_SOCKADDRLEN];
socklen_t socklen;
unsigned set:1;
@@ -71,9 +60,6 @@
int backlog;
int rcvbuf;
int sndbuf;
-#if (NGX_HAVE_SETFIB)
- int setfib;
-#endif
#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
char *accept_filter;
@@ -286,13 +272,13 @@
#endif
unsigned noname:1; /* "if () {}" block or limit_except */
- unsigned lmt_excpt:1;
unsigned named:1;
unsigned exact_match:1;
unsigned noregex:1;
unsigned auto_redirect:1;
+ unsigned alias:1;
#if (NGX_HTTP_GZIP)
unsigned gzip_disable_msie6:2;
#endif
@@ -310,8 +296,6 @@
ngx_http_handler_pt handler;
- /* location name length for inclusive location with inherited alias */
- size_t alias;
ngx_str_t root; /* root, alias */
ngx_str_t post_action;
@@ -368,7 +352,6 @@
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 */
@@ -433,8 +416,6 @@
void ngx_http_core_run_phases(ngx_http_request_t *r);
ngx_int_t ngx_http_core_generic_phase(ngx_http_request_t *r,
ngx_http_phase_handler_t *ph);
-ngx_int_t ngx_http_core_rewrite_phase(ngx_http_request_t *r,
- ngx_http_phase_handler_t *ph);
ngx_int_t ngx_http_core_find_config_phase(ngx_http_request_t *r,
ngx_http_phase_handler_t *ph);
ngx_int_t ngx_http_core_post_rewrite_phase(ngx_http_request_t *r,
@@ -452,8 +433,6 @@
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);
void ngx_http_set_exten(ngx_http_request_t *r);
-ngx_int_t ngx_http_send_response(ngx_http_request_t *r, ngx_uint_t status,
- ngx_str_t *ct, ngx_http_complex_value_t *cv);
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.8.29.tar.gz/src/http/ngx_http_file_cache.c
^
|
@@ -19,8 +19,6 @@
#endif
static ngx_int_t ngx_http_file_cache_exists(ngx_http_file_cache_t *cache,
ngx_http_cache_t *c);
-static ngx_int_t ngx_http_file_cache_name(ngx_http_request_t *r,
- ngx_path_t *path);
static ngx_http_file_cache_node_t *
ngx_http_file_cache_lookup(ngx_http_file_cache_t *cache, u_char *key);
static void ngx_http_file_cache_rbtree_insert_value(ngx_rbtree_node_t *temp,
@@ -46,7 +44,6 @@
ngx_str_t ngx_http_cache_status[] = {
ngx_string("MISS"),
- ngx_string("BYPASS"),
ngx_string("EXPIRED"),
ngx_string("STALE"),
ngx_string("UPDATING"),
@@ -145,60 +142,6 @@
}
-ngx_int_t
-ngx_http_file_cache_new(ngx_http_request_t *r)
-{
- ngx_http_cache_t *c;
-
- c = ngx_pcalloc(r->pool, sizeof(ngx_http_cache_t));
- if (c == NULL) {
- return NGX_ERROR;
- }
-
- if (ngx_array_init(&c->keys, r->pool, 4, sizeof(ngx_str_t)) != NGX_OK) {
- return NGX_ERROR;
- }
-
- r->cache = c;
- c->file.log = r->connection->log;
- c->file.fd = NGX_INVALID_FILE;
-
- return NGX_OK;
-}
-
-
-ngx_int_t
-ngx_http_file_cache_create(ngx_http_request_t *r)
-{
- ngx_http_cache_t *c;
- ngx_pool_cleanup_t *cln;
- ngx_http_file_cache_t *cache;
-
- ngx_http_file_cache_create_key(r);
-
- c = r->cache;
- cache = c->file_cache;
-
- cln = ngx_pool_cleanup_add(r->pool, 0);
- if (cln == NULL) {
- return NGX_ERROR;
- }
-
- if (ngx_http_file_cache_exists(cache, c) == NGX_ERROR) {
- return NGX_ERROR;
- }
-
- cln->handler = ngx_http_file_cache_cleanup;
- cln->data = c;
-
- if (ngx_http_file_cache_name(r, cache->path) != NGX_OK) {
- return NGX_ERROR;
- }
-
- return NGX_OK;
-}
-
-
void
ngx_http_file_cache_create_key(ngx_http_request_t *r)
{
@@ -237,8 +180,10 @@
ngx_int_t
ngx_http_file_cache_open(ngx_http_request_t *r)
{
+ u_char *p;
ngx_int_t rc, rv;
ngx_uint_t cold, test;
+ ngx_path_t *path;
ngx_http_cache_t *c;
ngx_pool_cleanup_t *cln;
ngx_open_file_info_t of;
@@ -304,10 +249,27 @@
}
}
- if (ngx_http_file_cache_name(r, cache->path) != NGX_OK) {
+ path = cache->path;
+
+ c->file.name.len = path->name.len + 1 + path->len
+ + 2 * NGX_HTTP_CACHE_KEY_LEN;
+
+ c->file.name.data = ngx_pnalloc(r->pool, c->file.name.len + 1);
+ if (c->file.name.data == NULL) {
return NGX_ERROR;
}
+ ngx_memcpy(c->file.name.data, path->name.data, path->name.len);
+
+ p = c->file.name.data + path->name.len + 1 + path->len;
+ p = ngx_hex_dump(p, c->key, NGX_HTTP_CACHE_KEY_LEN);
+ *p = '\0';
+
+ ngx_create_hashed_filename(path, c->file.name.data, c->file.name.len);
+
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
+ "cache file: \"%s\"", c->file.name.data);
+
if (!test) {
return NGX_DECLINED;
}
@@ -368,6 +330,8 @@
ngx_http_file_cache_t *cache;
ngx_http_file_cache_header_t *h;
+ c = r->cache;
+
n = ngx_http_file_cache_aio_read(r, c);
if (n < 0) {
@@ -382,7 +346,7 @@
h = (ngx_http_file_cache_header_t *) c->buf->pos;
- if (h->crc32 != c->crc32) {
+ if (h->crc32 != c->crc32 || (size_t) h->header_start != c->header_start) {
ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
"cache file \"%s\" has md5 collision", c->file.name.data);
return NGX_DECLINED;
@@ -394,7 +358,6 @@
c->last_modified = h->last_modified;
c->date = h->date;
c->valid_msec = h->valid_msec;
- c->header_start = h->header_start;
c->body_start = h->body_start;
r->cached = 1;
@@ -428,7 +391,6 @@
} else {
c->node->updating = 1;
- c->updating = 1;
rc = NGX_HTTP_CACHE_STALE;
}
@@ -517,9 +479,6 @@
if (fcn) {
ngx_queue_remove(&fcn->queue);
- fcn->uses++;
- fcn->count++;
-
if (fcn->error) {
if (fcn->valid_sec < ngx_time()) {
@@ -531,6 +490,9 @@
goto done;
}
+ fcn->uses++;
+ fcn->count++;
+
if (fcn->exists) {
c->exists = fcn->exists;
@@ -579,15 +541,12 @@
ngx_rbtree_insert(&cache->sh->rbtree, &fcn->node);
- fcn->uses = 1;
- fcn->count = 1;
- fcn->updating = 0;
- fcn->deleting = 0;
-
renew:
rc = NGX_DECLINED;
+ fcn->uses = 1;
+ fcn->count = 1;
fcn->valid_msec = 0;
fcn->error = 0;
fcn->exists = 0;
@@ -614,37 +573,6 @@
}
-static ngx_int_t
-ngx_http_file_cache_name(ngx_http_request_t *r, ngx_path_t *path)
-{
- u_char *p;
- ngx_http_cache_t *c;
-
- c = r->cache;
-
- c->file.name.len = path->name.len + 1 + path->len
- + 2 * NGX_HTTP_CACHE_KEY_LEN;
-
- c->file.name.data = ngx_pnalloc(r->pool, c->file.name.len + 1);
- if (c->file.name.data == NULL) {
- return NGX_ERROR;
- }
-
- ngx_memcpy(c->file.name.data, path->name.data, path->name.len);
-
- p = c->file.name.data + path->name.len + 1 + path->len;
- p = ngx_hex_dump(p, c->key, NGX_HTTP_CACHE_KEY_LEN);
- *p = '\0';
-
- ngx_create_hashed_filename(path, c->file.name.data, c->file.name.len);
-
- ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "cache file: \"%s\"", c->file.name.data);
-
- return NGX_OK;
-}
-
-
static ngx_http_file_cache_node_t *
ngx_http_file_cache_lookup(ngx_http_file_cache_t *cache, u_char *key)
{
@@ -795,7 +723,6 @@
"http file cache update");
c->updated = 1;
- c->updating = 0;
cache = c->file_cache;
@@ -856,6 +783,7 @@
ngx_int_t
ngx_http_cache_send(ngx_http_request_t *r)
{
+ off_t size;
ngx_int_t rc;
ngx_buf_t *b;
ngx_chain_t out;
@@ -878,18 +806,21 @@
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) {
return rc;
}
+ size = c->length - c->body_start;
+ if (size == 0) {
+ return rc;
+ }
+
b->file_pos = c->body_start;
b->file_last = c->length;
- b->in_file = 1;
+ b->in_file = size ? 1: 0;
b->last_buf = (r == r->main) ? 1: 0;
b->last_in_chain = 1;
@@ -905,57 +836,46 @@
void
-ngx_http_file_cache_free(ngx_http_cache_t *c, ngx_temp_file_t *tf)
+ngx_http_file_cache_free(ngx_http_request_t *r, ngx_temp_file_t *tf)
{
- ngx_http_file_cache_t *cache;
- ngx_http_file_cache_node_t *fcn;
+ ngx_http_cache_t *c;
+ ngx_http_file_cache_t *cache;
+
+ c = r->cache;
if (c->updated) {
return;
}
+ c->updated = 1;
+
cache = c->file_cache;
- ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->file.log, 0,
- "http file cache free, fd: %d", c->file.fd);
+ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+ "http file cache free");
ngx_shmtx_lock(&cache->shpool->mutex);
- fcn = c->node;
- fcn->count--;
-
- if (c->updating) {
- fcn->updating = 0;
- }
+ c->node->count--;
if (c->error) {
- fcn->error = c->error;
-
- if (c->valid_sec) {
- fcn->valid_sec = c->valid_sec;
- fcn->valid_msec = c->valid_msec;
- }
-
- } else if (!fcn->exists && fcn->count == 0 && c->min_uses == 1) {
- ngx_queue_remove(&fcn->queue);
- ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node);
- ngx_slab_free_locked(cache->shpool, fcn);
- c->node = NULL;
+ c->node->valid_sec = c->valid_sec;
+ c->node->valid_msec = c->valid_msec;
+ c->node->error = c->error;
}
- ngx_shmtx_unlock(&cache->shpool->mutex);
+ c->node->updating = 0;
- c->updated = 1;
- c->updating = 0;
+ ngx_shmtx_unlock(&cache->shpool->mutex);
if (c->temp_file) {
if (tf && tf->file.fd != NGX_INVALID_FILE) {
- ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->file.log, 0,
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http file cache incomplete: \"%s\"",
tf->file.name.data);
if (ngx_delete_file(tf->file.name.data) == NGX_FILE_ERROR) {
- ngx_log_error(NGX_LOG_CRIT, c->file.log, ngx_errno,
+ ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
ngx_delete_file_n " \"%s\" failed",
tf->file.name.data);
}
@@ -969,19 +889,28 @@
{
ngx_http_cache_t *c = data;
+ ngx_http_file_cache_t *cache;
+
if (c->updated) {
return;
}
+ c->updated = 1;
+
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->file.log, 0,
"http file cache cleanup");
- if (c->updating) {
- ngx_log_error(NGX_LOG_ALERT, c->file.log, 0,
- "stalled cache updating, error:%ui", c->error);
+ if (c->error) {
+ return;
}
- ngx_http_file_cache_free(c, NULL);
+ cache = c->file_cache;
+
+ ngx_shmtx_lock(&cache->shpool->mutex);
+
+ c->node->count--;
+
+ ngx_shmtx_unlock(&cache->shpool->mutex);
}
@@ -1010,7 +939,7 @@
ngx_memcpy(name, path->name.data, path->name.len);
wait = 10;
- tries = 20;
+ tries = 0;
ngx_shmtx_lock(&cache->shpool->mutex);
@@ -1025,17 +954,28 @@
fcn->count, fcn->exists,
fcn->key[0], fcn->key[1], fcn->key[2], fcn->key[3]);
- if (fcn->count == 0) {
- ngx_http_file_cache_delete(cache, q, name);
+ if (fcn->count) {
- } else {
- if (--tries) {
+ if (tries++ < 20) {
continue;
}
wait = 1;
+
+ break;
+ }
+
+ if (!fcn->exists) {
+
+ ngx_queue_remove(q);
+ ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node);
+ ngx_slab_free_locked(cache->shpool, fcn);
+
+ break;
}
+ ngx_http_file_cache_delete(cache, q, name);
+
break;
}
@@ -1098,33 +1038,41 @@
fcn->count, fcn->exists,
fcn->key[0], fcn->key[1], fcn->key[2], fcn->key[3]);
- if (fcn->count == 0) {
- ngx_http_file_cache_delete(cache, q, name);
+ if (fcn->count) {
+
+ p = ngx_hex_dump(key, (u_char *) &fcn->node.key,
+ sizeof(ngx_rbtree_key_t));
+
+ len = NGX_HTTP_CACHE_KEY_LEN - sizeof(ngx_rbtree_key_t);
+ (void) ngx_hex_dump(p, fcn->key, len);
+
+ /*
+ * abnormally exited workers may leave locked cache entries,
+ * and although it may be safe to remove them completely,
+ * we prefer to remove them from inactive queue and rbtree
+ * only, and to allow other leaks
+ */
+
+ ngx_queue_remove(q);
+ ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node);
+
+ ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
+ "ignore long locked inactive cache entry %*s, count:%d",
+ 2 * NGX_HTTP_CACHE_KEY_LEN, key, fcn->count);
+
continue;
}
- if (fcn->deleting) {
+ if (!fcn->exists) {
+
+ ngx_queue_remove(q);
+ ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node);
+ ngx_slab_free_locked(cache->shpool, fcn);
+
continue;
}
- p = ngx_hex_dump(key, (u_char *) &fcn->node.key,
- sizeof(ngx_rbtree_key_t));
- len = NGX_HTTP_CACHE_KEY_LEN - sizeof(ngx_rbtree_key_t);
- (void) ngx_hex_dump(p, fcn->key, len);
-
- /*
- * abnormally exited workers may leave locked cache entries,
- * and although it may be safe to remove them completely,
- * we prefer to remove them from inactive queue and rbtree
- * only, and to allow other leaks
- */
-
- ngx_queue_remove(q);
- ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node);
-
- ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
- "ignore long locked inactive cache entry %*s, count:%d",
- 2 * NGX_HTTP_CACHE_KEY_LEN, key, fcn->count);
+ ngx_http_file_cache_delete(cache, q, name);
}
ngx_shmtx_unlock(&cache->shpool->mutex);
@@ -1146,42 +1094,39 @@
fcn = ngx_queue_data(q, ngx_http_file_cache_node_t, queue);
- if (fcn->exists) {
- cache->sh->size -= (fcn->length + cache->bsize - 1) / cache->bsize;
+ cache->sh->size -= (fcn->length + cache->bsize - 1) / cache->bsize;
- path = cache->path;
- p = name + path->name.len + 1 + path->len;
- p = ngx_hex_dump(p, (u_char *) &fcn->node.key,
- sizeof(ngx_rbtree_key_t));
- len = NGX_HTTP_CACHE_KEY_LEN - sizeof(ngx_rbtree_key_t);
- p = ngx_hex_dump(p, fcn->key, len);
- *p = '\0';
+ path = cache->path;
- fcn->count++;
- fcn->deleting = 1;
- ngx_shmtx_unlock(&cache->shpool->mutex);
+ p = name + path->name.len + 1 + path->len;
- len = path->name.len + 1 + path->len + 2 * NGX_HTTP_CACHE_KEY_LEN;
- ngx_create_hashed_filename(path, name, len);
+ p = ngx_hex_dump(p, (u_char *) &fcn->node.key, sizeof(ngx_rbtree_key_t));
- ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
- "http file cache expire: \"%s\"", name);
+ len = NGX_HTTP_CACHE_KEY_LEN - sizeof(ngx_rbtree_key_t);
+ p = ngx_hex_dump(p, fcn->key, len);
+ *p = '\0';
- if (ngx_delete_file(name) == NGX_FILE_ERROR) {
- ngx_log_error(NGX_LOG_CRIT, ngx_cycle->log, ngx_errno,
- ngx_delete_file_n " \"%s\" failed", name);
- }
+ ngx_queue_remove(q);
- ngx_shmtx_lock(&cache->shpool->mutex);
- fcn->count--;
- fcn->deleting = 0;
- }
+ ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node);
+
+ ngx_slab_free_locked(cache->shpool, fcn);
+
+ ngx_shmtx_unlock(&cache->shpool->mutex);
+
+ len = path->name.len + 1 + path->len + 2 * NGX_HTTP_CACHE_KEY_LEN;
+
+ ngx_create_hashed_filename(path, name, len);
- if (fcn->count == 0) {
- ngx_queue_remove(q);
- ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node);
- ngx_slab_free_locked(cache->shpool, fcn);
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
+ "http file cache expire: \"%s\"", name);
+
+ if (ngx_delete_file(name) == NGX_FILE_ERROR) {
+ ngx_log_error(NGX_LOG_CRIT, ngx_cycle->log, ngx_errno,
+ ngx_delete_file_n " \"%s\" failed", name);
}
+
+ ngx_shmtx_lock(&cache->shpool->mutex);
}
@@ -1274,7 +1219,7 @@
if (cache->files++ > 100) {
- ngx_time_update();
+ ngx_time_update(0, 0);
elapsed = ngx_abs((ngx_msec_int_t) (ngx_current_msec - cache->last));
@@ -1291,7 +1236,7 @@
ngx_msleep(200);
- ngx_time_update();
+ ngx_time_update(0, 0);
}
cache->last = ngx_current_msec;
@@ -1437,8 +1382,6 @@
fcn->valid_msec = c->valid_msec;
fcn->error = 0;
fcn->exists = 1;
- fcn->updating = 0;
- fcn->deleting = 0;
fcn->uniq = c->uniq;
fcn->valid_sec = c->valid_sec;
fcn->body_start = c->body_start;
@@ -1751,70 +1694,4 @@
}
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.8.29.tar.gz/src/http/ngx_http_parse.c
^
|
@@ -112,10 +112,8 @@
sw_schema_slash_slash,
sw_host,
sw_port,
- sw_host_http_09,
sw_after_slash_in_uri,
sw_check_uri,
- sw_check_uri_http_09,
sw_uri,
sw_http_09,
sw_http_H,
@@ -210,10 +208,6 @@
r->method = NGX_HTTP_MKCOL;
}
- if (ngx_str5cmp(m, 'P', 'A', 'T', 'C', 'H')) {
- r->method = NGX_HTTP_PATCH;
- }
-
if (ngx_str5cmp(m, 'T', 'R', 'A', 'C', 'E')) {
r->method = NGX_HTTP_TRACE;
}
@@ -272,7 +266,7 @@
/* space* before URI */
case sw_spaces_before_uri:
- if (ch == '/') {
+ if (ch == '/' ){
r->uri_start = p;
state = sw_after_slash_in_uri;
break;
@@ -359,7 +353,7 @@
*/
r->uri_start = r->schema_end + 1;
r->uri_end = r->schema_end + 2;
- state = sw_host_http_09;
+ state = sw_http_09;
break;
default:
return NGX_HTTP_PARSE_INVALID_REQUEST;
@@ -385,35 +379,13 @@
*/
r->uri_start = r->schema_end + 1;
r->uri_end = r->schema_end + 2;
- state = sw_host_http_09;
- break;
- default:
- return NGX_HTTP_PARSE_INVALID_REQUEST;
- }
- break;
-
- /* space+ after "http://host[:port] " */
- case sw_host_http_09:
- switch (ch) {
- case ' ':
- break;
- case CR:
- r->http_minor = 9;
- state = sw_almost_done;
- break;
- case LF:
- r->http_minor = 9;
- goto done;
- case 'H':
- r->http_protocol.data = p;
- state = sw_http_H;
+ state = sw_http_09;
break;
default:
return NGX_HTTP_PARSE_INVALID_REQUEST;
}
break;
-
/* check "/.", "//", "%", and "\" (Win32) in URI */
case sw_after_slash_in_uri:
@@ -425,7 +397,7 @@
switch (ch) {
case ' ':
r->uri_end = p;
- state = sw_check_uri_http_09;
+ state = sw_http_09;
break;
case CR:
r->uri_end = p;
@@ -466,7 +438,8 @@
r->plus_in_uri = 1;
break;
case '\0':
- return NGX_HTTP_PARSE_INVALID_REQUEST;
+ r->zero_in_uri = 1;
+ break;
default:
state = sw_check_uri;
break;
@@ -490,7 +463,7 @@
break;
case ' ':
r->uri_end = p;
- state = sw_check_uri_http_09;
+ state = sw_http_09;
break;
case CR:
r->uri_end = p;
@@ -523,34 +496,11 @@
r->plus_in_uri = 1;
break;
case '\0':
- return NGX_HTTP_PARSE_INVALID_REQUEST;
- }
- break;
-
- /* space+ after URI */
- case sw_check_uri_http_09:
- switch (ch) {
- case ' ':
- break;
- case CR:
- r->http_minor = 9;
- state = sw_almost_done;
- break;
- case LF:
- r->http_minor = 9;
- goto done;
- case 'H':
- r->http_protocol.data = p;
- state = sw_http_H;
- break;
- default:
- r->space_in_uri = 1;
- state = sw_check_uri;
+ r->zero_in_uri = 1;
break;
}
break;
-
/* URI */
case sw_uri:
@@ -576,7 +526,8 @@
r->complex_uri = 1;
break;
case '\0':
- return NGX_HTTP_PARSE_INVALID_REQUEST;
+ r->zero_in_uri = 1;
+ break;
}
break;
@@ -597,9 +548,7 @@
state = sw_http_H;
break;
default:
- r->space_in_uri = 1;
- state = sw_uri;
- break;
+ return NGX_HTTP_PARSE_INVALID_REQUEST;
}
break;
@@ -1241,14 +1190,19 @@
if (ch >= '0' && ch <= '9') {
ch = (u_char) ((decoded << 4) + ch - '0');
- if (ch == '%' || ch == '#') {
+ if (ch == '%') {
state = sw_usual;
*u++ = ch;
ch = *p++;
break;
+ }
+
+ if (ch == '#') {
+ *u++ = ch;
+ ch = *p++;
} else if (ch == '\0') {
- return NGX_HTTP_PARSE_INVALID_REQUEST;
+ r->zero_in_uri = 1;
}
state = quoted_state;
@@ -1260,10 +1214,8 @@
ch = (u_char) ((decoded << 4) + c - 'a' + 10);
if (ch == '?') {
- state = sw_usual;
*u++ = ch;
ch = *p++;
- break;
} else if (ch == '+') {
r->plus_in_uri = 1;
@@ -1318,211 +1270,6 @@
ngx_int_t
-ngx_http_parse_status_line(ngx_http_request_t *r, ngx_buf_t *b,
- ngx_http_status_t *status)
-{
- u_char ch;
- u_char *p;
- enum {
- sw_start = 0,
- sw_H,
- sw_HT,
- sw_HTT,
- sw_HTTP,
- sw_first_major_digit,
- sw_major_digit,
- sw_first_minor_digit,
- sw_minor_digit,
- sw_status,
- sw_space_after_status,
- sw_status_text,
- sw_almost_done
- } state;
-
- state = r->state;
-
- for (p = b->pos; p < b->last; p++) {
- ch = *p;
-
- switch (state) {
-
- /* "HTTP/" */
- case sw_start:
- switch (ch) {
- case 'H':
- state = sw_H;
- break;
- default:
- return NGX_ERROR;
- }
- break;
-
- case sw_H:
- switch (ch) {
- case 'T':
- state = sw_HT;
- break;
- default:
- return NGX_ERROR;
- }
- break;
-
- case sw_HT:
- switch (ch) {
- case 'T':
- state = sw_HTT;
- break;
- default:
- return NGX_ERROR;
- }
- break;
-
- case sw_HTT:
- switch (ch) {
- case 'P':
- state = sw_HTTP;
- break;
- default:
- return NGX_ERROR;
- }
- break;
-
- case sw_HTTP:
- switch (ch) {
- case '/':
- state = sw_first_major_digit;
- break;
- default:
- return NGX_ERROR;
- }
- break;
-
- /* the first digit of major HTTP version */
- case sw_first_major_digit:
- if (ch < '1' || ch > '9') {
- return NGX_ERROR;
- }
-
- state = sw_major_digit;
- break;
-
- /* the major HTTP version or dot */
- case sw_major_digit:
- if (ch == '.') {
- state = sw_first_minor_digit;
- break;
- }
-
- if (ch < '0' || ch > '9') {
- return NGX_ERROR;
- }
-
- break;
-
- /* the first digit of minor HTTP version */
- case sw_first_minor_digit:
- if (ch < '0' || ch > '9') {
- return NGX_ERROR;
- }
-
- state = sw_minor_digit;
- break;
-
- /* the minor HTTP version or the end of the request line */
- case sw_minor_digit:
- if (ch == ' ') {
- state = sw_status;
- break;
- }
-
- if (ch < '0' || ch > '9') {
- return NGX_ERROR;
- }
-
- break;
-
- /* HTTP status code */
- case sw_status:
- if (ch == ' ') {
- break;
- }
-
- if (ch < '0' || ch > '9') {
- return NGX_ERROR;
- }
-
- status->code = status->code * 10 + ch - '0';
-
- if (++status->count == 3) {
- state = sw_space_after_status;
- status->start = p - 2;
- }
-
- break;
-
- /* space or end of line */
- case sw_space_after_status:
- switch (ch) {
- case ' ':
- state = sw_status_text;
- break;
- case '.': /* IIS may send 403.1, 403.2, etc */
- state = sw_status_text;
- break;
- case CR:
- state = sw_almost_done;
- break;
- case LF:
- goto done;
- default:
- return NGX_ERROR;
- }
- break;
-
- /* any text until end of line */
- case sw_status_text:
- switch (ch) {
- case CR:
- state = sw_almost_done;
-
- break;
- case LF:
- goto done;
- }
- break;
-
- /* end of status line */
- case sw_almost_done:
- status->end = p - 1;
- switch (ch) {
- case LF:
- goto done;
- default:
- return NGX_ERROR;
- }
- }
- }
-
- b->pos = p;
- r->state = state;
-
- return NGX_AGAIN;
-
-done:
-
- b->pos = p + 1;
-
- if (status->end == NULL) {
- status->end = p;
- }
-
- r->state = sw_start;
-
- return NGX_OK;
-}
-
-
-ngx_int_t
ngx_http_parse_unsafe_uri(ngx_http_request_t *r, ngx_str_t *uri,
ngx_str_t *args, ngx_uint_t *flags)
{
@@ -1557,7 +1304,8 @@
}
if (ch == '\0') {
- goto unsafe;
+ *flags |= NGX_HTTP_ZERO_IN_URI;
+ continue;
}
if (ngx_path_separator(ch) && len > 2) {
@@ -1701,19 +1449,34 @@
void
ngx_http_split_args(ngx_http_request_t *r, ngx_str_t *uri, ngx_str_t *args)
{
- u_char *p, *last;
+ u_char ch, *p, *last;
+
+ p = uri->data;
+
+ last = p + uri->len;
+
+ args->len = 0;
+
+ while (p < last) {
+
+ ch = *p++;
+
+ 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;
+ }
- } else {
- args->len = 0;
+ if (ch == '\0') {
+ r->zero_in_uri = 1;
+ continue;
+ }
}
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/ngx_http_request.c
^
|
@@ -555,7 +555,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]);
@@ -756,7 +756,6 @@
r->unparsed_uri.len = r->uri_end - r->uri_start;
r->unparsed_uri.data = r->uri_start;
- r->valid_unparsed_uri = r->space_in_uri ? 0 : 1;
r->method_name.len = r->method_end - r->request_start + 1;
r->method_name.data = r->request_line.data;
@@ -789,31 +788,14 @@
p = r->uri.data + r->uri.len - 1;
- while (p > r->uri.data) {
+ if (*p == '.') {
- if (*p == ' ') {
- p--;
- continue;
- }
-
- if (*p == '.') {
- p--;
- continue;
- }
+ while (--p > r->uri.data && *p == '.') { /* void */ }
- 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
@@ -1466,9 +1448,6 @@
} 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;
}
@@ -2018,7 +1997,6 @@
}
r->done = 1;
- r->write_event_handler = ngx_http_request_empty_handler;
if (!r->post_action) {
r->request_complete = 1;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/ngx_http_request.h
^
|
@@ -37,8 +37,7 @@
#define NGX_HTTP_PROPPATCH 0x0800
#define NGX_HTTP_LOCK 0x1000
#define NGX_HTTP_UNLOCK 0x2000
-#define NGX_HTTP_PATCH 0x4000
-#define NGX_HTTP_TRACE 0x8000
+#define NGX_HTTP_TRACE 0x4000
#define NGX_HTTP_CONNECTION_CLOSE 1
#define NGX_HTTP_CONNECTION_KEEP_ALIVE 2
@@ -57,7 +56,7 @@
#define NGX_HTTP_PARSE_INVALID_HEADER 13
-/* unused 1 */
+#define NGX_HTTP_ZERO_IN_URI 1
#define NGX_HTTP_SUBREQUEST_IN_MEMORY 2
#define NGX_HTTP_SUBREQUEST_WAITED 4
#define NGX_HTTP_LOG_UNSAFE 8
@@ -65,14 +64,12 @@
#define NGX_HTTP_OK 200
#define NGX_HTTP_CREATED 201
-#define NGX_HTTP_ACCEPTED 202
#define NGX_HTTP_NO_CONTENT 204
#define NGX_HTTP_PARTIAL_CONTENT 206
#define NGX_HTTP_SPECIAL_RESPONSE 300
#define NGX_HTTP_MOVED_PERMANENTLY 301
#define NGX_HTTP_MOVED_TEMPORARILY 302
-#define NGX_HTTP_SEE_OTHER 303
#define NGX_HTTP_NOT_MODIFIED 304
#define NGX_HTTP_BAD_REQUEST 400
@@ -223,7 +220,6 @@
unsigned opera:1;
unsigned gecko:1;
unsigned chrome:1;
- unsigned safari:1;
unsigned konqueror:1;
} ngx_http_headers_in_t;
@@ -438,12 +434,11 @@
/* URI with "+" */
unsigned plus_in_uri:1;
- /* URI with " " */
- unsigned space_in_uri:1;
+ /* URI with "\0" or "%00" */
+ unsigned zero_in_uri:1;
unsigned invalid_header:1;
- unsigned add_uri_to_alias:1;
unsigned valid_location:1;
unsigned valid_unparsed_uri:1;
unsigned uri_changed:1;
@@ -489,6 +484,7 @@
unsigned plain_http:1;
unsigned chunked:1;
unsigned header_only:1;
+ unsigned zero_body:1;
unsigned keepalive:1;
unsigned lingering_close:1;
unsigned discard_body:1;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/ngx_http_script.c
^
|
@@ -211,112 +211,6 @@
}
-char *
-ngx_http_set_complex_value_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
-{
- char *p = conf;
-
- ngx_str_t *value;
- ngx_http_complex_value_t **cv;
- ngx_http_compile_complex_value_t ccv;
-
- cv = (ngx_http_complex_value_t **) (p + cmd->offset);
-
- if (*cv != NULL) {
- return "duplicate";
- }
-
- *cv = ngx_palloc(cf->pool, sizeof(ngx_http_complex_value_t));
- if (*cv == NULL) {
- return NGX_CONF_ERROR;
- }
-
- value = cf->args->elts;
-
- ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
-
- ccv.cf = cf;
- ccv.value = &value[1];
- ccv.complex_value = *cv;
-
- if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
- return NGX_CONF_ERROR;
- }
-
- return NGX_CONF_OK;
-}
-
-
-ngx_int_t
-ngx_http_test_predicates(ngx_http_request_t *r, ngx_array_t *predicates)
-{
- ngx_str_t val;
- ngx_uint_t i;
- ngx_http_complex_value_t *cv;
-
- if (predicates == NULL) {
- return NGX_OK;
- }
-
- cv = predicates->elts;
-
- for (i = 0; i < predicates->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_set_predicate_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;
-}
-
-
ngx_uint_t
ngx_http_script_variables_count(ngx_str_t *value)
{
@@ -1114,7 +1008,8 @@
}
r->headers_out.location->hash = 1;
- ngx_str_set(&r->headers_out.location->key, "Location");
+ r->headers_out.location->key.len = sizeof("Location") - 1;
+ r->headers_out.location->key.data = (u_char *) "Location";
r->headers_out.location->value = e->buf;
e->ip += sizeof(ngx_http_script_regex_end_code_t);
@@ -1360,17 +1255,14 @@
code = (ngx_http_script_return_code_t *) e->ip;
- if (code->status < NGX_HTTP_BAD_REQUEST
- || code->text.value.len
- || code->text.lengths)
- {
- e->status = ngx_http_send_response(e->request, code->status, NULL,
- &code->text);
- } else {
- e->status = code->status;
+ e->status = code->status;
+
+ if (code->status == NGX_HTTP_NO_CONTENT) {
+ e->request->header_only = 1;
+ e->request->zero_body = 1;
}
- e->ip = ngx_http_script_exit;
+ e->ip += sizeof(ngx_http_script_return_code_t) - sizeof(uintptr_t);
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/ngx_http_script.h
^
|
@@ -159,7 +159,7 @@
typedef struct {
ngx_http_script_code_pt code;
uintptr_t status;
- ngx_http_complex_value_t text;
+ uintptr_t null;
} ngx_http_script_return_code_t;
@@ -207,14 +207,6 @@
ngx_int_t ngx_http_complex_value(ngx_http_request_t *r,
ngx_http_complex_value_t *val, ngx_str_t *value);
ngx_int_t ngx_http_compile_complex_value(ngx_http_compile_complex_value_t *ccv);
-char *ngx_http_set_complex_value_slot(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf);
-
-
-ngx_int_t ngx_http_test_predicates(ngx_http_request_t *r,
- ngx_array_t *predicates);
-char *ngx_http_set_predicate_slot(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf);
ngx_uint_t ngx_http_script_variables_count(ngx_str_t *value);
ngx_int_t ngx_http_script_compile(ngx_http_script_compile_t *sc);
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/ngx_http_special_response.c
^
|
@@ -65,14 +65,6 @@
;
-static char ngx_http_error_303_page[] =
-"<html>" CRLF
-"<head><title>303 See Other</title></head>" CRLF
-"<body bgcolor=\"white\">" CRLF
-"<center><h1>303 See Other</h1></center>" CRLF
-;
-
-
static char ngx_http_error_400_page[] =
"<html>" CRLF
"<head><title>400 Bad Request</title></head>" CRLF
@@ -289,7 +281,7 @@
/* ngx_null_string, */ /* 300 */
ngx_string(ngx_http_error_301_page),
ngx_string(ngx_http_error_302_page),
- ngx_string(ngx_http_error_303_page),
+ ngx_null_string, /* 303 */
#define NGX_HTTP_LAST_LEVEL_300 304
#define NGX_HTTP_LEVEL_300 (NGX_HTTP_LAST_LEVEL_300 - 301)
@@ -525,6 +517,8 @@
r->err_status = overwrite;
+ r->zero_in_uri = 0;
+
if (ngx_http_complex_value(r, &err_page->value, &uri) != NGX_OK) {
return NGX_ERROR;
}
@@ -559,7 +553,8 @@
r->err_status = NGX_HTTP_MOVED_TEMPORARILY;
location->hash = 1;
- ngx_str_set(&location->key, "Location");
+ location->key.len = sizeof("Location") - 1;
+ location->key.data = (u_char *) "Location";
location->value = uri;
r->headers_out.location = location;
@@ -598,24 +593,32 @@
msie_padding = 0;
- if (ngx_http_error_pages[err].len) {
- r->headers_out.content_length_n = ngx_http_error_pages[err].len + len;
- if (clcf->msie_padding
- && (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_padding) - 1;
- msie_padding = 1;
- }
+ if (!r->zero_body) {
+ if (ngx_http_error_pages[err].len) {
+ r->headers_out.content_length_n = ngx_http_error_pages[err].len
+ + len;
+ if (clcf->msie_padding
+ && (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_padding) - 1;
+ msie_padding = 1;
+ }
+
+ r->headers_out.content_type_len = sizeof("text/html") - 1;
+ r->headers_out.content_type.len = sizeof("text/html") - 1;
+ r->headers_out.content_type.data = (u_char *) "text/html";
+ r->headers_out.content_type_lowcase = NULL;
- r->headers_out.content_type_len = sizeof("text/html") - 1;
- ngx_str_set(&r->headers_out.content_type, "text/html");
- r->headers_out.content_type_lowcase = NULL;
+ } else {
+ r->headers_out.content_length_n = -1;
+ }
} else {
- r->headers_out.content_length_n = -1;
+ r->headers_out.content_length_n = 0;
+ err = 0;
}
if (r->headers_out.content_length) {
@@ -708,7 +711,8 @@
r->err_status = NGX_HTTP_OK;
r->headers_out.content_type_len = sizeof("text/html") - 1;
- ngx_str_set(&r->headers_out.content_type, "text/html");
+ r->headers_out.content_type.len = sizeof("text/html") - 1;
+ r->headers_out.content_type.data = (u_char *) "text/html";
r->headers_out.content_type_lowcase = NULL;
r->headers_out.location->hash = 0;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/ngx_http_upstream.c
^
|
@@ -72,8 +72,6 @@
static ngx_int_t ngx_http_upstream_process_header_line(ngx_http_request_t *r,
ngx_table_elt_t *h, ngx_uint_t offset);
-static ngx_int_t ngx_http_upstream_process_set_cookie(ngx_http_request_t *r,
- ngx_table_elt_t *h, ngx_uint_t offset);
static ngx_int_t
ngx_http_upstream_process_cache_control(ngx_http_request_t *r,
ngx_table_elt_t *h, ngx_uint_t offset);
@@ -191,7 +189,7 @@
ngx_http_upstream_rewrite_refresh, 0, 0 },
{ ngx_string("Set-Cookie"),
- ngx_http_upstream_process_set_cookie, 0,
+ ngx_http_upstream_ignore_header_line, 0,
ngx_http_upstream_copy_header_line, 0, 1 },
{ ngx_string("Content-Disposition"),
@@ -357,16 +355,6 @@
};
-ngx_conf_bitmask_t ngx_http_upstream_ignore_headers_masks[] = {
- { ngx_string("X-Accel-Redirect"), NGX_HTTP_UPSTREAM_IGN_XA_REDIRECT },
- { ngx_string("X-Accel-Expires"), NGX_HTTP_UPSTREAM_IGN_XA_EXPIRES },
- { ngx_string("Expires"), NGX_HTTP_UPSTREAM_IGN_EXPIRES },
- { ngx_string("Cache-Control"), NGX_HTTP_UPSTREAM_IGN_CACHE_CONTROL },
- { ngx_string("Set-Cookie"), NGX_HTTP_UPSTREAM_IGN_SET_COOKIE },
- { ngx_null_string, 0 }
-};
-
-
ngx_int_t
ngx_http_upstream_create(ngx_http_request_t *r)
{
@@ -377,6 +365,7 @@
if (u && u->cleanup) {
r->main->count++;
ngx_http_upstream_cleanup(r);
+ *u->cleanup = NULL;
}
u = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_t));
@@ -633,19 +622,6 @@
if (c == NULL) {
- switch (ngx_http_test_predicates(r, u->conf->cache_bypass)) {
-
- case NGX_ERROR:
- return NGX_ERROR;
-
- case NGX_DECLINED:
- u->cache_status = NGX_HTTP_CACHE_BYPASS;
- return NGX_DECLINED;
-
- default: /* NGX_OK */
- break;
- }
-
if (!(r->method & u->conf->cache_methods)) {
return NGX_DECLINED;
}
@@ -654,10 +630,18 @@
u->method = ngx_http_core_get_method;
}
- if (ngx_http_file_cache_new(r) != NGX_OK) {
+ c = ngx_pcalloc(r->pool, sizeof(ngx_http_cache_t));
+ if (c == NULL) {
return NGX_ERROR;
}
+ if (ngx_array_init(&c->keys, r->pool, 4, sizeof(ngx_str_t)) != NGX_OK) {
+ return NGX_ERROR;
+ }
+
+ r->cache = c;
+ c->file.log = r->connection->log;
+
if (u->create_key(r) != NGX_OK) {
return NGX_ERROR;
}
@@ -668,8 +652,6 @@
u->cacheable = 1;
- c = r->cache;
-
c->min_uses = u->conf->cache_min_uses;
c->body_start = u->conf->buffer_size;
c->file_cache = u->conf->cache->data;
@@ -1566,7 +1548,7 @@
/* rc == NGX_OK */
- if (u->headers_in.status_n > NGX_HTTP_SPECIAL_RESPONSE) {
+ if (u->headers_in.status_n >= NGX_HTTP_BAD_REQUEST) {
if (r->subrequest_in_memory) {
u->buffer.last = u->buffer.pos;
@@ -1720,21 +1702,6 @@
r->headers_out.www_authenticate = h;
}
-#if (NGX_HTTP_CACHE)
-
- if (r->cache) {
- time_t valid;
-
- valid = ngx_http_file_cache_valid(u->conf->cache_valid, status);
-
- if (valid) {
- r->cache->valid_sec = ngx_time() + valid;
- r->cache->error = status;
- }
-
- ngx_http_file_cache_free(r->cache, u->pipe->temp_file);
- }
-#endif
ngx_http_upstream_finalize_request(r, u, status);
return NGX_OK;
@@ -1834,7 +1801,8 @@
}
uri = &u->headers_in.x_accel_redirect->value;
- ngx_str_null(&args);
+ args.len = 0;
+ args.data = NULL;
flags = NGX_HTTP_LOG_UNSAFE;
if (ngx_http_parse_unsafe_uri(r, uri, &args, &flags) != NGX_OK) {
@@ -1842,6 +1810,10 @@
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;
}
@@ -1948,7 +1920,7 @@
if (size == 0) {
ngx_log_error(NGX_LOG_ALERT, c->log, 0,
- "upstream buffer is too small to read response");
+ "upstream buffer is too small to read repsonse");
ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
@@ -2113,47 +2085,6 @@
r->cache->file.fd = NGX_INVALID_FILE;
}
- switch (ngx_http_test_predicates(r, u->conf->no_cache)) {
-
- case NGX_ERROR:
- ngx_http_upstream_finalize_request(r, u, 0);
- return;
-
- case NGX_DECLINED:
- u->cacheable = 0;
- break;
-
- default: /* NGX_OK */
-
- if (u->cache_status == NGX_HTTP_CACHE_BYPASS) {
-
- if (ngx_http_file_cache_new(r) != NGX_OK) {
- ngx_http_upstream_finalize_request(r, u, 0);
- return;
- }
-
- if (u->create_key(r) != NGX_OK) {
- ngx_http_upstream_finalize_request(r, u, 0);
- return;
- }
-
- /* TODO: add keys */
-
- r->cache->min_uses = u->conf->cache_min_uses;
- r->cache->body_start = u->conf->buffer_size;
- r->cache->file_cache = u->conf->cache->data;
-
- if (ngx_http_file_cache_create(r) != NGX_OK) {
- ngx_http_upstream_finalize_request(r, u, 0);
- return;
- }
-
- u->cacheable = 1;
- }
-
- break;
- }
-
if (u->cacheable) {
time_t now, valid;
@@ -2186,7 +2117,7 @@
"http cacheable: %d", u->cacheable);
if (u->cacheable == 0 && r->cache) {
- ngx_http_file_cache_free(r->cache, u->pipe->temp_file);
+ ngx_http_file_cache_free(r, u->pipe->temp_file);
}
#endif
@@ -2661,7 +2592,7 @@
ngx_http_file_cache_update(r, u->pipe->temp_file);
} else if (p->upstream_error) {
- ngx_http_file_cache_free(r->cache, u->pipe->temp_file);
+ ngx_http_file_cache_free(r, u->pipe->temp_file);
}
}
@@ -2925,7 +2856,6 @@
if (u->cleanup) {
*u->cleanup = NULL;
- u->cleanup = NULL;
}
if (u->resolved && u->resolved->ctx) {
@@ -2989,6 +2919,10 @@
if (u->cacheable && r->cache) {
time_t valid;
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+ "http upstream cache fd: %d",
+ r->cache->file.fd);
+
if (rc == NGX_HTTP_BAD_GATEWAY || rc == NGX_HTTP_GATEWAY_TIME_OUT) {
valid = ngx_http_file_cache_valid(u->conf->cache_valid, rc);
@@ -2999,7 +2933,7 @@
}
}
- ngx_http_file_cache_free(r->cache, u->pipe->temp_file);
+ ngx_http_file_cache_free(r, u->pipe->temp_file);
}
#endif
@@ -3049,24 +2983,6 @@
static ngx_int_t
-ngx_http_upstream_process_set_cookie(ngx_http_request_t *r, ngx_table_elt_t *h,
- ngx_uint_t offset)
-{
-#if (NGX_HTTP_CACHE)
- ngx_http_upstream_t *u;
-
- u = r->upstream;
-
- if (!(u->conf->ignore_headers & NGX_HTTP_UPSTREAM_IGN_SET_COOKIE)) {
- u->cacheable = 0;
- }
-#endif
-
- return NGX_OK;
-}
-
-
-static ngx_int_t
ngx_http_upstream_process_cache_control(ngx_http_request_t *r,
ngx_table_elt_t *h, ngx_uint_t offset)
{
@@ -3108,18 +3024,16 @@
return NGX_OK;
}
- p = h->value.data;
- last = p + h->value.len;
+ last = h->value.data + h->value.len;
- 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)
+ if (ngx_strlcasestrn(h->value.data, last, (u_char *) "no-cache", 8 - 1)
+ != NULL)
{
u->cacheable = 0;
return NGX_OK;
}
- p = ngx_strlcasestrn(p, last, (u_char *) "max-age=", 8 - 1);
+ p = ngx_strlcasestrn(h->value.data, last, (u_char *) "max-age=", 8 - 1);
if (p == NULL) {
return NGX_OK;
@@ -3796,7 +3710,7 @@
if (state[i].status) {
ms = (ngx_msec_int_t)
(state[i].response_sec * 1000 + state[i].response_msec);
- ms = ngx_max(ms, 0);
+ ms = (ms >= 0) ? ms : 0;
p = ngx_sprintf(p, "%d.%03d", ms / 1000, ms % 1000);
} else {
@@ -4290,7 +4204,7 @@
char *
-ngx_http_upstream_bind_set_slot(ngx_conf_t *cf, ngx_command_t *cmd,
+ngx_http_upsteam_bind_set_slot(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf)
{
char *p = conf;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/ngx_http_upstream.h
^
|
@@ -43,7 +43,6 @@
#define NGX_HTTP_UPSTREAM_IGN_XA_EXPIRES 0x00000004
#define NGX_HTTP_UPSTREAM_IGN_EXPIRES 0x00000008
#define NGX_HTTP_UPSTREAM_IGN_CACHE_CONTROL 0x00000010
-#define NGX_HTTP_UPSTREAM_IGN_SET_COOKIE 0x00000020
typedef struct {
@@ -163,8 +162,6 @@
ngx_uint_t cache_methods;
ngx_array_t *cache_valid;
- ngx_array_t *cache_bypass;
- ngx_array_t *no_cache;
#endif
ngx_array_t *store_lengths;
@@ -326,7 +323,7 @@
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);
-char *ngx_http_upstream_bind_set_slot(ngx_conf_t *cf, ngx_command_t *cmd,
+char *ngx_http_upsteam_bind_set_slot(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
ngx_int_t ngx_http_upstream_hide_headers_hash(ngx_conf_t *cf,
ngx_http_upstream_conf_t *conf, ngx_http_upstream_conf_t *prev,
@@ -339,7 +336,6 @@
extern ngx_module_t ngx_http_upstream_module;
extern ngx_conf_bitmask_t ngx_http_upstream_cache_method_mask[];
-extern ngx_conf_bitmask_t ngx_http_upstream_ignore_headers_masks[];
#endif /* _NGX_HTTP_UPSTREAM_H_INCLUDED_ */
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/http/ngx_http_variables.c
^
|
@@ -196,8 +196,7 @@
{ ngx_string("server_name"), NULL, ngx_http_variable_server_name, 0, 0, 0 },
{ ngx_string("request_method"), NULL,
- ngx_http_variable_request_method, 0,
- NGX_HTTP_VAR_NOCACHEABLE, 0 },
+ ngx_http_variable_request_method, 0, 0, 0 },
{ ngx_string("remote_user"), NULL, ngx_http_variable_remote_user, 0, 0, 0 },
@@ -441,7 +440,8 @@
ngx_http_variable_value_t *
-ngx_http_get_variable(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key)
+ngx_http_get_variable(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key,
+ ngx_uint_t nowarn)
{
ngx_http_variable_t *v;
ngx_http_variable_value_t *vv;
@@ -453,7 +453,7 @@
if (v) {
if (v->flags & NGX_HTTP_VAR_INDEXED) {
- return ngx_http_get_flushed_variable(r, v->index);
+ return ngx_http_get_indexed_variable(r, v->index);
} else {
@@ -494,7 +494,7 @@
return NULL;
}
- if (ngx_strncmp(name->data, "upstream_http_", 14) == 0) {
+ if (ngx_strncmp(name->data, "upstream_http_", 10) == 0) {
if (ngx_http_upstream_header_variable(r, vv, (uintptr_t) name)
== NGX_OK)
@@ -525,6 +525,11 @@
vv->not_found = 1;
+ if (nowarn == 0) {
+ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+ "unknown \"%V\" variable", name);
+ }
+
return vv;
}
@@ -1390,7 +1395,8 @@
return NGX_OK;
}
- ngx_str_set(&name, "sent_http_location");
+ name.len = sizeof("sent_http_location") - 1;
+ name.data = (u_char *) "sent_http_location";
return ngx_http_variable_unknown_header(v, &name,
&r->headers_out.headers.part,
@@ -1737,7 +1743,7 @@
v->get_handler = ngx_http_variable_not_found;
- p += size;
+ p += i + size;
}
return re;
@@ -1930,7 +1936,6 @@
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;
}
@@ -1973,3 +1978,87 @@
return NGX_OK;
}
+
+
+void
+ngx_http_variable_value_rbtree_insert(ngx_rbtree_node_t *temp,
+ ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel)
+{
+ ngx_rbtree_node_t **p;
+ ngx_http_variable_value_node_t *vvn, *vvt;
+
+ for ( ;; ) {
+
+ vvn = (ngx_http_variable_value_node_t *) node;
+ vvt = (ngx_http_variable_value_node_t *) temp;
+
+ if (node->key != temp->key) {
+
+ p = (node->key < temp->key) ? &temp->left : &temp->right;
+
+ } else if (vvn->len != vvt->len) {
+
+ p = (vvn->len < vvt->len) ? &temp->left : &temp->right;
+
+ } else {
+ p = (ngx_memcmp(vvn->value->data, vvt->value->data, vvn->len) < 0)
+ ? &temp->left : &temp->right;
+ }
+
+ if (*p == sentinel) {
+ break;
+ }
+
+ temp = *p;
+ }
+
+ *p = node;
+ node->parent = temp;
+ node->left = sentinel;
+ node->right = sentinel;
+ ngx_rbt_red(node);
+}
+
+
+ngx_http_variable_value_t *
+ngx_http_variable_value_lookup(ngx_rbtree_t *rbtree, ngx_str_t *val,
+ uint32_t hash)
+{
+ ngx_int_t rc;
+ ngx_rbtree_node_t *node, *sentinel;
+ ngx_http_variable_value_node_t *vvn;
+
+ node = rbtree->root;
+ sentinel = rbtree->sentinel;
+
+ while (node != sentinel) {
+
+ vvn = (ngx_http_variable_value_node_t *) node;
+
+ if (hash != node->key) {
+ node = (hash < node->key) ? node->left : node->right;
+ continue;
+ }
+
+ if (val->len != vvn->len) {
+ node = (val->len < vvn->len) ? node->left : node->right;
+ continue;
+ }
+
+ rc = ngx_memcmp(val->data, vvn->value->data, val->len);
+
+ if (rc < 0) {
+ node = node->left;
+ continue;
+ }
+
+ if (rc > 0) {
+ node = node->right;
+ continue;
+ }
+
+ return vvn->value;
+ }
+
+ return NULL;
+}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/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_str_t *name, ngx_uint_t key, ngx_uint_t nowarn);
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);
@@ -88,6 +88,19 @@
ngx_int_t ngx_http_variables_init_vars(ngx_conf_t *cf);
+typedef struct {
+ ngx_rbtree_node_t node;
+ size_t len;
+ ngx_http_variable_value_t *value;
+} ngx_http_variable_value_node_t;
+
+
+void ngx_http_variable_value_rbtree_insert(ngx_rbtree_node_t *temp,
+ ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel);
+ngx_http_variable_value_t *ngx_http_variable_value_lookup(ngx_rbtree_t *rbtree,
+ ngx_str_t *name, uint32_t hash);
+
+
extern ngx_http_variable_value_t ngx_http_variable_null_value;
extern ngx_http_variable_value_t ngx_http_variable_true_value;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/mail/ngx_mail_auth_http_module.c
^
|
@@ -1405,17 +1405,12 @@
ahcf->peer = u.addrs;
- if (u.family != AF_UNIX) {
- ahcf->host_header = u.host;
-
- } else {
- ngx_str_set(&ahcf->host_header, "localhost");
- }
-
+ ahcf->host_header = u.host;
ahcf->uri = u.uri;
if (ahcf->uri.len == 0) {
- ngx_str_set(&ahcf->uri, "/");
+ ahcf->uri.len = sizeof("/") - 1;
+ ahcf->uri.data = (u_char *) "/";
}
return NGX_CONF_OK;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/mail/ngx_mail_handler.c
^
|
@@ -346,7 +346,7 @@
#endif
plain.data = ngx_pnalloc(c->pool, ngx_base64_decoded_length(arg[n].len));
- if (plain.data == NULL) {
+ if (plain.data == NULL){
return NGX_ERROR;
}
@@ -403,7 +403,7 @@
"mail auth login username: \"%V\"", &arg[n]);
s->login.data = ngx_pnalloc(c->pool, ngx_base64_decoded_length(arg[n].len));
- if (s->login.data == NULL) {
+ if (s->login.data == NULL){
return NGX_ERROR;
}
@@ -434,7 +434,7 @@
s->passwd.data = ngx_pnalloc(c->pool,
ngx_base64_decoded_length(arg[0].len));
- if (s->passwd.data == NULL) {
+ if (s->passwd.data == NULL){
return NGX_ERROR;
}
@@ -494,7 +494,7 @@
"mail auth cram-md5: \"%V\"", &arg[0]);
s->login.data = ngx_pnalloc(c->pool, ngx_base64_decoded_length(arg[0].len));
- if (s->login.data == NULL) {
+ if (s->login.data == NULL){
return NGX_ERROR;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/mail/ngx_mail_imap_handler.c
^
|
@@ -39,7 +39,8 @@
cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);
- ngx_str_set(&s->out, imap_greeting);
+ s->out.len = sizeof(imap_greeting) - 1;
+ s->out.data = imap_greeting;
c->read->handler = ngx_mail_imap_init_protocol;
@@ -135,7 +136,8 @@
tag = 1;
s->text.len = 0;
- ngx_str_set(&s->out, imap_ok);
+ s->out.len = sizeof(imap_ok) - 1;
+ s->out.data = imap_ok;
if (rc == NGX_OK) {
@@ -184,7 +186,8 @@
case NGX_IMAP_LOGOUT:
s->quit = 1;
- ngx_str_set(&s->text, imap_bye);
+ s->text.len = sizeof(imap_bye) - 1;
+ s->text.data = imap_bye;
break;
case NGX_IMAP_NOOP:
@@ -205,7 +208,8 @@
rc = ngx_mail_auth_login_username(s, c, 0);
tag = 0;
- ngx_str_set(&s->out, imap_password);
+ s->out.len = sizeof(imap_password) - 1;
+ s->out.data = imap_password;
s->mail_state = ngx_imap_auth_login_password;
break;
@@ -225,7 +229,8 @@
} else if (rc == NGX_IMAP_NEXT) {
tag = 0;
- ngx_str_set(&s->out, imap_next);
+ s->out.len = sizeof(imap_next) - 1;
+ s->out.data = imap_next;
}
switch (rc) {
@@ -240,14 +245,16 @@
case NGX_MAIL_PARSE_INVALID_COMMAND:
s->state = 0;
- ngx_str_set(&s->out, imap_invalid_command);
+ s->out.len = sizeof(imap_invalid_command) - 1;
+ s->out.data = imap_invalid_command;
s->mail_state = ngx_imap_start;
break;
}
if (tag) {
if (s->tag.len == 0) {
- ngx_str_set(&s->tag, imap_star);
+ s->tag.len = sizeof(imap_star) - 1;
+ s->tag.data = (u_char *) imap_star;
}
if (s->tagged_line.len < s->tag.len + s->text.len + s->out.len) {
@@ -357,21 +364,24 @@
case NGX_MAIL_AUTH_LOGIN:
- ngx_str_set(&s->out, imap_username);
+ s->out.len = sizeof(imap_username) - 1;
+ s->out.data = imap_username;
s->mail_state = ngx_imap_auth_login_username;
return NGX_OK;
case NGX_MAIL_AUTH_LOGIN_USERNAME:
- ngx_str_set(&s->out, imap_password);
+ s->out.len = sizeof(imap_password) - 1;
+ s->out.data = imap_password;
s->mail_state = ngx_imap_auth_login_password;
return ngx_mail_auth_login_username(s, c, 1);
case NGX_MAIL_AUTH_PLAIN:
- ngx_str_set(&s->out, imap_plain_next);
+ s->out.len = sizeof(imap_plain_next) - 1;
+ s->out.data = imap_plain_next;
s->mail_state = ngx_imap_auth_plain;
return NGX_OK;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/mail/ngx_mail_pop3_handler.c
^
|
@@ -59,7 +59,8 @@
s->out.len = p - s->out.data;
} else {
- ngx_str_set(&s->out, pop3_greeting);
+ s->out.len = sizeof(pop3_greeting) - 1;
+ s->out.data = pop3_greeting;
}
c->read->handler = ngx_mail_pop3_init_protocol;
@@ -148,7 +149,8 @@
return;
}
- ngx_str_set(&s->out, pop3_ok);
+ s->out.len = sizeof(pop3_ok) - 1;
+ s->out.data = pop3_ok;
if (rc == NGX_OK) {
switch (s->mail_state) {
@@ -186,6 +188,7 @@
default:
rc = NGX_MAIL_PARSE_INVALID_COMMAND;
+ s->mail_state = ngx_pop3_start;
break;
}
@@ -212,6 +215,7 @@
default:
rc = NGX_MAIL_PARSE_INVALID_COMMAND;
+ s->mail_state = ngx_pop3_start;
break;
}
@@ -224,7 +228,8 @@
case ngx_pop3_auth_login_username:
rc = ngx_mail_auth_login_username(s, c, 0);
- ngx_str_set(&s->out, pop3_password);
+ s->out.len = sizeof(pop3_password) - 1;
+ s->out.data = pop3_password;
s->mail_state = ngx_pop3_auth_login_password;
break;
@@ -256,7 +261,8 @@
s->mail_state = ngx_pop3_start;
s->state = 0;
- ngx_str_set(&s->out, pop3_invalid_command);
+ s->out.len = sizeof(pop3_invalid_command) - 1;
+ s->out.data = pop3_invalid_command;
/* fall through */
@@ -462,21 +468,24 @@
case NGX_MAIL_AUTH_LOGIN:
- ngx_str_set(&s->out, pop3_username);
+ s->out.len = sizeof(pop3_username) - 1;
+ s->out.data = pop3_username;
s->mail_state = ngx_pop3_auth_login_username;
return NGX_OK;
case NGX_MAIL_AUTH_LOGIN_USERNAME:
- ngx_str_set(&s->out, pop3_password);
+ s->out.len = sizeof(pop3_password) - 1;
+ s->out.data = pop3_password;
s->mail_state = ngx_pop3_auth_login_password;
return ngx_mail_auth_login_username(s, c, 1);
case NGX_MAIL_AUTH_PLAIN:
- ngx_str_set(&s->out, pop3_next);
+ s->out.len = sizeof(pop3_next) - 1;
+ s->out.data = pop3_next;
s->mail_state = ngx_pop3_auth_plain;
return NGX_OK;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/mail/ngx_mail_proxy_module.c
^
|
@@ -304,7 +304,8 @@
default:
#if (NGX_SUPPRESS_WARN)
- ngx_str_null(&line);
+ line.len = 0;
+ line.data = NULL;
#endif
break;
}
@@ -438,7 +439,8 @@
default:
#if (NGX_SUPPRESS_WARN)
- ngx_str_null(&line);
+ line.len = 0;
+ line.data = NULL;
#endif
break;
}
@@ -662,7 +664,8 @@
default:
#if (NGX_SUPPRESS_WARN)
- ngx_str_null(&line);
+ line.len = 0;
+ line.data = NULL;
#endif
break;
}
@@ -723,7 +726,7 @@
b->last += n;
- if (b->last - b->pos < 4) {
+ if (b->last - b->pos < 5) {
return NGX_AGAIN;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/mail/ngx_mail_smtp_handler.c
^
|
@@ -319,7 +319,8 @@
return;
}
- ngx_str_set(&s->out, smtp_invalid_pipelining);
+ s->out.len = sizeof(smtp_invalid_pipelining) - 1;
+ s->out.data = smtp_invalid_pipelining;
}
ngx_mail_send(c->write);
@@ -413,7 +414,8 @@
return;
}
- ngx_str_set(&s->out, smtp_ok);
+ s->out.len = sizeof(smtp_ok) - 1;
+ s->out.data = smtp_ok;
if (rc == NGX_OK) {
switch (s->mail_state) {
@@ -433,7 +435,8 @@
case NGX_SMTP_QUIT:
s->quit = 1;
- ngx_str_set(&s->out, smtp_bye);
+ s->out.len = sizeof(smtp_bye) - 1;
+ s->out.data = smtp_bye;
break;
case NGX_SMTP_MAIL:
@@ -453,7 +456,8 @@
case NGX_SMTP_STARTTLS:
rc = ngx_mail_smtp_starttls(s, c);
- ngx_str_set(&s->out, smtp_starttls);
+ s->out.len = sizeof(smtp_starttls) - 1;
+ s->out.data = smtp_starttls;
break;
default:
@@ -466,7 +470,8 @@
case ngx_smtp_auth_login_username:
rc = ngx_mail_auth_login_username(s, c, 0);
- ngx_str_set(&s->out, smtp_password);
+ s->out.len = sizeof(smtp_password) - 1;
+ s->out.data = smtp_password;
s->mail_state = ngx_smtp_auth_login_password;
break;
@@ -497,7 +502,9 @@
case NGX_MAIL_PARSE_INVALID_COMMAND:
s->mail_state = ngx_smtp_start;
s->state = 0;
- ngx_str_set(&s->out, smtp_invalid_command);
+
+ s->out.len = sizeof(smtp_invalid_command) - 1;
+ s->out.data = smtp_invalid_command;
/* fall through */
@@ -522,7 +529,8 @@
ngx_mail_smtp_srv_conf_t *sscf;
if (s->args.nelts != 1) {
- ngx_str_set(&s->out, smtp_invalid_argument);
+ s->out.len = sizeof(smtp_invalid_argument) - 1;
+ s->out.data = smtp_invalid_argument;
s->state = 0;
return NGX_OK;
}
@@ -538,8 +546,10 @@
ngx_memcpy(s->smtp_helo.data, arg[0].data, arg[0].len);
- ngx_str_null(&s->smtp_from);
- ngx_str_null(&s->smtp_to);
+ s->smtp_from.len = 0;
+ s->smtp_from.data = NULL;
+ s->smtp_to.len = 0;
+ s->smtp_to.data = NULL;
sscf = ngx_mail_get_module_srv_conf(s, ngx_mail_smtp_module);
@@ -589,7 +599,8 @@
#endif
if (s->args.nelts == 0) {
- ngx_str_set(&s->out, smtp_invalid_argument);
+ s->out.len = sizeof(smtp_invalid_argument) - 1;
+ s->out.data = smtp_invalid_argument;
s->state = 0;
return NGX_OK;
}
@@ -600,21 +611,24 @@
case NGX_MAIL_AUTH_LOGIN:
- ngx_str_set(&s->out, smtp_username);
+ s->out.len = sizeof(smtp_username) - 1;
+ s->out.data = smtp_username;
s->mail_state = ngx_smtp_auth_login_username;
return NGX_OK;
case NGX_MAIL_AUTH_LOGIN_USERNAME:
- ngx_str_set(&s->out, smtp_password);
+ s->out.len = sizeof(smtp_password) - 1;
+ s->out.data = smtp_password;
s->mail_state = ngx_smtp_auth_login_password;
return ngx_mail_auth_login_username(s, c, 1);
case NGX_MAIL_AUTH_PLAIN:
- ngx_str_set(&s->out, smtp_next);
+ s->out.len = sizeof(smtp_next) - 1;
+ s->out.data = smtp_next;
s->mail_state = ngx_smtp_auth_plain;
return NGX_OK;
@@ -659,14 +673,18 @@
if (!(sscf->auth_methods & NGX_MAIL_AUTH_NONE_ENABLED)) {
ngx_mail_smtp_log_rejected_command(s, c, "client was rejected: \"%V\"");
- ngx_str_set(&s->out, smtp_auth_required);
+
+ s->out.len = sizeof(smtp_auth_required) - 1;
+ s->out.data = smtp_auth_required;
+
return NGX_OK;
}
/* auth none */
if (s->smtp_from.len) {
- ngx_str_set(&s->out, smtp_bad_sequence);
+ s->out.len = sizeof(smtp_bad_sequence) - 1;
+ s->out.data = smtp_bad_sequence;
return NGX_OK;
}
@@ -705,7 +723,8 @@
ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0,
"smtp mail from:\"%V\"", &s->smtp_from);
- ngx_str_set(&s->out, smtp_ok);
+ s->out.len = sizeof(smtp_ok) - 1;
+ s->out.data = smtp_ok;
return NGX_OK;
}
@@ -719,7 +738,8 @@
ngx_uint_t i;
if (s->smtp_from.len == 0) {
- ngx_str_set(&s->out, smtp_bad_sequence);
+ s->out.len = sizeof(smtp_bad_sequence) - 1;
+ s->out.data = smtp_bad_sequence;
return NGX_OK;
}
@@ -767,9 +787,13 @@
static ngx_int_t
ngx_mail_smtp_rset(ngx_mail_session_t *s, ngx_connection_t *c)
{
- ngx_str_null(&s->smtp_from);
- ngx_str_null(&s->smtp_to);
- ngx_str_set(&s->out, smtp_ok);
+ s->smtp_from.len = 0;
+ s->smtp_from.data = NULL;
+ s->smtp_to.len = 0;
+ s->smtp_to.data = NULL;
+
+ s->out.len = sizeof(smtp_ok) - 1;
+ s->out.data = smtp_ok;
return NGX_OK;
}
@@ -790,9 +814,12 @@
* obtained from client before STARTTLS.
*/
- ngx_str_null(&s->smtp_helo);
- ngx_str_null(&s->smtp_from);
- ngx_str_null(&s->smtp_to);
+ s->smtp_helo.len = 0;
+ s->smtp_helo.data = NULL;
+ s->smtp_from.len = 0;
+ s->smtp_from.data = NULL;
+ s->smtp_to.len = 0;
+ s->smtp_to.data = NULL;
c->read->handler = ngx_mail_starttls_handler;
return NGX_OK;
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/mail/ngx_mail_ssl_module.c
^
|
@@ -163,7 +163,8 @@
* scf->certificate = { 0, NULL };
* scf->certificate_key = { 0, NULL };
* scf->dhparam = { 0, NULL };
- * scf->ciphers = { 0, NULL };
+ * scf->ciphers.len = 0;
+ * scf->ciphers.data = NULL;
* scf->shm_zone = NULL;
*/
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/misc/ngx_google_perftools_module.c
^
|
@@ -8,7 +8,7 @@
#include <ngx_core.h>
/*
- * declare Profiler interface here because
+ * declare Profiler here interface because
* <google/profiler.h> is C++ header file
*/
@@ -73,7 +73,7 @@
}
/*
- * set by ngx_pcalloc()
+ * set by pcalloc()
*
* gptcf->profiles = { 0, NULL };
*/
@@ -101,6 +101,7 @@
}
if (getenv("CPUPROFILE")) {
+
/* disable inherited Profiler enabled in master process */
ProfilerStop();
}
@@ -108,6 +109,7 @@
ngx_sprintf(profile, "%V.%d%Z", &gptcf->profiles, ngx_pid);
if (ProfilerStart(profile)) {
+
/* start ITIMER_PROF timer */
ProfilerRegisterThread();
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/os/unix/ngx_atomic.h
^
|
@@ -14,7 +14,6 @@
#if (NGX_HAVE_LIBATOMIC)
-#define AO_REQUIRE_CAS
#include <atomic_ops.h>
#define NGX_HAVE_ATOMIC_OPS 1
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/os/unix/ngx_channel.c
^
|
@@ -36,18 +36,7 @@
cmsg.cm.cmsg_len = CMSG_LEN(sizeof(int));
cmsg.cm.cmsg_level = SOL_SOCKET;
cmsg.cm.cmsg_type = SCM_RIGHTS;
-
- /*
- * We have to use ngx_memcpy() instead of simple
- * *(int *) CMSG_DATA(&cmsg.cm) = ch->fd;
- * because some gcc 4.4 with -O2/3/s optimization issues the warning:
- * dereferencing type-punned pointer will break strict-aliasing rules
- *
- * Fortunately, gcc with -O1 compiles this ngx_memcpy()
- * in the same simple assignment as in the code above
- */
-
- ngx_memcpy(CMSG_DATA(&cmsg.cm), &ch->fd, sizeof(int));
+ *(int *) CMSG_DATA(&cmsg.cm) = ch->fd;
}
msg.msg_flags = 0;
@@ -164,9 +153,7 @@
return NGX_ERROR;
}
- /* ch->fd = *(int *) CMSG_DATA(&cmsg.cm); */
-
- ngx_memcpy(&ch->fd, CMSG_DATA(&cmsg.cm), sizeof(int));
+ ch->fd = *(int *) CMSG_DATA(&cmsg.cm);
}
if (msg.msg_flags & (MSG_TRUNC|MSG_CTRUNC)) {
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/os/unix/ngx_errno.h
^
|
@@ -30,6 +30,7 @@
#define NGX_EINVAL EINVAL
#define NGX_ENOSPC ENOSPC
#define NGX_EPIPE EPIPE
+#define NGX_EAGAIN EAGAIN
#define NGX_EINPROGRESS EINPROGRESS
#define NGX_EADDRINUSE EADDRINUSE
#define NGX_ECONNABORTED ECONNABORTED
@@ -47,11 +48,6 @@
#define NGX_EILSEQ EILSEQ
#define NGX_ENOMOREFILES 0
-#if (__hpux__)
-#define NGX_EAGAIN EWOULDBLOCK
-#else
-#define NGX_EAGAIN EAGAIN
-#endif
#define ngx_errno errno
@@ -68,22 +64,10 @@
/* 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.8.29.tar.gz/src/os/unix/ngx_files.c
^
|
@@ -76,7 +76,7 @@
#if (NGX_HAVE_PWRITE)
for ( ;; ) {
- n = pwrite(file->fd, buf + written, size, offset);
+ n = pwrite(file->fd, buf, size, offset);
if (n == -1) {
ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,
@@ -108,7 +108,7 @@
}
for ( ;; ) {
- n = write(file->fd, buf + written, size);
+ n = write(file->fd, buf, size);
if (n == -1) {
ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,
@@ -258,58 +258,6 @@
}
-ngx_int_t
-ngx_create_file_mapping(ngx_file_mapping_t *fm)
-{
- fm->fd = ngx_open_file(fm->name, NGX_FILE_RDWR, NGX_FILE_TRUNCATE,
- NGX_FILE_DEFAULT_ACCESS);
- if (fm->fd == NGX_INVALID_FILE) {
- ngx_log_error(NGX_LOG_CRIT, fm->log, ngx_errno,
- ngx_open_file_n " \"%s\" failed", fm->name);
- return NGX_ERROR;
- }
-
- if (ftruncate(fm->fd, fm->size) == -1) {
- ngx_log_error(NGX_LOG_CRIT, fm->log, ngx_errno,
- "ftruncate() \"%s\" failed", fm->name);
- goto failed;
- }
-
- fm->addr = mmap(NULL, fm->size, PROT_READ|PROT_WRITE, MAP_SHARED,
- fm->fd, 0);
- if (fm->addr != MAP_FAILED) {
- return NGX_OK;
- }
-
- ngx_log_error(NGX_LOG_CRIT, fm->log, ngx_errno,
- "mmap(%uz) \"%s\" failed", fm->size, fm->name);
-
-failed:
-
- if (ngx_close_file(fm->fd) == NGX_FILE_ERROR) {
- ngx_log_error(NGX_LOG_ALERT, fm->log, ngx_errno,
- ngx_close_file_n " \"%s\" failed", fm->name);
- }
-
- return NGX_ERROR;
-}
-
-
-void
-ngx_close_file_mapping(ngx_file_mapping_t *fm)
-{
- if (munmap(fm->addr, fm->size) == -1) {
- ngx_log_error(NGX_LOG_CRIT, fm->log, ngx_errno,
- "munmap(%uz) \"%s\" failed", fm->size, fm->name);
- }
-
- if (ngx_close_file(fm->fd) == NGX_FILE_ERROR) {
- ngx_log_error(NGX_LOG_ALERT, fm->log, ngx_errno,
- ngx_close_file_n " \"%s\" failed", fm->name);
- }
-}
-
-
ngx_int_t
ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir)
{
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/os/unix/ngx_files.h
^
|
@@ -18,15 +18,6 @@
typedef struct {
- u_char *name;
- size_t size;
- void *addr;
- ngx_fd_t fd;
- ngx_log_t *log;
-} ngx_file_mapping_t;
-
-
-typedef struct {
DIR *dir;
struct dirent *de;
struct stat info;
@@ -73,7 +64,6 @@
#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
@@ -148,9 +138,6 @@
#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))
@@ -161,10 +148,6 @@
#define ngx_file_uniq(sb) (sb)->st_ino
-ngx_int_t ngx_create_file_mapping(ngx_file_mapping_t *fm);
-void ngx_close_file_mapping(ngx_file_mapping_t *fm);
-
-
#if (NGX_HAVE_CASELESS_FILESYSTEM)
#define ngx_filename_cmp(s1, s2, n) strncasecmp((char *) s1, (char *) s2, n)
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/os/unix/ngx_process.c
^
|
@@ -11,10 +11,10 @@
typedef struct {
- int signo;
- char *signame;
- char *name;
- void (*handler)(int signo);
+ int signo;
+ char *signame;
+ char *name;
+ void (*handler)(int signo);
} ngx_signal_t;
@@ -317,7 +317,7 @@
}
}
- ngx_time_sigsafe_update();
+ ngx_time_update(0, 0);
action = "";
@@ -479,17 +479,16 @@
*/
if (err == NGX_ECHILD) {
- ngx_log_error(NGX_LOG_INFO, ngx_cycle->log, 0,
- "waitpid() failed (%d: %s)",
- err, ngx_sigsafe_strerror(err));
+ ngx_log_error(NGX_LOG_INFO, ngx_cycle->log, errno,
+ "waitpid() failed");
return;
}
#endif
- ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
- "waitpid() failed (%d: %s)",
- err, ngx_sigsafe_strerror(err));
+ ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, errno,
+ "waitpid() failed");
+
return;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/os/unix/ngx_process_cycle.c
^
|
@@ -168,7 +168,7 @@
sigsuspend(&set);
- ngx_time_update();
+ ngx_time_update(0, 0);
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"wake up, sigio %i", sigio);
@@ -856,13 +856,13 @@
}
}
- if (ccf->rlimit_core != NGX_CONF_UNSET) {
+ if (ccf->rlimit_core != NGX_CONF_UNSET_SIZE) {
rlmt.rlim_cur = (rlim_t) ccf->rlimit_core;
rlmt.rlim_max = (rlim_t) ccf->rlimit_core;
if (setrlimit(RLIMIT_CORE, &rlmt) == -1) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
- "setrlimit(RLIMIT_CORE, %O) failed",
+ "setrlimit(RLIMIT_CORE, %i) failed",
ccf->rlimit_core);
}
}
@@ -1342,7 +1342,7 @@
next = (n <= next) ? n : next;
- ngx_time_update();
+ ngx_time_update(0, 0);
}
}
@@ -1372,7 +1372,7 @@
if (path[i]->loader) {
path[i]->loader(path[i]->data);
- ngx_time_update();
+ ngx_time_update(0, 0);
}
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/os/unix/ngx_readv_chain.c
^
|
@@ -158,7 +158,7 @@
rev->ready = 0;
- if (n == NGX_ERROR) {
+ if (n == NGX_ERROR){
c->read->error = 1;
}
@@ -247,7 +247,7 @@
rev->ready = 0;
- if (n == NGX_ERROR) {
+ if (n == NGX_ERROR){
c->read->error = 1;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/os/unix/ngx_recv.c
^
|
@@ -113,7 +113,7 @@
rev->ready = 0;
- if (n == NGX_ERROR) {
+ if (n == NGX_ERROR){
rev->error = 1;
}
@@ -169,7 +169,7 @@
rev->ready = 0;
- if (n == NGX_ERROR) {
+ if (n == NGX_ERROR){
rev->error = 1;
}
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/os/unix/ngx_sunpro_amd64.il
^
|
@@ -31,12 +31,7 @@
/ ngx_cpu_pause()
-/
-/ the "rep; nop" is used instead of "pause" to avoid the "[ PAUSE ]" hardware
-/ capability added by linker because Solaris/amd64 does not know about it:
-/
-/ ld.so.1: nginx: fatal: hardware capability unsupported: 0x2000 [ PAUSE ]
.inline ngx_cpu_pause,0
- rep; nop
+ pause
.end
|
[-]
[+]
|
Changed |
nginx-0.8.29.tar.gz/src/os/unix/ngx_udp_recv.c
^
|
@@ -60,7 +60,7 @@
rev->ready = 0;
- if (n == NGX_ERROR) {
+ if (n == NGX_ERROR){
rev->error = 1;
}
@@ -104,7 +104,7 @@
rev->ready = 0;
- if (n == NGX_ERROR) {
+ if (n == NGX_ERROR){
rev->error = 1;
}
|
[-]
[+]
|
Deleted |
nginx-0.8.52.tar.gz/conf/fastcgi.conf
^
|
@@ -1,24 +0,0 @@
-
-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;
|
[-]
[+]
|
Deleted |
nginx-0.8.52.tar.gz/conf/scgi_params
^
|
@@ -1,15 +0,0 @@
-
-scgi_param REQUEST_METHOD $request_method;
-scgi_param REQUEST_URI $request_uri;
-scgi_param QUERY_STRING $query_string;
-scgi_param CONTENT_TYPE $content_type;
-
-scgi_param DOCUMENT_URI $document_uri;
-scgi_param DOCUMENT_ROOT $document_root;
-scgi_param SCGI 1;
-scgi_param SERVER_PROTOCOL $server_protocol;
-
-scgi_param REMOTE_ADDR $remote_addr;
-scgi_param REMOTE_PORT $remote_port;
-scgi_param SERVER_PORT $server_port;
-scgi_param SERVER_NAME $server_name;
|
[-]
[+]
|
Deleted |
nginx-0.8.52.tar.gz/conf/uwsgi_params
^
|
@@ -1,15 +0,0 @@
-
-uwsgi_param QUERY_STRING $query_string;
-uwsgi_param REQUEST_METHOD $request_method;
-uwsgi_param CONTENT_TYPE $content_type;
-uwsgi_param CONTENT_LENGTH $content_length;
-
-uwsgi_param REQUEST_URI $request_uri;
-uwsgi_param PATH_INFO $document_uri;
-uwsgi_param DOCUMENT_ROOT $document_root;
-uwsgi_param SERVER_PROTOCOL $server_protocol;
-
-uwsgi_param REMOTE_ADDR $remote_addr;
-uwsgi_param REMOTE_PORT $remote_port;
-uwsgi_param SERVER_PORT $server_port;
-uwsgi_param SERVER_NAME $server_name;
|
[-]
[+]
|
Deleted |
nginx-0.8.52.tar.gz/src/http/modules/ngx_http_scgi_module.c
^
|
@@ -1,1661 +0,0 @@
-
-/*
- * Copyright (C) Igor Sysoev
- * Copyright (C) Manlio Perillo (manlio.perillo@gmail.com)
- */
-
-
-#include <ngx_config.h>
-#include <ngx_core.h>
-#include <ngx_http.h>
-
-
-typedef struct {
- ngx_http_upstream_conf_t upstream;
-
- ngx_array_t *flushes;
- ngx_array_t *params_len;
- ngx_array_t *params;
- ngx_array_t *params_source;
-
- ngx_hash_t headers_hash;
- ngx_uint_t header_params;
-
- ngx_array_t *scgi_lengths;
- ngx_array_t *scgi_values;
-
-#if (NGX_HTTP_CACHE)
- ngx_http_complex_value_t cache_key;
-#endif
-} ngx_http_scgi_loc_conf_t;
-
-
-static ngx_int_t ngx_http_scgi_eval(ngx_http_request_t *r,
- ngx_http_scgi_loc_conf_t *scf);
-static ngx_int_t ngx_http_scgi_create_request(ngx_http_request_t *r);
-static ngx_int_t ngx_http_scgi_reinit_request(ngx_http_request_t *r);
-static ngx_int_t ngx_http_scgi_process_status_line(ngx_http_request_t *r);
-static ngx_int_t ngx_http_scgi_process_header(ngx_http_request_t *r);
-static ngx_int_t ngx_http_scgi_process_header(ngx_http_request_t *r);
-static void ngx_http_scgi_abort_request(ngx_http_request_t *r);
-static void ngx_http_scgi_finalize_request(ngx_http_request_t *r, ngx_int_t rc);
-
-static void *ngx_http_scgi_create_loc_conf(ngx_conf_t *cf);
-static char *ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent,
- void *child);
-
-static char *ngx_http_scgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
-static char *ngx_http_scgi_store(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf);
-
-#if (NGX_HTTP_CACHE)
-static ngx_int_t ngx_http_scgi_create_key(ngx_http_request_t *r);
-static char *ngx_http_scgi_cache(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf);
-static char *ngx_http_scgi_cache_key(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf);
-#endif
-
-
-static ngx_conf_bitmask_t ngx_http_scgi_next_upstream_masks[] = {
- { ngx_string("error"), NGX_HTTP_UPSTREAM_FT_ERROR },
- { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT },
- { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER },
- { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 },
- { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 },
- { ngx_string("http_404"), NGX_HTTP_UPSTREAM_FT_HTTP_404 },
- { ngx_string("updating"), NGX_HTTP_UPSTREAM_FT_UPDATING },
- { ngx_string("off"), NGX_HTTP_UPSTREAM_FT_OFF },
- { ngx_null_string, 0 }
-};
-
-
-ngx_module_t ngx_http_scgi_module;
-
-
-static ngx_command_t ngx_http_scgi_commands[] = {
-
- { ngx_string("scgi_pass"),
- NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE1,
- ngx_http_scgi_pass,
- NGX_HTTP_LOC_CONF_OFFSET,
- 0,
- NULL },
-
- { ngx_string("scgi_store"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_http_scgi_store,
- NGX_HTTP_LOC_CONF_OFFSET,
- 0,
- NULL },
-
- { ngx_string("scgi_store_access"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE123,
- ngx_conf_set_access_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.store_access),
- NULL },
-
- { ngx_string("scgi_ignore_client_abort"),
- 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_scgi_loc_conf_t, upstream.ignore_client_abort),
- NULL },
-
- { ngx_string("scgi_bind"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_http_upstream_bind_set_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.local),
- NULL },
-
- { ngx_string("scgi_connect_timeout"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_msec_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.connect_timeout),
- NULL },
-
- { ngx_string("scgi_send_timeout"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_msec_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.send_timeout),
- NULL },
-
- { ngx_string("scgi_buffer_size"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_size_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.buffer_size),
- NULL },
-
- { ngx_string("scgi_pass_request_headers"),
- 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_scgi_loc_conf_t, upstream.pass_request_headers),
- NULL },
-
- { ngx_string("scgi_pass_request_body"),
- 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_scgi_loc_conf_t, upstream.pass_request_body),
- NULL },
-
- { ngx_string("scgi_intercept_errors"),
- 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_scgi_loc_conf_t, upstream.intercept_errors),
- NULL },
-
- { ngx_string("scgi_read_timeout"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_msec_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.read_timeout),
- NULL },
-
- { ngx_string("scgi_buffers"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2,
- ngx_conf_set_bufs_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.bufs),
- NULL },
-
- { ngx_string("scgi_busy_buffers_size"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_size_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.busy_buffers_size_conf),
- NULL },
-
-#if (NGX_HTTP_CACHE)
-
- { ngx_string("scgi_cache"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_http_scgi_cache,
- NGX_HTTP_LOC_CONF_OFFSET,
- 0,
- NULL },
-
- { ngx_string("scgi_cache_key"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_http_scgi_cache_key,
- NGX_HTTP_LOC_CONF_OFFSET,
- 0,
- NULL },
-
- { ngx_string("scgi_cache_path"),
- NGX_HTTP_MAIN_CONF|NGX_CONF_2MORE,
- ngx_http_file_cache_set_slot,
- 0,
- 0,
- &ngx_http_scgi_module },
-
- { ngx_string("scgi_cache_bypass"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
- ngx_http_set_predicate_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_bypass),
- NULL },
-
- { ngx_string("scgi_no_cache"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
- ngx_http_set_predicate_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.no_cache),
- NULL },
-
- { ngx_string("scgi_cache_valid"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
- ngx_http_file_cache_valid_set_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_valid),
- NULL },
-
- { ngx_string("scgi_cache_min_uses"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_num_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_min_uses),
- NULL },
-
- { ngx_string("scgi_cache_use_stale"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
- ngx_conf_set_bitmask_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_use_stale),
- &ngx_http_scgi_next_upstream_masks },
-
- { ngx_string("scgi_cache_methods"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
- ngx_conf_set_bitmask_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_methods),
- &ngx_http_upstream_cache_method_mask },
-
-#endif
-
- { ngx_string("scgi_temp_path"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1234,
- ngx_conf_set_path_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.temp_path),
- NULL },
-
- { ngx_string("scgi_max_temp_file_size"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_size_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.max_temp_file_size_conf),
- NULL },
-
- { ngx_string("scgi_temp_file_write_size"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_size_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.temp_file_write_size_conf),
- NULL },
-
- { ngx_string("scgi_next_upstream"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
- ngx_conf_set_bitmask_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.next_upstream),
- &ngx_http_scgi_next_upstream_masks },
-
- { ngx_string("scgi_param"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2,
- ngx_conf_set_keyval_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, params_source),
- NULL },
-
- { ngx_string("scgi_pass_header"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_str_array_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.pass_headers),
- NULL },
-
- { ngx_string("scgi_hide_header"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_str_array_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.hide_headers),
- NULL },
-
- { ngx_string("scgi_ignore_headers"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
- ngx_conf_set_bitmask_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_scgi_loc_conf_t, upstream.ignore_headers),
- &ngx_http_upstream_ignore_headers_masks },
-
- ngx_null_command
-};
-
-
-static ngx_http_module_t ngx_http_scgi_module_ctx = {
- NULL, /* preconfiguration */
- NULL, /* postconfiguration */
-
- NULL, /* create main configuration */
- NULL, /* init main configuration */
-
- NULL, /* create server configuration */
- NULL, /* merge server configuration */
-
- ngx_http_scgi_create_loc_conf, /* create location configuration */
- ngx_http_scgi_merge_loc_conf /* merge location configuration */
-};
-
-
-ngx_module_t ngx_http_scgi_module = {
- NGX_MODULE_V1,
- &ngx_http_scgi_module_ctx, /* module context */
- ngx_http_scgi_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_str_t ngx_http_scgi_hide_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_null_string
-};
-
-
-#if (NGX_HTTP_CACHE)
-
-static ngx_keyval_t ngx_http_scgi_cache_headers[] = {
- { ngx_string("HTTP_IF_MODIFIED_SINCE"), ngx_string("") },
- { ngx_string("HTTP_IF_UNMODIFIED_SINCE"), ngx_string("") },
- { ngx_string("HTTP_IF_NONE_MATCH"), ngx_string("") },
- { ngx_string("HTTP_IF_MATCH"), ngx_string("") },
- { ngx_string("HTTP_RANGE"), ngx_string("") },
- { ngx_string("HTTP_IF_RANGE"), ngx_string("") },
- { ngx_null_string, ngx_null_string }
-};
-
-#endif
-
-
-static ngx_path_init_t ngx_http_scgi_temp_path = {
- ngx_string(NGX_HTTP_SCGI_TEMP_PATH), { 1, 2, 0 }
-};
-
-
-static ngx_int_t
-ngx_http_scgi_handler(ngx_http_request_t *r)
-{
- ngx_int_t rc;
- ngx_http_status_t *status;
- ngx_http_upstream_t *u;
- ngx_http_scgi_loc_conf_t *scf;
-
- if (r->subrequest_in_memory) {
- ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
- "ngx_http_scgi_module does not support "
- "subrequests in memory");
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
-
- if (ngx_http_upstream_create(r) != NGX_OK) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
-
- status = ngx_pcalloc(r->pool, sizeof(ngx_http_status_t));
- if (status == NULL) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
-
- ngx_http_set_ctx(r, status, ngx_http_scgi_module);
-
- scf = ngx_http_get_module_loc_conf(r, ngx_http_scgi_module);
-
- if (scf->scgi_lengths) {
- if (ngx_http_scgi_eval(r, scf) != NGX_OK) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
- }
-
- u = r->upstream;
-
- ngx_str_set(&u->schema, "scgi://");
- u->output.tag = (ngx_buf_tag_t) &ngx_http_scgi_module;
-
- u->conf = &scf->upstream;
-
-#if (NGX_HTTP_CACHE)
- u->create_key = ngx_http_scgi_create_key;
-#endif
- u->create_request = ngx_http_scgi_create_request;
- u->reinit_request = ngx_http_scgi_reinit_request;
- u->process_header = ngx_http_scgi_process_status_line;
- u->abort_request = ngx_http_scgi_abort_request;
- u->finalize_request = ngx_http_scgi_finalize_request;
-
- u->buffering = 1;
-
- u->pipe = ngx_pcalloc(r->pool, sizeof(ngx_event_pipe_t));
- if (u->pipe == NULL) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
-
- u->pipe->input_filter = ngx_event_pipe_copy_input_filter;
- u->pipe->input_ctx = r;
-
- rc = ngx_http_read_client_request_body(r, ngx_http_upstream_init);
-
- if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
- return rc;
- }
-
- return NGX_DONE;
-}
-
-
-static ngx_int_t
-ngx_http_scgi_eval(ngx_http_request_t *r, ngx_http_scgi_loc_conf_t * scf)
-{
- ngx_url_t url;
- ngx_http_upstream_t *u;
-
- ngx_memzero(&url, sizeof(ngx_url_t));
-
- if (ngx_http_script_run(r, &url.url, scf->scgi_lengths->elts, 0,
- scf->scgi_values->elts)
- == NULL)
- {
- return NGX_ERROR;
- }
-
- url.no_resolve = 1;
-
- if (ngx_parse_url(r->pool, &url) != NGX_OK) {
- if (url.err) {
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "%s in upstream \"%V\"", url.err, &url.url);
- }
-
- return NGX_ERROR;
- }
-
- if (url.no_port) {
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "no port in upstream \"%V\"", &url.url);
- return NGX_ERROR;
- }
-
- u = r->upstream;
-
- u->resolved = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_resolved_t));
- if (u->resolved == NULL) {
- return NGX_ERROR;
- }
-
- if (url.addrs && url.addrs[0].sockaddr) {
- u->resolved->sockaddr = url.addrs[0].sockaddr;
- u->resolved->socklen = url.addrs[0].socklen;
- u->resolved->naddrs = 1;
- u->resolved->host = url.addrs[0].name;
-
- } else {
- u->resolved->host = url.host;
- u->resolved->port = url.port;
- }
-
- return NGX_OK;
-}
-
-
-#if (NGX_HTTP_CACHE)
-
-static ngx_int_t
-ngx_http_scgi_create_key(ngx_http_request_t *r)
-{
- ngx_str_t *key;
- ngx_http_scgi_loc_conf_t *scf;
-
- key = ngx_array_push(&r->cache->keys);
- if (key == NULL) {
- return NGX_ERROR;
- }
-
- scf = ngx_http_get_module_loc_conf(r, ngx_http_scgi_module);
-
- if (ngx_http_complex_value(r, &scf->cache_key, key) != NGX_OK) {
- return NGX_ERROR;
- }
-
- return NGX_OK;
-}
-
-#endif
-
-
-static ngx_int_t
-ngx_http_scgi_create_request(ngx_http_request_t *r)
-{
- u_char ch, *key, *val, *lowcase_key;
- size_t len, allocated;
- ngx_buf_t *b;
- ngx_str_t *content_length;
- ngx_uint_t i, n, hash, header_params;
- ngx_chain_t *cl, *body;
- ngx_list_part_t *part;
- ngx_table_elt_t *header, **ignored;
- ngx_http_script_code_pt code;
- ngx_http_script_engine_t e, le;
- ngx_http_scgi_loc_conf_t *scf;
- ngx_http_script_len_code_pt lcode;
- static ngx_str_t zero = ngx_string("0");
-
- content_length = r->headers_in.content_length ?
- &r->headers_in.content_length->value : &zero;
-
- len = sizeof("CONTENT_LENGTH") + content_length->len + 1;
-
- header_params = 0;
- ignored = NULL;
-
- scf = ngx_http_get_module_loc_conf(r, ngx_http_scgi_module);
-
- if (scf->params_len) {
- ngx_memzero(&le, sizeof(ngx_http_script_engine_t));
-
- ngx_http_script_flush_no_cacheable_variables(r, scf->flushes);
- le.flushed = 1;
-
- le.ip = scf->params_len->elts;
- le.request = r;
-
- while (*(uintptr_t *) le.ip) {
-
- lcode = *(ngx_http_script_len_code_pt *) le.ip;
- len += lcode(&le);
-
- while (*(uintptr_t *) le.ip) {
- lcode = *(ngx_http_script_len_code_pt *) le.ip;
- len += lcode(&le) + 1;
- }
- le.ip += sizeof(uintptr_t);
- }
- }
-
- if (scf->upstream.pass_request_headers) {
-
- allocated = 0;
- lowcase_key = NULL;
-
- if (scf->header_params) {
- ignored = ngx_palloc(r->pool, scf->header_params * sizeof(void *));
- if (ignored == NULL) {
- return NGX_ERROR;
- }
- }
-
- part = &r->headers_in.headers.part;
- header = part->elts;
-
- for (i = 0; /* void */; i++) {
-
- if (i >= part->nelts) {
- if (part->next == NULL) {
- break;
- }
-
- part = part->next;
- header = part->elts;
- i = 0;
- }
-
- if (scf->header_params) {
- if (allocated < header[i].key.len) {
- allocated = header[i].key.len + 16;
- lowcase_key = ngx_pnalloc(r->pool, allocated);
- if (lowcase_key == NULL) {
- return NGX_ERROR;
- }
- }
-
- hash = 0;
-
- for (n = 0; n < header[i].key.len; n++) {
- ch = header[i].key.data[n];
-
- if (ch >= 'A' && ch <= 'Z') {
- ch |= 0x20;
-
- } else if (ch == '-') {
- ch = '_';
- }
-
- hash = ngx_hash(hash, ch);
- lowcase_key[n] = ch;
- }
-
- if (ngx_hash_find(&scf->headers_hash, hash, lowcase_key, n)) {
- ignored[header_params++] = &header[i];
- continue;
- }
- }
-
- len += sizeof("HTTP_") - 1 + header[i].key.len + 1
- + header[i].value.len + 1;
- }
- }
-
- /* netstring: "length:" + packet + "," */
-
- b = ngx_create_temp_buf(r->pool, NGX_SIZE_T_LEN + 1 + len + 1);
- if (b == NULL) {
- return NGX_ERROR;
- }
-
- cl = ngx_alloc_chain_link(r->pool);
- if (cl == NULL) {
- return NGX_ERROR;
- }
-
- cl->buf = b;
-
- b->last = ngx_snprintf(b->last,
- NGX_SIZE_T_LEN + 1 + sizeof("CONTENT_LENGTH")
- + NGX_OFF_T_LEN + 1,
- "%ui:CONTENT_LENGTH%Z%V%Z",
- len, content_length);
-
- if (scf->params_len) {
- ngx_memzero(&e, sizeof(ngx_http_script_engine_t));
-
- e.ip = scf->params->elts;
- e.pos = b->last;
- e.request = r;
- e.flushed = 1;
-
- while (*(uintptr_t *) e.ip) {
-
-#if (NGX_DEBUG)
- key = e.pos;
-#endif
- code = *(ngx_http_script_code_pt *) e.ip;
- code((ngx_http_script_engine_t *) & e);
-
-#if (NGX_DEBUG)
- val = e.pos;
-#endif
- while (*(uintptr_t *) e.ip) {
- code = *(ngx_http_script_code_pt *) e.ip;
- code((ngx_http_script_engine_t *) &e);
- }
- *e.pos++ = '\0';
- e.ip += sizeof(uintptr_t);
-
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "scgi param: \"%s: %s\"", key, val);
- }
-
- b->last = e.pos;
- }
-
- if (scf->upstream.pass_request_headers) {
-
- part = &r->headers_in.headers.part;
- header = part->elts;
-
- for (i = 0; /* void */; i++) {
-
- if (i >= part->nelts) {
- if (part->next == NULL) {
- break;
- }
-
- part = part->next;
- header = part->elts;
- i = 0;
- }
-
- for (n = 0; n < header_params; n++) {
- if (&header[i] == ignored[n]) {
- goto next;
- }
- }
-
- key = b->last;
- b->last = ngx_cpymem(key, "HTTP_", sizeof("HTTP_") - 1);
-
- for (n = 0; n < header[i].key.len; n++) {
- ch = header[i].key.data[n];
-
- if (ch >= 'a' && ch <= 'z') {
- ch &= ~0x20;
-
- } else if (ch == '-') {
- ch = '_';
- }
-
- *b->last++ = ch;
- }
-
- *b->last++ = (u_char) 0;
-
- val = b->last;
- b->last = ngx_copy(val, header[i].value.data, header[i].value.len);
- *b->last++ = (u_char) 0;
-
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "scgi param: \"%s: %s\"", key, val);
-
- next:
-
- continue;
- }
- }
-
- *b->last++ = (u_char) ',';
-
- if (scf->upstream.pass_request_body) {
- body = r->upstream->request_bufs;
- r->upstream->request_bufs = cl;
-
- while (body) {
- b = ngx_alloc_buf(r->pool);
- if (b == NULL) {
- return NGX_ERROR;
- }
-
- ngx_memcpy(b, body->buf, sizeof(ngx_buf_t));
-
- cl->next = ngx_alloc_chain_link(r->pool);
- if (cl->next == NULL) {
- return NGX_ERROR;
- }
-
- cl = cl->next;
- cl->buf = b;
-
- body = body->next;
- }
-
- } else {
- r->upstream->request_bufs = cl;
- }
-
- cl->next = NULL;
-
- return NGX_OK;
-}
-
-
-static ngx_int_t
-ngx_http_scgi_reinit_request(ngx_http_request_t *r)
-{
- ngx_http_status_t *status;
-
- status = ngx_http_get_module_ctx(r, ngx_http_scgi_module);
-
- if (status == NULL) {
- return NGX_OK;
- }
-
- status->code = 0;
- status->count = 0;
- status->start = NULL;
- status->end = NULL;
-
- r->upstream->process_header = ngx_http_scgi_process_status_line;
-
- return NGX_OK;
-}
-
-
-static ngx_int_t
-ngx_http_scgi_process_status_line(ngx_http_request_t *r)
-{
- size_t len;
- ngx_int_t rc;
- ngx_http_status_t *status;
- ngx_http_upstream_t *u;
-
- status = ngx_http_get_module_ctx(r, ngx_http_scgi_module);
-
- if (status == NULL) {
- return NGX_ERROR;
- }
-
- u = r->upstream;
-
- rc = ngx_http_parse_status_line(r, &u->buffer, status);
-
- if (rc == NGX_AGAIN) {
- return rc;
- }
-
- if (rc == NGX_ERROR) {
-
- r->http_version = NGX_HTTP_VERSION_9;
-
- u->process_header = ngx_http_scgi_process_header;
-
- return ngx_http_scgi_process_header(r);
- }
-
- if (u->state) {
- u->state->status = status->code;
- }
-
- u->headers_in.status_n = status->code;
-
- len = status->end - status->start;
- u->headers_in.status_line.len = len;
-
- u->headers_in.status_line.data = ngx_pnalloc(r->pool, len);
- if (u->headers_in.status_line.data == NULL) {
- return NGX_ERROR;
- }
-
- ngx_memcpy(u->headers_in.status_line.data, status->start, len);
-
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "http scgi status %ui \"%V\"",
- u->headers_in.status_n, &u->headers_in.status_line);
-
- u->process_header = ngx_http_scgi_process_header;
-
- return ngx_http_scgi_process_header(r);
-}
-
-
-static ngx_int_t
-ngx_http_scgi_process_header(ngx_http_request_t *r)
-{
- ngx_str_t *status_line;
- ngx_int_t rc, status;
- ngx_table_elt_t *h;
- ngx_http_upstream_t *u;
- ngx_http_upstream_header_t *hh;
- ngx_http_upstream_main_conf_t *umcf;
-
- umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module);
-
- for ( ;; ) {
-
- rc = ngx_http_parse_header_line(r, &r->upstream->buffer, 1);
-
- if (rc == NGX_OK) {
-
- /* a header line has been parsed successfully */
-
- h = ngx_list_push(&r->upstream->headers_in.headers);
- if (h == NULL) {
- return NGX_ERROR;
- }
-
- h->hash = r->header_hash;
-
- h->key.len = r->header_name_end - r->header_name_start;
- h->value.len = r->header_end - r->header_start;
-
- h->key.data = ngx_pnalloc(r->pool,
- h->key.len + 1 + h->value.len + 1
- + h->key.len);
- if (h->key.data == NULL) {
- return NGX_ERROR;
- }
-
- h->value.data = h->key.data + h->key.len + 1;
- h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1;
-
- ngx_cpystrn(h->key.data, r->header_name_start, h->key.len + 1);
- ngx_cpystrn(h->value.data, r->header_start, h->value.len + 1);
-
- if (h->key.len == r->lowcase_index) {
- ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len);
-
- } else {
- ngx_strlow(h->lowcase_key, h->key.data, h->key.len);
- }
-
- hh = ngx_hash_find(&umcf->headers_in_hash, h->hash,
- h->lowcase_key, h->key.len);
-
- if (hh && hh->handler(r, h, hh->offset) != NGX_OK) {
- return NGX_ERROR;
- }
-
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "http scgi header: \"%V: %V\"", &h->key, &h->value);
-
- continue;
- }
-
- if (rc == NGX_HTTP_PARSE_HEADER_DONE) {
-
- /* a whole header has been parsed successfully */
-
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "http scgi header done");
-
- if (r->http_version > NGX_HTTP_VERSION_9) {
- return NGX_OK;
- }
-
- u = r->upstream;
-
- if (u->headers_in.status) {
- status_line = &u->headers_in.status->value;
-
- status = ngx_atoi(status_line->data, 3);
- if (status == NGX_ERROR) {
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "upstream sent invalid status \"%V\"",
- status_line);
- return NGX_HTTP_UPSTREAM_INVALID_HEADER;
- }
-
- r->http_version = NGX_HTTP_VERSION_10;
- u->headers_in.status_n = status;
- u->headers_in.status_line = *status_line;
-
- } else if (u->headers_in.location) {
- r->http_version = NGX_HTTP_VERSION_10;
- u->headers_in.status_n = 302;
- ngx_str_set(&u->headers_in.status_line,
- "302 Moved Temporarily");
-
- } else {
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "upstream sent neither valid HTTP/1.0 header "
- "nor \"Status\" header line");
- u->headers_in.status_n = 200;
- ngx_str_set(&u->headers_in.status_line, "200 OK");
- }
-
- if (u->state) {
- u->state->status = u->headers_in.status_n;
- }
-
- return NGX_OK;
- }
-
- if (rc == NGX_AGAIN) {
- return NGX_AGAIN;
- }
-
- /* there was error while a header line parsing */
-
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "upstream sent invalid header");
-
- return NGX_HTTP_UPSTREAM_INVALID_HEADER;
- }
-}
-
-
-static void
-ngx_http_scgi_abort_request(ngx_http_request_t *r)
-{
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "abort http scgi request");
-
- return;
-}
-
-
-static void
-ngx_http_scgi_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
-{
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "finalize http scgi request");
-
- return;
-}
-
-
-static void *
-ngx_http_scgi_create_loc_conf(ngx_conf_t *cf)
-{
- ngx_http_scgi_loc_conf_t *conf;
-
- conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_scgi_loc_conf_t));
- if (conf == NULL) {
- return NULL;
- }
-
- conf->upstream.store = NGX_CONF_UNSET;
- conf->upstream.store_access = NGX_CONF_UNSET_UINT;
- conf->upstream.buffering = NGX_CONF_UNSET;
- conf->upstream.ignore_client_abort = NGX_CONF_UNSET;
-
- conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC;
- conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC;
- conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC;
-
- conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE;
- conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE;
-
- conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE;
- conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE;
- conf->upstream.temp_file_write_size_conf = NGX_CONF_UNSET_SIZE;
-
- conf->upstream.pass_request_headers = NGX_CONF_UNSET;
- conf->upstream.pass_request_body = NGX_CONF_UNSET;
-
-#if (NGX_HTTP_CACHE)
- conf->upstream.cache = NGX_CONF_UNSET_PTR;
- conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT;
- conf->upstream.cache_bypass = NGX_CONF_UNSET_PTR;
- conf->upstream.no_cache = NGX_CONF_UNSET_PTR;
- conf->upstream.cache_valid = NGX_CONF_UNSET_PTR;
-#endif
-
- conf->upstream.hide_headers = NGX_CONF_UNSET_PTR;
- conf->upstream.pass_headers = NGX_CONF_UNSET_PTR;
-
- conf->upstream.intercept_errors = NGX_CONF_UNSET;
-
- /* "scgi_cyclic_temp_file" is disabled */
- conf->upstream.cyclic_temp_file = 0;
-
- return conf;
-}
-
-
-static char *
-ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
-{
- ngx_http_scgi_loc_conf_t *prev = parent;
- ngx_http_scgi_loc_conf_t *conf = child;
-
- u_char *p;
- size_t size;
- uintptr_t *code;
- ngx_uint_t i;
- ngx_array_t headers_names;
- ngx_keyval_t *src;
- ngx_hash_key_t *hk;
- ngx_hash_init_t hash;
- ngx_http_core_loc_conf_t *clcf;
- ngx_http_script_compile_t sc;
- ngx_http_script_copy_code_t *copy;
-
- if (conf->upstream.store != 0) {
- ngx_conf_merge_value(conf->upstream.store, prev->upstream.store, 0);
-
- if (conf->upstream.store_lengths == NULL) {
- conf->upstream.store_lengths = prev->upstream.store_lengths;
- conf->upstream.store_values = prev->upstream.store_values;
- }
- }
-
- ngx_conf_merge_uint_value(conf->upstream.store_access,
- prev->upstream.store_access, 0600);
-
- ngx_conf_merge_value(conf->upstream.buffering,
- prev->upstream.buffering, 1);
-
- ngx_conf_merge_value(conf->upstream.ignore_client_abort,
- prev->upstream.ignore_client_abort, 0);
-
- ngx_conf_merge_msec_value(conf->upstream.connect_timeout,
- prev->upstream.connect_timeout, 60000);
-
- ngx_conf_merge_msec_value(conf->upstream.send_timeout,
- prev->upstream.send_timeout, 60000);
-
- ngx_conf_merge_msec_value(conf->upstream.read_timeout,
- prev->upstream.read_timeout, 60000);
-
- ngx_conf_merge_size_value(conf->upstream.send_lowat,
- prev->upstream.send_lowat, 0);
-
- ngx_conf_merge_size_value(conf->upstream.buffer_size,
- prev->upstream.buffer_size,
- (size_t) ngx_pagesize);
-
-
- ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs,
- 8, ngx_pagesize);
-
- if (conf->upstream.bufs.num < 2) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "there must be at least 2 \"scgi_buffers\"");
- return NGX_CONF_ERROR;
- }
-
-
- size = conf->upstream.buffer_size;
- if (size < conf->upstream.bufs.size) {
- size = conf->upstream.bufs.size;
- }
-
-
- ngx_conf_merge_size_value(conf->upstream.busy_buffers_size_conf,
- prev->upstream.busy_buffers_size_conf,
- NGX_CONF_UNSET_SIZE);
-
- if (conf->upstream.busy_buffers_size_conf == NGX_CONF_UNSET_SIZE) {
- conf->upstream.busy_buffers_size = 2 * size;
- } else {
- conf->upstream.busy_buffers_size =
- conf->upstream.busy_buffers_size_conf;
- }
-
- if (conf->upstream.busy_buffers_size < size) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "\"scgi_busy_buffers_size\" must be equal or bigger "
- "than maximum of the value of \"scgi_buffer_size\" and "
- "one of the \"scgi_buffers\"");
-
- return NGX_CONF_ERROR;
- }
-
- if (conf->upstream.busy_buffers_size
- > (conf->upstream.bufs.num - 1) * conf->upstream.bufs.size)
- {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "\"scgi_busy_buffers_size\" must be less than "
- "the size of all \"scgi_buffers\" minus one buffer");
-
- return NGX_CONF_ERROR;
- }
-
-
- ngx_conf_merge_size_value(conf->upstream.temp_file_write_size_conf,
- prev->upstream.temp_file_write_size_conf,
- NGX_CONF_UNSET_SIZE);
-
- if (conf->upstream.temp_file_write_size_conf == NGX_CONF_UNSET_SIZE) {
- conf->upstream.temp_file_write_size = 2 * size;
- } else {
- conf->upstream.temp_file_write_size =
- conf->upstream.temp_file_write_size_conf;
- }
-
- if (conf->upstream.temp_file_write_size < size) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "\"scgi_temp_file_write_size\" must be equal or bigger than "
- "maximum of the value of \"scgi_buffer_size\" and "
- "one of the \"scgi_buffers\"");
-
- return NGX_CONF_ERROR;
- }
-
-
- ngx_conf_merge_size_value(conf->upstream.max_temp_file_size_conf,
- prev->upstream.max_temp_file_size_conf,
- NGX_CONF_UNSET_SIZE);
-
- if (conf->upstream.max_temp_file_size_conf == NGX_CONF_UNSET_SIZE) {
- conf->upstream.max_temp_file_size = 1024 * 1024 * 1024;
- } else {
- conf->upstream.max_temp_file_size =
- conf->upstream.max_temp_file_size_conf;
- }
-
- if (conf->upstream.max_temp_file_size != 0
- && conf->upstream.max_temp_file_size < size) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "\"scgi_max_temp_file_size\" must be equal to zero to disable "
- "the temporary files usage or must be equal or bigger than "
- "maximum of the value of \"scgi_buffer_size\" and "
- "one of the \"scgi_buffers\"");
-
- return NGX_CONF_ERROR;
- }
-
-
- ngx_conf_merge_bitmask_value(conf->upstream.ignore_headers,
- prev->upstream.ignore_headers,
- NGX_CONF_BITMASK_SET);
-
-
- ngx_conf_merge_bitmask_value(conf->upstream.next_upstream,
- prev->upstream.next_upstream,
- (NGX_CONF_BITMASK_SET
- |NGX_HTTP_UPSTREAM_FT_ERROR
- |NGX_HTTP_UPSTREAM_FT_TIMEOUT));
-
- if (conf->upstream.next_upstream & NGX_HTTP_UPSTREAM_FT_OFF) {
- conf->upstream.next_upstream = NGX_CONF_BITMASK_SET
- |NGX_HTTP_UPSTREAM_FT_OFF;
- }
-
- if (ngx_conf_merge_path_value(cf, &conf->upstream.temp_path,
- prev->upstream.temp_path,
- &ngx_http_scgi_temp_path)
- != NGX_OK)
- {
- return NGX_CONF_ERROR;
- }
-
-#if (NGX_HTTP_CACHE)
-
- ngx_conf_merge_ptr_value(conf->upstream.cache,
- prev->upstream.cache, NULL);
-
- if (conf->upstream.cache && conf->upstream.cache->data == NULL) {
- ngx_shm_zone_t *shm_zone;
-
- shm_zone = conf->upstream.cache;
-
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "\"scgi_cache\" zone \"%V\" is unknown",
- &shm_zone->shm.name);
-
- return NGX_CONF_ERROR;
- }
-
- ngx_conf_merge_uint_value(conf->upstream.cache_min_uses,
- prev->upstream.cache_min_uses, 1);
-
- ngx_conf_merge_bitmask_value(conf->upstream.cache_use_stale,
- prev->upstream.cache_use_stale,
- (NGX_CONF_BITMASK_SET
- |NGX_HTTP_UPSTREAM_FT_OFF));
-
- if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_OFF) {
- conf->upstream.cache_use_stale = NGX_CONF_BITMASK_SET
- |NGX_HTTP_UPSTREAM_FT_OFF;
- }
-
- if (conf->upstream.cache_methods == 0) {
- conf->upstream.cache_methods = prev->upstream.cache_methods;
- }
-
- conf->upstream.cache_methods |= NGX_HTTP_GET|NGX_HTTP_HEAD;
-
- ngx_conf_merge_ptr_value(conf->upstream.cache_bypass,
- prev->upstream.cache_bypass, NULL);
-
- 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);
-
- if (conf->cache_key.value.data == NULL) {
- conf->cache_key = prev->cache_key;
- }
-
-#endif
-
- ngx_conf_merge_value(conf->upstream.pass_request_headers,
- prev->upstream.pass_request_headers, 1);
- ngx_conf_merge_value(conf->upstream.pass_request_body,
- prev->upstream.pass_request_body, 1);
-
- ngx_conf_merge_value(conf->upstream.intercept_errors,
- prev->upstream.intercept_errors, 0);
-
- hash.max_size = 512;
- hash.bucket_size = ngx_align(64, ngx_cacheline_size);
- hash.name = "scgi_hide_headers_hash";
-
- if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream,
- &prev->upstream, ngx_http_scgi_hide_headers, &hash)
- != NGX_OK)
- {
- return NGX_CONF_ERROR;
- }
-
- if (conf->upstream.upstream == NULL) {
- conf->upstream.upstream = prev->upstream.upstream;
- }
-
- if (conf->scgi_lengths == NULL) {
- conf->scgi_lengths = prev->scgi_lengths;
- conf->scgi_values = prev->scgi_values;
- }
-
- if (conf->upstream.upstream || conf->scgi_lengths) {
- clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
- if (clcf->handler == NULL && clcf->lmt_excpt) {
- clcf->handler = ngx_http_scgi_handler;
- }
- }
-
- if (conf->params_source == NULL) {
- conf->flushes = prev->flushes;
- conf->params_len = prev->params_len;
- conf->params = prev->params;
- conf->params_source = prev->params_source;
- conf->headers_hash = prev->headers_hash;
-
-#if (NGX_HTTP_CACHE)
-
- if (conf->params_source == NULL) {
-
- if ((conf->upstream.cache == NULL)
- == (prev->upstream.cache == NULL))
- {
- return NGX_CONF_OK;
- }
-
- /* 6 is a number of ngx_http_scgi_cache_headers entries */
- conf->params_source = ngx_array_create(cf->pool, 6,
- sizeof(ngx_keyval_t));
- if (conf->params_source == NULL) {
- return NGX_CONF_ERROR;
- }
- }
-#else
-
- if (conf->params_source == NULL) {
- return NGX_CONF_OK;
- }
-
-#endif
- }
-
- conf->params_len = ngx_array_create(cf->pool, 64, 1);
- if (conf->params_len == NULL) {
- return NGX_CONF_ERROR;
- }
-
- conf->params = ngx_array_create(cf->pool, 512, 1);
- if (conf->params == NULL) {
- return NGX_CONF_ERROR;
- }
-
- if (ngx_array_init(&headers_names, cf->temp_pool, 4, sizeof(ngx_hash_key_t))
- != NGX_OK)
- {
- return NGX_CONF_ERROR;
- }
-
- src = conf->params_source->elts;
-
-#if (NGX_HTTP_CACHE)
-
- if (conf->upstream.cache) {
- ngx_keyval_t *h, *s;
-
- for (h = ngx_http_scgi_cache_headers; h->key.len; h++) {
-
- for (i = 0; i < conf->params_source->nelts; i++) {
- if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) {
- goto next;
- }
- }
-
- s = ngx_array_push(conf->params_source);
- if (s == NULL) {
- return NGX_CONF_ERROR;
- }
-
- *s = *h;
-
- src = conf->params_source->elts;
-
- next:
-
- h++;
- }
- }
-
-#endif
-
- for (i = 0; i < conf->params_source->nelts; i++) {
-
- if (src[i].key.len > sizeof("HTTP_") - 1
- && ngx_strncmp(src[i].key.data, "HTTP_", sizeof("HTTP_") - 1) == 0)
- {
- hk = ngx_array_push(&headers_names);
- if (hk == NULL) {
- return NGX_CONF_ERROR;
- }
-
- hk->key.len = src[i].key.len - 5;
- hk->key.data = src[i].key.data + 5;
- hk->key_hash = ngx_hash_key_lc(hk->key.data, hk->key.len);
- hk->value = (void *) 1;
-
- if (src[i].value.len == 0) {
- continue;
- }
- }
-
- copy = ngx_array_push_n(conf->params_len,
- sizeof(ngx_http_script_copy_code_t));
- if (copy == NULL) {
- return NGX_CONF_ERROR;
- }
-
- copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
- copy->len = src[i].key.len + 1;
-
-
- size = (sizeof(ngx_http_script_copy_code_t)
- + src[i].key.len + 1 + sizeof(uintptr_t) - 1)
- & ~(sizeof(uintptr_t) - 1);
-
- copy = ngx_array_push_n(conf->params, size);
- if (copy == NULL) {
- return NGX_CONF_ERROR;
- }
-
- copy->code = ngx_http_script_copy_code;
- copy->len = src[i].key.len + 1;
-
- p = (u_char *) copy + sizeof(ngx_http_script_copy_code_t);
- (void) ngx_cpystrn(p, src[i].key.data, src[i].key.len + 1);
-
-
- ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
-
- sc.cf = cf;
- sc.source = &src[i].value;
- sc.flushes = &conf->flushes;
- sc.lengths = &conf->params_len;
- sc.values = &conf->params;
-
- if (ngx_http_script_compile(&sc) != NGX_OK) {
- return NGX_CONF_ERROR;
- }
-
- code = ngx_array_push_n(conf->params_len, sizeof(uintptr_t));
- if (code == NULL) {
- return NGX_CONF_ERROR;
- }
-
- *code = (uintptr_t) NULL;
-
-
- code = ngx_array_push_n(conf->params, sizeof(uintptr_t));
- if (code == NULL) {
- return NGX_CONF_ERROR;
- }
-
- *code = (uintptr_t) NULL;
- }
-
- code = ngx_array_push_n(conf->params_len, sizeof(uintptr_t));
- if (code == NULL) {
- return NGX_CONF_ERROR;
- }
-
- *code = (uintptr_t) NULL;
-
- code = ngx_array_push_n(conf->params, sizeof(uintptr_t));
- if (code == NULL) {
- return NGX_CONF_ERROR;
- }
-
- *code = (uintptr_t) NULL;
-
- conf->header_params = headers_names.nelts;
-
- hash.hash = &conf->headers_hash;
- hash.key = ngx_hash_key_lc;
- hash.max_size = 512;
- hash.bucket_size = 64;
- hash.name = "scgi_params_hash";
- hash.pool = cf->pool;
- hash.temp_pool = NULL;
-
- if (ngx_hash_init(&hash, headers_names.elts, headers_names.nelts) != NGX_OK)
- {
- return NGX_CONF_ERROR;
- }
-
- return NGX_CONF_OK;
-}
-
-
-static char *
-ngx_http_scgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
-{
- ngx_http_scgi_loc_conf_t *scf = conf;
-
- ngx_url_t u;
- ngx_str_t *value, *url;
- ngx_uint_t n;
- ngx_http_core_loc_conf_t *clcf;
- ngx_http_script_compile_t sc;
-
- if (scf->upstream.upstream || scf->scgi_lengths) {
- return "is duplicate";
- }
-
- clcf = ngx_http_conf_get_module_loc_conf (cf, ngx_http_core_module);
- clcf->handler = ngx_http_scgi_handler;
-
- value = cf->args->elts;
-
- url = &value[1];
-
- n = ngx_http_script_variables_count(url);
-
- if (n) {
-
- ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
-
- sc.cf = cf;
- sc.source = url;
- sc.lengths = &scf->scgi_lengths;
- sc.values = &scf->scgi_values;
- sc.variables = n;
- sc.complete_lengths = 1;
- sc.complete_values = 1;
-
- if (ngx_http_script_compile(&sc) != NGX_OK) {
- return NGX_CONF_ERROR;
- }
-
- return NGX_CONF_OK;
- }
-
- ngx_memzero(&u, sizeof(ngx_url_t));
-
- u.url = value[1];
- u.no_resolve = 1;
-
- scf->upstream.upstream = ngx_http_upstream_add(cf, &u, 0);
- if (scf->upstream.upstream == NULL) {
- return NGX_CONF_ERROR;
- }
-
- if (clcf->name.data[clcf->name.len - 1] == '/') {
- clcf->auto_redirect = 1;
- }
-
- return NGX_CONF_OK;
-}
-
-
-static char *
-ngx_http_scgi_store(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
-{
- ngx_http_scgi_loc_conf_t *scf = conf;
-
- ngx_str_t *value;
- ngx_http_script_compile_t sc;
-
- if (scf->upstream.store != NGX_CONF_UNSET || scf->upstream.store_lengths) {
- return "is duplicate";
- }
-
- value = cf->args->elts;
-
- if (ngx_strcmp(value[1].data, "off") == 0) {
- scf->upstream.store = 0;
- return NGX_CONF_OK;
- }
-
-#if (NGX_HTTP_CACHE)
-
- if (scf->upstream.cache != NGX_CONF_UNSET_PTR
- && scf->upstream.cache != NULL)
- {
- return "is incompatible with \"scgi_cache\"";
- }
-
-#endif
-
- if (ngx_strcmp(value[1].data, "on") == 0) {
- scf->upstream.store = 1;
- return NGX_CONF_OK;
- }
-
- /* include the terminating '\0' into script */
- value[1].len++;
-
- ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
-
- sc.cf = cf;
- sc.source = &value[1];
- sc.lengths = &scf->upstream.store_lengths;
- sc.values = &scf->upstream.store_values;
- sc.variables = ngx_http_script_variables_count(&value[1]);;
- sc.complete_lengths = 1;
- sc.complete_values = 1;
-
- if (ngx_http_script_compile(&sc) != NGX_OK) {
- return NGX_CONF_ERROR;
- }
-
- return NGX_CONF_OK;
-}
-
-
-#if (NGX_HTTP_CACHE)
-
-static char *
-ngx_http_scgi_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
-{
- ngx_http_scgi_loc_conf_t *scf = conf;
-
- ngx_str_t *value;
-
- value = cf->args->elts;
-
- if (scf->upstream.cache != NGX_CONF_UNSET_PTR) {
- return "is duplicate";
- }
-
- if (ngx_strcmp(value[1].data, "off") == 0) {
- scf->upstream.cache = NULL;
- return NGX_CONF_OK;
- }
-
- if (scf->upstream.store > 0 || scf->upstream.store_lengths) {
- return "is incompatible with \"scgi_store\"";
- }
-
- scf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0,
- &ngx_http_scgi_module);
- if (scf->upstream.cache == NULL) {
- return NGX_CONF_ERROR;
- }
-
- return NGX_CONF_OK;
-}
-
-
-static char *
-ngx_http_scgi_cache_key(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
-{
- ngx_http_scgi_loc_conf_t *scf = conf;
-
- ngx_str_t *value;
- ngx_http_compile_complex_value_t ccv;
-
- value = cf->args->elts;
-
- if (scf->cache_key.value.len) {
- return "is duplicate";
- }
-
- ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
-
- ccv.cf = cf;
- ccv.value = &value[1];
- ccv.complex_value = &scf->cache_key;
-
- if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
- return NGX_CONF_ERROR;
- }
-
- return NGX_CONF_OK;
-}
-
-#endif
|
[-]
[+]
|
Deleted |
nginx-0.8.52.tar.gz/src/http/modules/ngx_http_split_clients_module.c
^
|
@@ -1,241 +0,0 @@
-
-/*
- * Copyright (C) Igor Sysoev
- */
-
-
-#include <ngx_config.h>
-#include <ngx_core.h>
-#include <ngx_http.h>
-
-
-typedef struct {
- uint32_t percent;
- ngx_http_variable_value_t value;
-} ngx_http_split_clients_part_t;
-
-
-typedef struct {
- ngx_http_complex_value_t value;
- ngx_array_t parts;
-} ngx_http_split_clients_ctx_t;
-
-
-static char *ngx_conf_split_clients_block(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf);
-static char *ngx_http_split_clients(ngx_conf_t *cf, ngx_command_t *dummy,
- void *conf);
-
-static ngx_command_t ngx_http_split_clients_commands[] = {
-
- { ngx_string("split_clients"),
- NGX_HTTP_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_TAKE2,
- ngx_conf_split_clients_block,
- NGX_HTTP_MAIN_CONF_OFFSET,
- 0,
- NULL },
-
- ngx_null_command
-};
-
-
-static ngx_http_module_t ngx_http_split_clients_module_ctx = {
- NULL, /* preconfiguration */
- NULL, /* postconfiguration */
-
- NULL, /* 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_split_clients_module = {
- NGX_MODULE_V1,
- &ngx_http_split_clients_module_ctx, /* module context */
- ngx_http_split_clients_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_int_t
-ngx_http_split_clients_variable(ngx_http_request_t *r,
- ngx_http_variable_value_t *v, uintptr_t data)
-{
- ngx_http_split_clients_ctx_t *ctx = (ngx_http_split_clients_ctx_t *) data;
-
- uint32_t hash;
- ngx_str_t val;
- ngx_uint_t i;
- ngx_http_split_clients_part_t *part;
-
- *v = ngx_http_variable_null_value;
-
- if (ngx_http_complex_value(r, &ctx->value, &val) != NGX_OK) {
- return NGX_OK;
- }
-
- hash = ngx_crc32_short(val.data, val.len);
-
- part = ctx->parts.elts;
-
- for (i = 0; i < ctx->parts.nelts; i++) {
-
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "%D %D", hash, part[i].percent);
-
- if (hash < part[i].percent) {
- *v = part[i].value;
- return NGX_OK;
- }
- }
-
- return NGX_OK;
-}
-
-
-static char *
-ngx_conf_split_clients_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
-{
- char *rv;
- ngx_str_t *value, name;
- ngx_uint_t i, sum, last;
- ngx_conf_t save;
- ngx_http_variable_t *var;
- ngx_http_split_clients_ctx_t *ctx;
- ngx_http_split_clients_part_t *part;
- ngx_http_compile_complex_value_t ccv;
-
- ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_split_clients_ctx_t));
- if (ctx == NULL) {
- return NGX_CONF_ERROR;
- }
-
- value = cf->args->elts;
-
- ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
-
- ccv.cf = cf;
- ccv.value = &value[1];
- ccv.complex_value = &ctx->value;
-
- if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
- return NGX_CONF_ERROR;
- }
-
- name = value[2];
- name.len--;
- name.data++;
-
- var = ngx_http_add_variable(cf, &name, NGX_HTTP_VAR_CHANGEABLE);
- if (var == NULL) {
- return NGX_CONF_ERROR;
- }
-
- var->get_handler = ngx_http_split_clients_variable;
- var->data = (uintptr_t) ctx;
-
- if (ngx_array_init(&ctx->parts, cf->pool, 2,
- sizeof(ngx_http_split_clients_part_t))
- != NGX_OK)
- {
- return NGX_CONF_ERROR;
- }
-
- save = *cf;
- cf->ctx = ctx;
- cf->handler = ngx_http_split_clients;
- cf->handler_conf = conf;
-
- rv = ngx_conf_parse(cf, NULL);
-
- *cf = save;
-
- if (rv != NGX_CONF_OK) {
- return rv;
- }
-
- sum = 0;
- last = 0;
- part = ctx->parts.elts;
-
- for (i = 0; i < ctx->parts.nelts; i++) {
- sum = part[i].percent ? sum + part[i].percent : 10000;
- if (sum > 10000) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "percent sum is more than 100%%");
- return NGX_CONF_ERROR;
- }
-
- if (part[i].percent) {
- part[i].percent = (uint32_t)
- (last + 0xffffffff / 10000 * part[i].percent);
- } else {
- part[i].percent = 0xffffffff;
- }
-
- last = part[i].percent;
- }
-
- return rv;
-}
-
-
-static char *
-ngx_http_split_clients(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
-{
- ngx_int_t n;
- ngx_str_t *value;
- ngx_http_split_clients_ctx_t *ctx;
- ngx_http_split_clients_part_t *part;
-
- ctx = cf->ctx;
- value = cf->args->elts;
-
- part = ngx_array_push(&ctx->parts);
- if (part == NULL) {
- return NGX_CONF_ERROR;
- }
-
- if (value[0].len == 1 && value[0].data[0] == '*') {
- part->percent = 0;
-
- } else {
- if (value[0].data[value[0].len - 1] != '%') {
- goto invalid;
- }
-
- n = ngx_atofp(value[0].data, value[0].len - 1, 2);
- if (n == NGX_ERROR || n == 0) {
- goto invalid;
- }
-
- part->percent = (uint32_t) n;
- }
-
- part->value.len = value[1].len;
- part->value.valid = 1;
- part->value.no_cacheable = 0;
- part->value.not_found = 0;
- part->value.data = value[1].data;
-
- return NGX_CONF_OK;
-
-invalid:
-
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "invalid percent value \"%V\"", &value[0]);
- return NGX_CONF_ERROR;
-}
|
[-]
[+]
|
Deleted |
nginx-0.8.52.tar.gz/src/http/modules/ngx_http_uwsgi_module.c
^
|
@@ -1,1713 +0,0 @@
-
-/*
- * Copyright (C) Unbit S.a.s. 2009-2010
- * Copyright (C) 2008 Manlio Perillo (manlio.perillo@gmail.com)
- * Copyright (C) Igor Sysoev
- */
-
-
-#include <ngx_config.h>
-#include <ngx_core.h>
-#include <ngx_http.h>
-
-
-typedef struct {
- ngx_http_upstream_conf_t upstream;
-
- ngx_array_t *flushes;
- ngx_array_t *params_len;
- ngx_array_t *params;
- ngx_array_t *params_source;
-
- ngx_hash_t headers_hash;
- ngx_uint_t header_params;
-
- ngx_array_t *uwsgi_lengths;
- ngx_array_t *uwsgi_values;
-
-#if (NGX_HTTP_CACHE)
- ngx_http_complex_value_t cache_key;
-#endif
-
- ngx_str_t uwsgi_string;
-
- ngx_uint_t modifier1;
- ngx_uint_t modifier2;
-} ngx_http_uwsgi_loc_conf_t;
-
-
-static ngx_int_t ngx_http_uwsgi_eval(ngx_http_request_t *r,
- ngx_http_uwsgi_loc_conf_t *uwcf);
-static ngx_int_t ngx_http_uwsgi_create_request(ngx_http_request_t *r);
-static ngx_int_t ngx_http_uwsgi_reinit_request(ngx_http_request_t *r);
-static ngx_int_t ngx_http_uwsgi_process_status_line(ngx_http_request_t *r);
-static ngx_int_t ngx_http_uwsgi_process_header(ngx_http_request_t *r);
-static ngx_int_t ngx_http_uwsgi_process_header(ngx_http_request_t *r);
-static void ngx_http_uwsgi_abort_request(ngx_http_request_t *r);
-static void ngx_http_uwsgi_finalize_request(ngx_http_request_t *r,
- ngx_int_t rc);
-
-static void *ngx_http_uwsgi_create_loc_conf(ngx_conf_t *cf);
-static char *ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent,
- void *child);
-
-static char *ngx_http_uwsgi_pass(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf);
-static char *ngx_http_uwsgi_store(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf);
-
-#if (NGX_HTTP_CACHE)
-static ngx_int_t ngx_http_uwsgi_create_key(ngx_http_request_t *r);
-static char *ngx_http_uwsgi_cache(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf);
-static char *ngx_http_uwsgi_cache_key(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf);
-#endif
-
-
-static ngx_conf_num_bounds_t ngx_http_uwsgi_modifier_bounds = {
- ngx_conf_check_num_bounds, 0, 255
-};
-
-
-static ngx_conf_bitmask_t ngx_http_uwsgi_next_upstream_masks[] = {
- { ngx_string("error"), NGX_HTTP_UPSTREAM_FT_ERROR },
- { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT },
- { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER },
- { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 },
- { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 },
- { ngx_string("http_404"), NGX_HTTP_UPSTREAM_FT_HTTP_404 },
- { ngx_string("updating"), NGX_HTTP_UPSTREAM_FT_UPDATING },
- { ngx_string("off"), NGX_HTTP_UPSTREAM_FT_OFF },
- { ngx_null_string, 0 }
-};
-
-
-ngx_module_t ngx_http_uwsgi_module;
-
-
-static ngx_command_t ngx_http_uwsgi_commands[] = {
-
- { ngx_string("uwsgi_pass"),
- NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE1,
- ngx_http_uwsgi_pass,
- NGX_HTTP_LOC_CONF_OFFSET,
- 0,
- NULL },
-
- { ngx_string("uwsgi_modifier1"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_num_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, modifier1),
- &ngx_http_uwsgi_modifier_bounds },
-
- { ngx_string("uwsgi_modifier2"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_num_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, modifier2),
- &ngx_http_uwsgi_modifier_bounds },
-
- { ngx_string("uwsgi_store"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_http_uwsgi_store,
- NGX_HTTP_LOC_CONF_OFFSET,
- 0,
- NULL },
-
- { ngx_string("uwsgi_store_access"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE123,
- ngx_conf_set_access_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.store_access),
- NULL },
-
- { ngx_string("uwsgi_ignore_client_abort"),
- 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_uwsgi_loc_conf_t, upstream.ignore_client_abort),
- NULL },
-
- { ngx_string("uwsgi_bind"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_http_upstream_bind_set_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.local),
- NULL },
-
- { ngx_string("uwsgi_connect_timeout"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_msec_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.connect_timeout),
- NULL },
-
- { ngx_string("uwsgi_send_timeout"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_msec_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.send_timeout),
- NULL },
-
- { ngx_string("uwsgi_buffer_size"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_size_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.buffer_size),
- NULL },
-
- { ngx_string("uwsgi_pass_request_headers"),
- 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_uwsgi_loc_conf_t, upstream.pass_request_headers),
- NULL },
-
- { ngx_string("uwsgi_pass_request_body"),
- 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_uwsgi_loc_conf_t, upstream.pass_request_body),
- NULL },
-
- { ngx_string("uwsgi_intercept_errors"),
- 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_uwsgi_loc_conf_t, upstream.intercept_errors),
- NULL },
-
- { ngx_string("uwsgi_read_timeout"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_msec_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.read_timeout),
- NULL },
-
- { ngx_string("uwsgi_buffers"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2,
- ngx_conf_set_bufs_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.bufs),
- NULL },
-
- { ngx_string("uwsgi_busy_buffers_size"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_size_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.busy_buffers_size_conf),
- NULL },
-
-#if (NGX_HTTP_CACHE)
-
- { ngx_string("uwsgi_cache"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_http_uwsgi_cache,
- NGX_HTTP_LOC_CONF_OFFSET,
- 0,
- NULL },
-
- { ngx_string("uwsgi_cache_key"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_http_uwsgi_cache_key,
- NGX_HTTP_LOC_CONF_OFFSET,
- 0,
- NULL },
-
- { ngx_string("uwsgi_cache_path"),
- NGX_HTTP_MAIN_CONF|NGX_CONF_2MORE,
- ngx_http_file_cache_set_slot,
- 0,
- 0,
- &ngx_http_uwsgi_module },
-
- { ngx_string("uwsgi_cache_bypass"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
- ngx_http_set_predicate_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.cache_bypass),
- NULL },
-
- { ngx_string("uwsgi_no_cache"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
- ngx_http_set_predicate_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.no_cache),
- NULL },
-
- { ngx_string("uwsgi_cache_valid"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
- ngx_http_file_cache_valid_set_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.cache_valid),
- NULL },
-
- { ngx_string("uwsgi_cache_min_uses"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_num_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.cache_min_uses),
- NULL },
-
- { ngx_string("uwsgi_cache_use_stale"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
- ngx_conf_set_bitmask_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.cache_use_stale),
- &ngx_http_uwsgi_next_upstream_masks },
-
- { ngx_string("uwsgi_cache_methods"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
- ngx_conf_set_bitmask_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.cache_methods),
- &ngx_http_upstream_cache_method_mask },
-
-#endif
-
- { ngx_string("uwsgi_temp_path"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1234,
- ngx_conf_set_path_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.temp_path),
- NULL },
-
- { ngx_string("uwsgi_max_temp_file_size"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_size_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.max_temp_file_size_conf),
- NULL },
-
- { ngx_string("uwsgi_temp_file_write_size"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_size_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.temp_file_write_size_conf),
- NULL },
-
- { ngx_string("uwsgi_next_upstream"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
- ngx_conf_set_bitmask_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.next_upstream),
- &ngx_http_uwsgi_next_upstream_masks },
-
- { ngx_string("uwsgi_param"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2,
- ngx_conf_set_keyval_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, params_source),
- NULL },
-
- { ngx_string("uwsgi_string"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_str_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, uwsgi_string),
- NULL },
-
- { ngx_string("uwsgi_pass_header"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_str_array_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.pass_headers),
- NULL },
-
- { ngx_string("uwsgi_hide_header"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_str_array_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.hide_headers),
- NULL },
-
- { ngx_string("uwsgi_ignore_headers"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
- ngx_conf_set_bitmask_slot,
- NGX_HTTP_LOC_CONF_OFFSET,
- offsetof(ngx_http_uwsgi_loc_conf_t, upstream.ignore_headers),
- &ngx_http_upstream_ignore_headers_masks },
-
- ngx_null_command
-};
-
-
-static ngx_http_module_t ngx_http_uwsgi_module_ctx = {
- NULL, /* preconfiguration */
- NULL, /* postconfiguration */
-
- NULL, /* create main configuration */
- NULL, /* init main configuration */
-
- NULL, /* create server configuration */
- NULL, /* merge server configuration */
-
- ngx_http_uwsgi_create_loc_conf, /* create location configuration */
- ngx_http_uwsgi_merge_loc_conf /* merge location configuration */
-};
-
-
-ngx_module_t ngx_http_uwsgi_module = {
- NGX_MODULE_V1,
- &ngx_http_uwsgi_module_ctx, /* module context */
- ngx_http_uwsgi_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_str_t ngx_http_uwsgi_hide_headers[] = {
- 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_null_string
-};
-
-
-#if (NGX_HTTP_CACHE)
-
-static ngx_keyval_t ngx_http_uwsgi_cache_headers[] = {
- { ngx_string("HTTP_IF_MODIFIED_SINCE"), ngx_string("") },
- { ngx_string("HTTP_IF_UNMODIFIED_SINCE"), ngx_string("") },
- { ngx_string("HTTP_IF_NONE_MATCH"), ngx_string("") },
- { ngx_string("HTTP_IF_MATCH"), ngx_string("") },
- { ngx_string("HTTP_RANGE"), ngx_string("") },
- { ngx_string("HTTP_IF_RANGE"), ngx_string("") },
- { ngx_null_string, ngx_null_string }
-};
-
-#endif
-
-
-static ngx_path_init_t ngx_http_uwsgi_temp_path = {
- ngx_string(NGX_HTTP_UWSGI_TEMP_PATH), { 1, 2, 0 }
-};
-
-
-static ngx_int_t
-ngx_http_uwsgi_handler(ngx_http_request_t *r)
-{
- ngx_int_t rc;
- ngx_http_status_t *status;
- ngx_http_upstream_t *u;
- ngx_http_uwsgi_loc_conf_t *uwcf;
-
- if (r->subrequest_in_memory) {
- ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
- "ngx_http_uwsgi_module does not support "
- "subrequests in memory");
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
-
- if (ngx_http_upstream_create(r) != NGX_OK) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
-
- status = ngx_pcalloc(r->pool, sizeof(ngx_http_status_t));
- if (status == NULL) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
-
- ngx_http_set_ctx(r, status, ngx_http_uwsgi_module);
-
- uwcf = ngx_http_get_module_loc_conf(r, ngx_http_uwsgi_module);
-
- if (uwcf->uwsgi_lengths) {
- if (ngx_http_uwsgi_eval(r, uwcf) != NGX_OK) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
- }
-
- u = r->upstream;
-
- ngx_str_set(&u->schema, "uwsgi://");
- u->output.tag = (ngx_buf_tag_t) &ngx_http_uwsgi_module;
-
- u->conf = &uwcf->upstream;
-
-#if (NGX_HTTP_CACHE)
- u->create_key = ngx_http_uwsgi_create_key;
-#endif
- u->create_request = ngx_http_uwsgi_create_request;
- u->reinit_request = ngx_http_uwsgi_reinit_request;
- u->process_header = ngx_http_uwsgi_process_status_line;
- u->abort_request = ngx_http_uwsgi_abort_request;
- u->finalize_request = ngx_http_uwsgi_finalize_request;
-
- u->buffering = 1;
-
- u->pipe = ngx_pcalloc(r->pool, sizeof(ngx_event_pipe_t));
- if (u->pipe == NULL) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
-
- u->pipe->input_filter = ngx_event_pipe_copy_input_filter;
- u->pipe->input_ctx = r;
-
- rc = ngx_http_read_client_request_body(r, ngx_http_upstream_init);
-
- if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
- return rc;
- }
-
- return NGX_DONE;
-}
-
-
-static ngx_int_t
-ngx_http_uwsgi_eval(ngx_http_request_t *r, ngx_http_uwsgi_loc_conf_t * uwcf)
-{
- ngx_url_t url;
- ngx_http_upstream_t *u;
-
- ngx_memzero(&url, sizeof(ngx_url_t));
-
- if (ngx_http_script_run(r, &url.url, uwcf->uwsgi_lengths->elts, 0,
- uwcf->uwsgi_values->elts)
- == NULL)
- {
- return NGX_ERROR;
- }
-
- url.no_resolve = 1;
-
- if (ngx_parse_url(r->pool, &url) != NGX_OK) {
- if (url.err) {
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "%s in upstream \"%V\"", url.err, &url.url);
- }
-
- return NGX_ERROR;
- }
-
- if (url.no_port) {
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "no port in upstream \"%V\"", &url.url);
- return NGX_ERROR;
- }
-
- u = r->upstream;
-
- u->resolved = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_resolved_t));
- if (u->resolved == NULL) {
- return NGX_ERROR;
- }
-
- if (url.addrs && url.addrs[0].sockaddr) {
- u->resolved->sockaddr = url.addrs[0].sockaddr;
- u->resolved->socklen = url.addrs[0].socklen;
- u->resolved->naddrs = 1;
- u->resolved->host = url.addrs[0].name;
-
- } else {
- u->resolved->host = url.host;
- u->resolved->port = url.port;
- }
-
- return NGX_OK;
-}
-
-
-#if (NGX_HTTP_CACHE)
-
-static ngx_int_t
-ngx_http_uwsgi_create_key(ngx_http_request_t *r)
-{
- ngx_str_t *key;
- ngx_http_uwsgi_loc_conf_t *uwcf;
-
- key = ngx_array_push(&r->cache->keys);
- if (key == NULL) {
- return NGX_ERROR;
- }
-
- uwcf = ngx_http_get_module_loc_conf(r, ngx_http_uwsgi_module);
-
- if (ngx_http_complex_value(r, &uwcf->cache_key, key) != NGX_OK) {
- return NGX_ERROR;
- }
-
- return NGX_OK;
-}
-
-#endif
-
-
-static ngx_int_t
-ngx_http_uwsgi_create_request(ngx_http_request_t *r)
-{
- u_char ch, *lowcase_key;
- size_t key_len, val_len, len, allocated;
- ngx_uint_t i, n, hash, header_params;
- ngx_buf_t *b;
- ngx_chain_t *cl, *body;
- ngx_list_part_t *part;
- ngx_table_elt_t *header, **ignored;
- ngx_http_script_code_pt code;
- ngx_http_script_engine_t e, le;
- ngx_http_uwsgi_loc_conf_t *uwcf;
- ngx_http_script_len_code_pt lcode;
-
- len = 0;
- header_params = 0;
- ignored = NULL;
-
- uwcf = ngx_http_get_module_loc_conf(r, ngx_http_uwsgi_module);
-
- if (uwcf->params_len) {
- ngx_memzero(&le, sizeof(ngx_http_script_engine_t));
-
- ngx_http_script_flush_no_cacheable_variables(r, uwcf->flushes);
- le.flushed = 1;
-
- le.ip = uwcf->params_len->elts;
- le.request = r;
-
- while (*(uintptr_t *) le.ip) {
-
- lcode = *(ngx_http_script_len_code_pt *) le.ip;
- key_len = lcode(&le);
-
- for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode (&le)) {
- lcode = *(ngx_http_script_len_code_pt *) le.ip;
- }
- le.ip += sizeof(uintptr_t);
-
- len += 2 + key_len + 2 + val_len;
- }
- }
-
- if (uwcf->upstream.pass_request_headers) {
-
- allocated = 0;
- lowcase_key = NULL;
-
- if (uwcf->header_params) {
- ignored = ngx_palloc(r->pool, uwcf->header_params * sizeof(void *));
- if (ignored == NULL) {
- return NGX_ERROR;
- }
- }
-
- part = &r->headers_in.headers.part;
- header = part->elts;
-
- for (i = 0; /* void */ ; i++) {
-
- if (i >= part->nelts) {
- if (part->next == NULL) {
- break;
- }
-
- part = part->next;
- header = part->elts;
- i = 0;
- }
-
- if (uwcf->header_params) {
- if (allocated < header[i].key.len) {
- allocated = header[i].key.len + 16;
- lowcase_key = ngx_pnalloc(r->pool, allocated);
- if (lowcase_key == NULL) {
- return NGX_ERROR;
- }
- }
-
- hash = 0;
-
- for (n = 0; n < header[i].key.len; n++) {
- ch = header[i].key.data[n];
-
- if (ch >= 'A' && ch <= 'Z') {
- ch |= 0x20;
-
- } else if (ch == '-') {
- ch = '_';
- }
-
- hash = ngx_hash(hash, ch);
- lowcase_key[n] = ch;
- }
-
- if (ngx_hash_find(&uwcf->headers_hash, hash, lowcase_key, n)) {
- ignored[header_params++] = &header[i];
- continue;
- }
- }
-
- len += 2 + sizeof("HTTP_") - 1 + header[i].key.len
- + 2 + header[i].value.len;
- }
- }
-
- len += uwcf->uwsgi_string.len;
-
-#if 0
- /* allow custom uwsgi packet */
- if (len > 0 && len < 2) {
- ngx_log_error (NGX_LOG_ALERT, r->connection->log, 0,
- "uwsgi request is too little: %uz", len);
- return NGX_ERROR;
- }
-#endif
-
- b = ngx_create_temp_buf(r->pool, len + 4);
- if (b == NULL) {
- return NGX_ERROR;
- }
-
- cl = ngx_alloc_chain_link(r->pool);
- if (cl == NULL) {
- return NGX_ERROR;
- }
-
- cl->buf = b;
-
- *b->last++ = (u_char) uwcf->modifier1;
- *b->last++ = (u_char) (len & 0xff);
- *b->last++ = (u_char) ((len >> 8) & 0xff);
- *b->last++ = (u_char) uwcf->modifier2;
-
- if (uwcf->params_len) {
- ngx_memzero(&e, sizeof(ngx_http_script_engine_t));
-
- e.ip = uwcf->params->elts;
- e.pos = b->last;
- e.request = r;
- e.flushed = 1;
-
- le.ip = uwcf->params_len->elts;
-
- while (*(uintptr_t *) le.ip) {
-
- lcode = *(ngx_http_script_len_code_pt *) le.ip;
- key_len = (u_char) lcode (&le);
-
- for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode(&le)) {
- lcode = *(ngx_http_script_len_code_pt *) le.ip;
- }
- le.ip += sizeof(uintptr_t);
-
- *e.pos++ = (u_char) (key_len & 0xff);
- *e.pos++ = (u_char) ((key_len >> 8) & 0xff);
-
- code = *(ngx_http_script_code_pt *) e.ip;
- code((ngx_http_script_engine_t *) & e);
-
- *e.pos++ = (u_char) (val_len & 0xff);
- *e.pos++ = (u_char) ((val_len >> 8) & 0xff);
-
- while (*(uintptr_t *) e.ip) {
- code = *(ngx_http_script_code_pt *) e.ip;
- code((ngx_http_script_engine_t *) & e);
- }
-
- e.ip += sizeof(uintptr_t);
-
- ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "uwsgi param: \"%*s: %*s\"",
- key_len, e.pos - (key_len + 2 + val_len),
- val_len, e.pos - val_len);
- }
-
- b->last = e.pos;
- }
-
- if (uwcf->upstream.pass_request_headers) {
-
- part = &r->headers_in.headers.part;
- header = part->elts;
-
- for (i = 0; /* void */ ; i++) {
-
- if (i >= part->nelts) {
- if (part->next == NULL) {
- break;
- }
-
- part = part->next;
- header = part->elts;
- i = 0;
- }
-
- for (n = 0; n < header_params; n++) {
- if (&header[i] == ignored[n]) {
- goto next;
- }
- }
-
- key_len = sizeof("HTTP_") - 1 + header[i].key.len;
- *b->last++ = (u_char) (key_len & 0xff);
- *b->last++ = (u_char) ((key_len >> 8) & 0xff);
-
- b->last = ngx_cpymem(b->last, "HTTP_", sizeof("HTTP_") - 1);
- for (n = 0; n < header[i].key.len; n++) {
- ch = header[i].key.data[n];
-
- if (ch >= 'a' && ch <= 'z') {
- ch &= ~0x20;
-
- } else if (ch == '-') {
- ch = '_';
- }
-
- *b->last++ = ch;
- }
-
- val_len = header[i].value.len;
- *b->last++ = (u_char) (val_len & 0xff);
- *b->last++ = (u_char) ((val_len >> 8) & 0xff);
- b->last = ngx_copy(b->last, header[i].value.data, val_len);
-
- ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "uwsgi param: \"%*s: %*s\"",
- key_len, b->last - (key_len + 2 + val_len),
- val_len, b->last - val_len);
- next:
-
- continue;
- }
- }
-
- b->last = ngx_copy(b->last, uwcf->uwsgi_string.data,
- uwcf->uwsgi_string.len);
-
- if (uwcf->upstream.pass_request_body) {
- body = r->upstream->request_bufs;
- r->upstream->request_bufs = cl;
-
- while (body) {
- b = ngx_alloc_buf(r->pool);
- if (b == NULL) {
- return NGX_ERROR;
- }
-
- ngx_memcpy(b, body->buf, sizeof(ngx_buf_t));
-
- cl->next = ngx_alloc_chain_link(r->pool);
- if (cl->next == NULL) {
- return NGX_ERROR;
- }
-
- cl = cl->next;
- cl->buf = b;
-
- body = body->next;
- }
-
- } else {
- r->upstream->request_bufs = cl;
- }
-
- cl->next = NULL;
-
- return NGX_OK;
-}
-
-
-static ngx_int_t
-ngx_http_uwsgi_reinit_request(ngx_http_request_t *r)
-{
- ngx_http_status_t *status;
-
- status = ngx_http_get_module_ctx(r, ngx_http_uwsgi_module);
-
- if (status == NULL) {
- return NGX_OK;
- }
-
- status->code = 0;
- status->count = 0;
- status->start = NULL;
- status->end = NULL;
-
- r->upstream->process_header = ngx_http_uwsgi_process_status_line;
-
- return NGX_OK;
-}
-
-
-static ngx_int_t
-ngx_http_uwsgi_process_status_line(ngx_http_request_t *r)
-{
- size_t len;
- ngx_int_t rc;
- ngx_http_status_t *status;
- ngx_http_upstream_t *u;
-
- status = ngx_http_get_module_ctx(r, ngx_http_uwsgi_module);
-
- if (status == NULL) {
- return NGX_ERROR;
- }
-
- u = r->upstream;
-
- rc = ngx_http_parse_status_line(r, &u->buffer, status);
-
- if (rc == NGX_AGAIN) {
- return rc;
- }
-
- if (rc == NGX_ERROR) {
- r->http_version = NGX_HTTP_VERSION_9;
-
- u->process_header = ngx_http_uwsgi_process_header;
-
- return ngx_http_uwsgi_process_header(r);
- }
-
- if (u->state) {
- u->state->status = status->code;
- }
-
- u->headers_in.status_n = status->code;
-
- len = status->end - status->start;
- u->headers_in.status_line.len = len;
-
- u->headers_in.status_line.data = ngx_pnalloc(r->pool, len);
- if (u->headers_in.status_line.data == NULL) {
- return NGX_ERROR;
- }
-
- ngx_memcpy(u->headers_in.status_line.data, status->start, len);
-
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "http uwsgi status %ui \"%V\"",
- u->headers_in.status_n, &u->headers_in.status_line);
-
- u->process_header = ngx_http_uwsgi_process_header;
-
- return ngx_http_uwsgi_process_header(r);
-}
-
-
-static ngx_int_t
-ngx_http_uwsgi_process_header(ngx_http_request_t *r)
-{
- ngx_str_t *status_line;
- ngx_int_t rc, status;
- ngx_table_elt_t *h;
- ngx_http_upstream_t *u;
- ngx_http_upstream_header_t *hh;
- ngx_http_upstream_main_conf_t *umcf;
-
- umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module);
-
- for ( ;; ) {
-
- rc = ngx_http_parse_header_line(r, &r->upstream->buffer, 1);
-
- if (rc == NGX_OK) {
-
- /* a header line has been parsed successfully */
-
- h = ngx_list_push(&r->upstream->headers_in.headers);
- if (h == NULL) {
- return NGX_ERROR;
- }
-
- h->hash = r->header_hash;
-
- h->key.len = r->header_name_end - r->header_name_start;
- h->value.len = r->header_end - r->header_start;
-
- h->key.data = ngx_pnalloc(r->pool,
- h->key.len + 1 + h->value.len + 1
- + h->key.len);
- if (h->key.data == NULL) {
- return NGX_ERROR;
- }
-
- h->value.data = h->key.data + h->key.len + 1;
- h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1;
-
- ngx_cpystrn(h->key.data, r->header_name_start, h->key.len + 1);
- ngx_cpystrn(h->value.data, r->header_start, h->value.len + 1);
-
- if (h->key.len == r->lowcase_index) {
- ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len);
-
- } else {
- ngx_strlow(h->lowcase_key, h->key.data, h->key.len);
- }
-
- hh = ngx_hash_find(&umcf->headers_in_hash, h->hash,
- h->lowcase_key, h->key.len);
-
- if (hh && hh->handler(r, h, hh->offset) != NGX_OK) {
- return NGX_ERROR;
- }
-
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "http uwsgi header: \"%V: %V\"", &h->key, &h->value);
-
- continue;
- }
-
- if (rc == NGX_HTTP_PARSE_HEADER_DONE) {
-
- /* a whole header has been parsed successfully */
-
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "http uwsgi header done");
-
- if (r->http_version > NGX_HTTP_VERSION_9) {
- return NGX_OK;
- }
-
- u = r->upstream;
-
- if (u->headers_in.status) {
- status_line = &u->headers_in.status->value;
-
- status = ngx_atoi(status_line->data, 3);
- if (status == NGX_ERROR) {
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "upstream sent invalid status \"%V\"",
- status_line);
- return NGX_HTTP_UPSTREAM_INVALID_HEADER;
- }
-
- r->http_version = NGX_HTTP_VERSION_10;
- u->headers_in.status_n = status;
- u->headers_in.status_line = *status_line;
-
- } else if (u->headers_in.location) {
- r->http_version = NGX_HTTP_VERSION_10;
- u->headers_in.status_n = 302;
- ngx_str_set(&u->headers_in.status_line,
- "302 Moved Temporarily");
-
- } else {
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "upstream sent neither valid HTTP/1.0 header "
- "nor \"Status\" header line");
- u->headers_in.status_n = 200;
- ngx_str_set(&u->headers_in.status_line, "200 OK");
- }
-
- if (u->state) {
- u->state->status = u->headers_in.status_n;
- }
-
- return NGX_OK;
- }
-
- if (rc == NGX_AGAIN) {
- return NGX_AGAIN;
- }
-
- /* there was error while a header line parsing */
-
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "upstream sent invalid header");
-
- return NGX_HTTP_UPSTREAM_INVALID_HEADER;
- }
-}
-
-
-static void
-ngx_http_uwsgi_abort_request(ngx_http_request_t *r)
-{
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "abort http uwsgi request");
-
- return;
-}
-
-
-static void
-ngx_http_uwsgi_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
-{
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "finalize http uwsgi request");
-
- return;
-}
-
-
-static void *
-ngx_http_uwsgi_create_loc_conf(ngx_conf_t *cf)
-{
- ngx_http_uwsgi_loc_conf_t *conf;
-
- conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_uwsgi_loc_conf_t));
- if (conf == NULL) {
- return NULL;
- }
-
- conf->modifier1 = NGX_CONF_UNSET_UINT;
- conf->modifier2 = NGX_CONF_UNSET_UINT;
-
- conf->upstream.store = NGX_CONF_UNSET;
- conf->upstream.store_access = NGX_CONF_UNSET_UINT;
- conf->upstream.buffering = NGX_CONF_UNSET;
- conf->upstream.ignore_client_abort = NGX_CONF_UNSET;
-
- conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC;
- conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC;
- conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC;
-
- conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE;
- conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE;
-
- conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE;
- conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE;
- conf->upstream.temp_file_write_size_conf = NGX_CONF_UNSET_SIZE;
-
- conf->upstream.pass_request_headers = NGX_CONF_UNSET;
- conf->upstream.pass_request_body = NGX_CONF_UNSET;
-
-#if (NGX_HTTP_CACHE)
- conf->upstream.cache = NGX_CONF_UNSET_PTR;
- conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT;
- conf->upstream.cache_bypass = NGX_CONF_UNSET_PTR;
- conf->upstream.no_cache = NGX_CONF_UNSET_PTR;
- conf->upstream.cache_valid = NGX_CONF_UNSET_PTR;
-#endif
-
- conf->upstream.hide_headers = NGX_CONF_UNSET_PTR;
- conf->upstream.pass_headers = NGX_CONF_UNSET_PTR;
-
- conf->upstream.intercept_errors = NGX_CONF_UNSET;
-
- /* "uwsgi_cyclic_temp_file" is disabled */
- conf->upstream.cyclic_temp_file = 0;
-
- return conf;
-}
-
-
-static char *
-ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
-{
- ngx_http_uwsgi_loc_conf_t *prev = parent;
- ngx_http_uwsgi_loc_conf_t *conf = child;
-
- u_char *p;
- size_t size;
- uintptr_t *code;
- ngx_uint_t i;
- ngx_array_t headers_names;
- ngx_keyval_t *src;
- ngx_hash_key_t *hk;
- ngx_hash_init_t hash;
- ngx_http_core_loc_conf_t *clcf;
- ngx_http_script_compile_t sc;
- ngx_http_script_copy_code_t *copy;
-
- if (conf->upstream.store != 0) {
- ngx_conf_merge_value(conf->upstream.store, prev->upstream.store, 0);
-
- if (conf->upstream.store_lengths == NULL) {
- conf->upstream.store_lengths = prev->upstream.store_lengths;
- conf->upstream.store_values = prev->upstream.store_values;
- }
- }
-
- ngx_conf_merge_uint_value(conf->upstream.store_access,
- prev->upstream.store_access, 0600);
-
- ngx_conf_merge_value(conf->upstream.buffering,
- prev->upstream.buffering, 1);
-
- ngx_conf_merge_value(conf->upstream.ignore_client_abort,
- prev->upstream.ignore_client_abort, 0);
-
- ngx_conf_merge_msec_value(conf->upstream.connect_timeout,
- prev->upstream.connect_timeout, 60000);
-
- ngx_conf_merge_msec_value(conf->upstream.send_timeout,
- prev->upstream.send_timeout, 60000);
-
- ngx_conf_merge_msec_value(conf->upstream.read_timeout,
- prev->upstream.read_timeout, 60000);
-
- ngx_conf_merge_size_value(conf->upstream.send_lowat,
- prev->upstream.send_lowat, 0);
-
- ngx_conf_merge_size_value(conf->upstream.buffer_size,
- prev->upstream.buffer_size,
- (size_t) ngx_pagesize);
-
-
- ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs,
- 8, ngx_pagesize);
-
- if (conf->upstream.bufs.num < 2) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "there must be at least 2 \"uwsgi_buffers\"");
- return NGX_CONF_ERROR;
- }
-
-
- size = conf->upstream.buffer_size;
- if (size < conf->upstream.bufs.size) {
- size = conf->upstream.bufs.size;
- }
-
-
- ngx_conf_merge_size_value(conf->upstream.busy_buffers_size_conf,
- prev->upstream.busy_buffers_size_conf,
- NGX_CONF_UNSET_SIZE);
-
- if (conf->upstream.busy_buffers_size_conf == NGX_CONF_UNSET_SIZE) {
- conf->upstream.busy_buffers_size = 2 * size;
- } else {
- conf->upstream.busy_buffers_size =
- conf->upstream.busy_buffers_size_conf;
- }
-
- if (conf->upstream.busy_buffers_size < size) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "\"uwsgi_busy_buffers_size\" must be equal or bigger "
- "than maximum of the value of \"uwsgi_buffer_size\" and "
- "one of the \"uwsgi_buffers\"");
-
- return NGX_CONF_ERROR;
- }
-
- if (conf->upstream.busy_buffers_size
- > (conf->upstream.bufs.num - 1) * conf->upstream.bufs.size)
- {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "\"uwsgi_busy_buffers_size\" must be less than "
- "the size of all \"uwsgi_buffers\" minus one buffer");
-
- return NGX_CONF_ERROR;
- }
-
-
- ngx_conf_merge_size_value(conf->upstream.temp_file_write_size_conf,
- prev->upstream.temp_file_write_size_conf,
- NGX_CONF_UNSET_SIZE);
-
- if (conf->upstream.temp_file_write_size_conf == NGX_CONF_UNSET_SIZE) {
- conf->upstream.temp_file_write_size = 2 * size;
- } else {
- conf->upstream.temp_file_write_size =
- conf->upstream.temp_file_write_size_conf;
- }
-
- if (conf->upstream.temp_file_write_size < size) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "\"uwsgi_temp_file_write_size\" must be equal or bigger than "
- "maximum of the value of \"uwsgi_buffer_size\" and "
- "one of the \"uwsgi_buffers\"");
-
- return NGX_CONF_ERROR;
- }
-
-
- ngx_conf_merge_size_value(conf->upstream.max_temp_file_size_conf,
- prev->upstream.max_temp_file_size_conf,
- NGX_CONF_UNSET_SIZE);
-
- if (conf->upstream.max_temp_file_size_conf == NGX_CONF_UNSET_SIZE) {
- conf->upstream.max_temp_file_size = 1024 * 1024 * 1024;
- } else {
- conf->upstream.max_temp_file_size =
- conf->upstream.max_temp_file_size_conf;
- }
-
- if (conf->upstream.max_temp_file_size != 0
- && conf->upstream.max_temp_file_size < size) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "\"uwsgi_max_temp_file_size\" must be equal to zero to disable "
- "the temporary files usage or must be equal or bigger than "
- "maximum of the value of \"uwsgi_buffer_size\" and "
- "one of the \"uwsgi_buffers\"");
-
- return NGX_CONF_ERROR;
- }
-
-
- ngx_conf_merge_bitmask_value(conf->upstream.ignore_headers,
- prev->upstream.ignore_headers,
- NGX_CONF_BITMASK_SET);
-
-
- ngx_conf_merge_bitmask_value(conf->upstream.next_upstream,
- prev->upstream.next_upstream,
- (NGX_CONF_BITMASK_SET
- |NGX_HTTP_UPSTREAM_FT_ERROR
- |NGX_HTTP_UPSTREAM_FT_TIMEOUT));
-
- if (conf->upstream.next_upstream & NGX_HTTP_UPSTREAM_FT_OFF) {
- conf->upstream.next_upstream = NGX_CONF_BITMASK_SET
- |NGX_HTTP_UPSTREAM_FT_OFF;
- }
-
- if (ngx_conf_merge_path_value(cf, &conf->upstream.temp_path,
- prev->upstream.temp_path,
- &ngx_http_uwsgi_temp_path)
- != NGX_OK)
- {
- return NGX_CONF_ERROR;
- }
-
-#if (NGX_HTTP_CACHE)
-
- ngx_conf_merge_ptr_value(conf->upstream.cache,
- prev->upstream.cache, NULL);
-
- if (conf->upstream.cache && conf->upstream.cache->data == NULL) {
- ngx_shm_zone_t *shm_zone;
-
- shm_zone = conf->upstream.cache;
-
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "\"uwsgi_cache\" zone \"%V\" is unknown",
- &shm_zone->shm.name);
-
- return NGX_CONF_ERROR;
- }
-
- ngx_conf_merge_uint_value(conf->upstream.cache_min_uses,
- prev->upstream.cache_min_uses, 1);
-
- ngx_conf_merge_bitmask_value(conf->upstream.cache_use_stale,
- prev->upstream.cache_use_stale,
- (NGX_CONF_BITMASK_SET
- |NGX_HTTP_UPSTREAM_FT_OFF));
-
- if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_OFF) {
- conf->upstream.cache_use_stale = NGX_CONF_BITMASK_SET
- |NGX_HTTP_UPSTREAM_FT_OFF;
- }
-
- if (conf->upstream.cache_methods == 0) {
- conf->upstream.cache_methods = prev->upstream.cache_methods;
- }
-
- conf->upstream.cache_methods |= NGX_HTTP_GET|NGX_HTTP_HEAD;
-
- ngx_conf_merge_ptr_value(conf->upstream.cache_bypass,
- prev->upstream.cache_bypass, NULL);
-
- 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);
-
- if (conf->cache_key.value.data == NULL) {
- conf->cache_key = prev->cache_key;
- }
-
-#endif
-
- ngx_conf_merge_value(conf->upstream.pass_request_headers,
- prev->upstream.pass_request_headers, 1);
- ngx_conf_merge_value(conf->upstream.pass_request_body,
- prev->upstream.pass_request_body, 1);
-
- ngx_conf_merge_value(conf->upstream.intercept_errors,
- prev->upstream.intercept_errors, 0);
-
- ngx_conf_merge_str_value(conf->uwsgi_string, prev->uwsgi_string, "");
-
- hash.max_size = 512;
- hash.bucket_size = ngx_align(64, ngx_cacheline_size);
- hash.name = "uwsgi_hide_headers_hash";
-
- if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream,
- &prev->upstream, ngx_http_uwsgi_hide_headers, &hash)
- != NGX_OK)
- {
- return NGX_CONF_ERROR;
- }
-
- if (conf->upstream.upstream == NULL) {
- conf->upstream.upstream = prev->upstream.upstream;
- }
-
- if (conf->uwsgi_lengths == NULL) {
- conf->uwsgi_lengths = prev->uwsgi_lengths;
- conf->uwsgi_values = prev->uwsgi_values;
- }
-
- if (conf->upstream.upstream || conf->uwsgi_lengths) {
- clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
- if (clcf->handler == NULL && clcf->lmt_excpt) {
- clcf->handler = ngx_http_uwsgi_handler;
- }
- }
-
- ngx_conf_merge_uint_value(conf->modifier1, prev->modifier1, 0);
- ngx_conf_merge_uint_value(conf->modifier2, prev->modifier2, 0);
-
- if (conf->params_source == NULL) {
- conf->flushes = prev->flushes;
- conf->params_len = prev->params_len;
- conf->params = prev->params;
- conf->params_source = prev->params_source;
- conf->headers_hash = prev->headers_hash;
-
-#if (NGX_HTTP_CACHE)
-
- if (conf->params_source == NULL) {
-
- if ((conf->upstream.cache == NULL)
- == (prev->upstream.cache == NULL))
- {
- return NGX_CONF_OK;
- }
-
- /* 6 is a number of ngx_http_uwsgi_cache_headers entries */
- conf->params_source = ngx_array_create(cf->pool, 6,
- sizeof(ngx_keyval_t));
- if (conf->params_source == NULL) {
- return NGX_CONF_ERROR;
- }
- }
-#else
-
- if (conf->params_source == NULL) {
- return NGX_CONF_OK;
- }
-
-#endif
- }
-
- conf->params_len = ngx_array_create(cf->pool, 64, 1);
- if (conf->params_len == NULL) {
- return NGX_CONF_ERROR;
- }
-
- conf->params = ngx_array_create(cf->pool, 512, 1);
- if (conf->params == NULL) {
- return NGX_CONF_ERROR;
- }
-
- if (ngx_array_init(&headers_names, cf->temp_pool, 4, sizeof(ngx_hash_key_t))
- != NGX_OK)
- {
- return NGX_CONF_ERROR;
- }
-
- src = conf->params_source->elts;
-
-#if (NGX_HTTP_CACHE)
-
- if (conf->upstream.cache) {
- ngx_keyval_t *h, *s;
-
- for (h = ngx_http_uwsgi_cache_headers; h->key.len; h++) {
-
- for (i = 0; i < conf->params_source->nelts; i++) {
- if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) {
- goto next;
- }
- }
-
- s = ngx_array_push(conf->params_source);
- if (s == NULL) {
- return NGX_CONF_ERROR;
- }
-
- *s = *h;
-
- src = conf->params_source->elts;
-
- next:
-
- h++;
- }
- }
-
-#endif
-
- for (i = 0; i < conf->params_source->nelts; i++) {
-
- if (src[i].key.len > sizeof("HTTP_") - 1
- && ngx_strncmp(src[i].key.data, "HTTP_", sizeof("HTTP_") - 1) == 0)
- {
- hk = ngx_array_push(&headers_names);
- if (hk == NULL) {
- return NGX_CONF_ERROR;
- }
-
- hk->key.len = src[i].key.len - 5;
- hk->key.data = src[i].key.data + 5;
- hk->key_hash = ngx_hash_key_lc(hk->key.data, hk->key.len);
- hk->value = (void *) 1;
-
- if (src[i].value.len == 0) {
- continue;
- }
- }
-
- copy = ngx_array_push_n(conf->params_len,
- sizeof(ngx_http_script_copy_code_t));
- if (copy == NULL) {
- return NGX_CONF_ERROR;
- }
-
- copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
- copy->len = src[i].key.len;
-
-
- size = (sizeof(ngx_http_script_copy_code_t)
- + src[i].key.len + sizeof(uintptr_t) - 1)
- & ~(sizeof(uintptr_t) - 1);
-
- copy = ngx_array_push_n(conf->params, size);
- if (copy == NULL) {
- return NGX_CONF_ERROR;
- }
-
- copy->code = ngx_http_script_copy_code;
- copy->len = src[i].key.len;
-
- p = (u_char *) copy + sizeof(ngx_http_script_copy_code_t);
- ngx_memcpy(p, src[i].key.data, src[i].key.len);
-
-
- ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
-
- sc.cf = cf;
- sc.source = &src[i].value;
- sc.flushes = &conf->flushes;
- sc.lengths = &conf->params_len;
- sc.values = &conf->params;
-
- if (ngx_http_script_compile(&sc) != NGX_OK) {
- return NGX_CONF_ERROR;
- }
-
- code = ngx_array_push_n(conf->params_len, sizeof(uintptr_t));
- if (code == NULL) {
- return NGX_CONF_ERROR;
- }
-
- *code = (uintptr_t) NULL;
-
-
- code = ngx_array_push_n(conf->params, sizeof(uintptr_t));
- if (code == NULL) {
- return NGX_CONF_ERROR;
- }
-
- *code = (uintptr_t) NULL;
- }
-
- code = ngx_array_push_n(conf->params_len, sizeof(uintptr_t));
- if (code == NULL) {
- return NGX_CONF_ERROR;
- }
-
- *code = (uintptr_t) NULL;
-
- conf->header_params = headers_names.nelts;
-
- hash.hash = &conf->headers_hash;
- hash.key = ngx_hash_key_lc;
- hash.max_size = 512;
- hash.bucket_size = 64;
- hash.name = "uwsgi_params_hash";
- hash.pool = cf->pool;
- hash.temp_pool = NULL;
-
- if (ngx_hash_init(&hash, headers_names.elts, headers_names.nelts) != NGX_OK)
- {
- return NGX_CONF_ERROR;
- }
-
- return NGX_CONF_OK;
-}
-
-
-static char *
-ngx_http_uwsgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
-{
- ngx_http_uwsgi_loc_conf_t *uwcf = conf;
-
- ngx_url_t u;
- ngx_str_t *value, *url;
- ngx_uint_t n;
- ngx_http_core_loc_conf_t *clcf;
- ngx_http_script_compile_t sc;
-
- if (uwcf->upstream.upstream || uwcf->uwsgi_lengths) {
- return "is duplicate";
- }
-
- clcf = ngx_http_conf_get_module_loc_conf (cf, ngx_http_core_module);
- clcf->handler = ngx_http_uwsgi_handler;
-
- value = cf->args->elts;
-
- url = &value[1];
-
- n = ngx_http_script_variables_count(url);
-
- if (n) {
-
- ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
-
- sc.cf = cf;
- sc.source = url;
- sc.lengths = &uwcf->uwsgi_lengths;
- sc.values = &uwcf->uwsgi_values;
- sc.variables = n;
- sc.complete_lengths = 1;
- sc.complete_values = 1;
-
- if (ngx_http_script_compile(&sc) != NGX_OK) {
- return NGX_CONF_ERROR;
- }
-
- return NGX_CONF_OK;
- }
-
- ngx_memzero(&u, sizeof(ngx_url_t));
-
- u.url = value[1];
- u.no_resolve = 1;
-
- uwcf->upstream.upstream = ngx_http_upstream_add(cf, &u, 0);
- if (uwcf->upstream.upstream == NULL) {
- return NGX_CONF_ERROR;
- }
-
- if (clcf->name.data[clcf->name.len - 1] == '/') {
- clcf->auto_redirect = 1;
- }
-
- return NGX_CONF_OK;
-}
-
-
-static char *
-ngx_http_uwsgi_store(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
-{
- ngx_http_uwsgi_loc_conf_t *uwcf = conf;
-
- ngx_str_t *value;
- ngx_http_script_compile_t sc;
-
- if (uwcf->upstream.store != NGX_CONF_UNSET || uwcf->upstream.store_lengths)
- {
- return "is duplicate";
- }
-
- value = cf->args->elts;
-
- if (ngx_strcmp(value[1].data, "off") == 0) {
- uwcf->upstream.store = 0;
- return NGX_CONF_OK;
- }
-
-#if (NGX_HTTP_CACHE)
-
- if (uwcf->upstream.cache != NGX_CONF_UNSET_PTR
- && uwcf->upstream.cache != NULL)
- {
- return "is incompatible with \"uwsgi_cache\"";
- }
-
-#endif
-
- if (ngx_strcmp(value[1].data, "on") == 0) {
- uwcf->upstream.store = 1;
- return NGX_CONF_OK;
- }
-
- /* include the terminating '\0' into script */
- value[1].len++;
-
- ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
-
- sc.cf = cf;
- sc.source = &value[1];
- sc.lengths = &uwcf->upstream.store_lengths;
- sc.values = &uwcf->upstream.store_values;
- sc.variables = ngx_http_script_variables_count(&value[1]);;
- sc.complete_lengths = 1;
- sc.complete_values = 1;
-
- if (ngx_http_script_compile(&sc) != NGX_OK) {
- return NGX_CONF_ERROR;
- }
-
- return NGX_CONF_OK;
-}
-
-
-#if (NGX_HTTP_CACHE)
-
-static char *
-ngx_http_uwsgi_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
-{
- ngx_http_uwsgi_loc_conf_t *uwcf = conf;
-
- ngx_str_t *value;
-
- value = cf->args->elts;
-
- if (uwcf->upstream.cache != NGX_CONF_UNSET_PTR) {
- return "is duplicate";
- }
-
- if (ngx_strcmp(value[1].data, "off") == 0) {
- uwcf->upstream.cache = NULL;
- return NGX_CONF_OK;
- }
-
- if (uwcf->upstream.store > 0 || uwcf->upstream.store_lengths) {
- return "is incompatible with \"uwsgi_store\"";
- }
-
- uwcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0,
- &ngx_http_uwsgi_module);
- if (uwcf->upstream.cache == NULL) {
- return NGX_CONF_ERROR;
- }
-
- return NGX_CONF_OK;
-}
-
-
-static char *
-ngx_http_uwsgi_cache_key(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
-{
- ngx_http_uwsgi_loc_conf_t *uwcf = conf;
-
- ngx_str_t *value;
- ngx_http_compile_complex_value_t ccv;
-
- value = cf->args->elts;
-
- if (uwcf->cache_key.value.len) {
- return "is duplicate";
- }
-
- ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
-
- ccv.cf = cf;
- ccv.value = &value[1];
- ccv.complex_value = &uwcf->cache_key;
-
- if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
- return NGX_CONF_ERROR;
- }
-
- return NGX_CONF_OK;
-}
-
-#endif
|