]> git.kaiwu.me - nginx.git/log
nginx.git
14 years agoIntroduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev [Mon, 14 Nov 2011 14:59:00 +0000 (14:59 +0000)]
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
for output of ./configure options, etc., since ngx_log_stderr() output
length is limited by 2048 characters defined as NGX_MAX_ERROR_STR.

14 years agoFix of "Content-Length" header of MP4 response if start argument was used.
Igor Sysoev [Mon, 14 Nov 2011 14:42:48 +0000 (14:42 +0000)]
Fix of "Content-Length" header of MP4 response if start argument was used.

Patch by Piotr Sikora.

14 years agoAdded image/webp and video/webm MIME types.
Valentin Bartenev [Mon, 14 Nov 2011 14:16:51 +0000 (14:16 +0000)]
Added image/webp and video/webm MIME types.

14 years agoRenamed ngx_http_limit_zone_module to ngx_http_limit_conn_module.
Valentin Bartenev [Mon, 14 Nov 2011 14:04:42 +0000 (14:04 +0000)]
Renamed ngx_http_limit_zone_module to ngx_http_limit_conn_module.

14 years agoReverted incorrect change in internal md5 (part of r3928).
Maxim Dounin [Mon, 14 Nov 2011 13:38:02 +0000 (13:38 +0000)]
Reverted incorrect change in internal md5 (part of r3928).

14 years agoFixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin [Mon, 14 Nov 2011 13:26:18 +0000 (13:26 +0000)]
Fixed fastcgi/scgi/uwsgi_param inheritance.

The following problems were fixed:

1. Directive fastcgi_cache affected headers sent to backends in unrelated
   servers / locations (see ticket #45).

2. If-Unmodified-Since, If-Match and If-Range headers were sent to backends
   if fastcgi_cache was used.

3. Cache-related headers were sent to backends if there were no fastcgi_param
   directives and fastcgi_cache was used at server level.

14 years agoSeparate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin [Mon, 14 Nov 2011 13:24:43 +0000 (13:24 +0000)]
Separate functions to merge fastcgi/scgi/uwsgi params.

No functional changes.

14 years agoFixed Upgrade header clearing with proxy_cache.
Maxim Dounin [Mon, 14 Nov 2011 13:21:10 +0000 (13:21 +0000)]
Fixed Upgrade header clearing with proxy_cache.

This was missed in proxy HTTP/1.1 support commit (r4127).

14 years agoFixed proxy_set_header inheritance with proxy_set_body.
Maxim Dounin [Mon, 14 Nov 2011 13:19:56 +0000 (13:19 +0000)]
Fixed proxy_set_header inheritance with proxy_set_body.

14 years agoFixed proxy_set_header inheritance with proxy_cache (ticket #45).
Maxim Dounin [Mon, 14 Nov 2011 13:18:15 +0000 (13:18 +0000)]
Fixed proxy_set_header inheritance with proxy_cache (ticket #45).

Headers cleared with cache enabled (If-Modified-Since etc.) might be cleared
in unrelated servers/locations without proxy_cache enabled if proxy_cache was
used in some server/location.

Example config which triggered the problem:

    proxy_set_header X-Test "test";
    server { location /1 { proxy_cache name; proxy_pass ... } }
    server { location /2 { proxy_pass ... } }

Another one:

    server {
        proxy_cache name;
        location /1 { proxy_pass ... }
        location /2 { proxy_cache off; proxy_pass ... }
    }

In both cases If-Modified-Since header wasn't sent to backend in location /2.

Fix is to not modify conf->headers_source, but instead merge user-supplied
headers from conf->headers_source and default headers (either cache or not)
into separate headers_merged array.

14 years agoFixed NGX_CONF_TAKE1/NGX_CONF_FLAG misuse.
Sergey Budnevitch [Mon, 14 Nov 2011 09:12:15 +0000 (09:12 +0000)]
Fixed NGX_CONF_TAKE1/NGX_CONF_FLAG misuse.

14 years agoLimit zone: added the "limit_conn_zone" directive.
Valentin Bartenev [Thu, 10 Nov 2011 16:25:08 +0000 (16:25 +0000)]
Limit zone: added the "limit_conn_zone" directive.

It supersedes old "limit_zone" directive (deprecated accordingly) and uses
syntax consistent with the "limit_req_zone" directive.

14 years agoLimit zone: support for multiple "limit_conn" limits.
Valentin Bartenev [Thu, 10 Nov 2011 16:08:13 +0000 (16:08 +0000)]
Limit zone: support for multiple "limit_conn" limits.

14 years agoLimit zone: rbtree lookup moved to a separate function.
Valentin Bartenev [Thu, 10 Nov 2011 15:51:55 +0000 (15:51 +0000)]
Limit zone: rbtree lookup moved to a separate function.

No functional changes.

14 years agoChanged error message to be more appropriate in the imaginary
Ruslan Ermilov [Thu, 10 Nov 2011 09:13:09 +0000 (09:13 +0000)]
Changed error message to be more appropriate in the imaginary
"open_file_cache max=0" case.

14 years agoBelatedly fixed language in 1.1.7 relnotes.
Ruslan Ermilov [Wed, 9 Nov 2011 14:50:33 +0000 (14:50 +0000)]
Belatedly fixed language in 1.1.7 relnotes.

14 years agoFixed compression pointer processing in DNS response greater than 255 bytes.
Igor Sysoev [Wed, 9 Nov 2011 13:54:07 +0000 (13:54 +0000)]
Fixed compression pointer processing in DNS response greater than 255 bytes.

Thanks to Ben Hawkes.

14 years agoFix of "keepalive_disable" directive.
Igor Sysoev [Tue, 8 Nov 2011 13:48:23 +0000 (13:48 +0000)]
Fix of "keepalive_disable" directive.

14 years agoThe "image_filter_sharpen" directive.
Igor Sysoev [Tue, 8 Nov 2011 13:17:14 +0000 (13:17 +0000)]
The "image_filter_sharpen" directive.

14 years agoAncient incomplete ngx_http_status_module removal.
Igor Sysoev [Tue, 1 Nov 2011 15:16:28 +0000 (15:16 +0000)]
Ancient incomplete ngx_http_status_module removal.

14 years agoVersion bump.
Igor Sysoev [Tue, 1 Nov 2011 15:10:46 +0000 (15:10 +0000)]
Version bump.

14 years agorelease-1.1.7 tag
Igor Sysoev [Mon, 31 Oct 2011 14:52:53 +0000 (14:52 +0000)]
release-1.1.7 tag

14 years agonginx-1.1.7-RELEASE release-1.1.7
Igor Sysoev [Mon, 31 Oct 2011 14:52:46 +0000 (14:52 +0000)]
nginx-1.1.7-RELEASE

14 years agoSilently ignoring a stale global SSL error left after disabled renegotiation.
Igor Sysoev [Mon, 31 Oct 2011 14:30:03 +0000 (14:30 +0000)]
Silently ignoring a stale global SSL error left after disabled renegotiation.

14 years agoFixed documentation pointer.
Ruslan Ermilov [Mon, 31 Oct 2011 10:38:20 +0000 (10:38 +0000)]
Fixed documentation pointer.

14 years agoFixed segfault on configuration testing with ssl (ticket #37).
Maxim Dounin [Mon, 31 Oct 2011 09:57:14 +0000 (09:57 +0000)]
Fixed segfault on configuration testing with ssl (ticket #37).

The following config caused segmentation fault due to conf->file not
being properly set if "ssl on" was inherited from the http level:

http {
    ssl on;
    server {
    }
}

14 years agoEvent pipe: reduced number of file buffers used.
Maxim Dounin [Mon, 31 Oct 2011 09:54:55 +0000 (09:54 +0000)]
Event pipe: reduced number of file buffers used.

If possible we now just extend already present file buffer in p->out chain
instead of keeping ngx_buf_t for each buffer we've flushed to disk.  This
saves about 120 bytes of memory per buffer flushed to disk, and resolves
high CPU usage observed in edge cases (due to coalescing these buffers on
send).

14 years agoEvent pipe: fixes for complex protocols.
Maxim Dounin [Mon, 31 Oct 2011 09:53:16 +0000 (09:53 +0000)]
Event pipe: fixes for complex protocols.

1. In ngx_event_pipe_write_chain_to_temp_file() make sure to fully write
   all shadow buffers up to last_shadow.  With this change recycled buffers
   cannot appear in p->out anymore.  This also fixes segmentation faults
   observed due to ngx_event_pipe_write_chain_to_temp() not freeing any
   raw buffers while still returning NGX_OK.

2. In ngx_event_pipe_write_to_downstream() we now properly check for busy
   size as a size of buffers, not a size of data in these buffers.  This
   fixes situations where all available buffers became busy (including
   segmentation faults due to this).

3. The ngx_event_pipe_free_shadow_raw_buf() function is dropped.  It's
   incorrect and not needed.

14 years agoAdding m4a and m4v MIME types (closed #42).
Igor Sysoev [Fri, 28 Oct 2011 15:24:31 +0000 (15:24 +0000)]
Adding m4a and m4v MIME types (closed #42).

14 years agoRevamped "configure --help" text.
Ruslan Ermilov [Wed, 26 Oct 2011 13:18:33 +0000 (13:18 +0000)]
Revamped "configure --help" text.

14 years agoFix of building by Microsoft Visual C++ 10 compiler.
Igor Sysoev [Wed, 26 Oct 2011 08:16:59 +0000 (08:16 +0000)]
Fix of building by Microsoft Visual C++ 10 compiler.

14 years agoDecrease of log level of some SSL handshake errors.
Igor Sysoev [Tue, 25 Oct 2011 15:04:09 +0000 (15:04 +0000)]
Decrease of log level of some SSL handshake errors.

14 years agoFixed port range checking.
Ruslan Ermilov [Tue, 25 Oct 2011 13:48:43 +0000 (13:48 +0000)]
Fixed port range checking.

14 years agoFixed range checking for the "somaxconn" sysctl.
Ruslan Ermilov [Tue, 25 Oct 2011 13:48:05 +0000 (13:48 +0000)]
Fixed range checking for the "somaxconn" sysctl.

14 years agoSupport of several servers in the "resolver" directive.
Igor Sysoev [Mon, 24 Oct 2011 16:09:05 +0000 (16:09 +0000)]
Support of several servers in the "resolver" directive.

Patch by Kirill A. Korinskiy.

14 years agoUsing of junk value in slab allocator similar to modern FreeBSD values.
Igor Sysoev [Mon, 24 Oct 2011 15:50:19 +0000 (15:50 +0000)]
Using of junk value in slab allocator similar to modern FreeBSD values.

14 years agomalloc() debugging on MacOSX.
Igor Sysoev [Mon, 24 Oct 2011 15:46:48 +0000 (15:46 +0000)]
malloc() debugging on MacOSX.

14 years agoFreeBSD's MALLOC_OPTIONS must be set before any malloc() call.
Igor Sysoev [Mon, 24 Oct 2011 12:59:01 +0000 (12:59 +0000)]
FreeBSD's MALLOC_OPTIONS must be set before any malloc() call.
The bug has been introduced in r3799.

14 years agoFixed another return in unix ngx_write_chain_to_file().
Maxim Dounin [Fri, 21 Oct 2011 11:04:46 +0000 (11:04 +0000)]
Fixed another return in unix ngx_write_chain_to_file().

Previous patch missed special case for one iovec, it needs total bytes
written to be returned as well.

14 years agoFixed unix ngx_write_chain_to_file() to return total bytes written.
Maxim Dounin [Thu, 20 Oct 2011 12:40:26 +0000 (12:40 +0000)]
Fixed unix ngx_write_chain_to_file() to return total bytes written.

Previously result of last iteration's writev() was returned.  This was
unnoticed as return value was only used if chain contained only one or
two buffers.

14 years agoFixing conflict with SDK off_t definition.
Igor Sysoev [Thu, 20 Oct 2011 07:12:45 +0000 (07:12 +0000)]
Fixing conflict with SDK off_t definition.

14 years agoRecent SDKs allow to build IPV6 only for Windows XP or above.
Igor Sysoev [Thu, 20 Oct 2011 07:00:04 +0000 (07:00 +0000)]
Recent SDKs allow to build IPV6 only for Windows XP or above.

14 years agoFixed "expires @time" with unknown last modified time (ticket #32).
Maxim Dounin [Mon, 17 Oct 2011 17:32:08 +0000 (17:32 +0000)]
Fixed "expires @time" with unknown last modified time (ticket #32).

14 years agoFixed "expires @00h".
Maxim Dounin [Mon, 17 Oct 2011 17:30:18 +0000 (17:30 +0000)]
Fixed "expires @00h".

14 years agoRemoval of incomplete draft documentation processing.
Igor Sysoev [Mon, 17 Oct 2011 15:42:12 +0000 (15:42 +0000)]
Removal of incomplete draft documentation processing.

14 years agoVersion bump.
Igor Sysoev [Mon, 17 Oct 2011 15:39:59 +0000 (15:39 +0000)]
Version bump.

14 years agorelease-1.1.6 tag
Igor Sysoev [Mon, 17 Oct 2011 15:10:31 +0000 (15:10 +0000)]
release-1.1.6 tag

14 years agonginx-1.1.6-RELEASE release-1.1.6
Igor Sysoev [Mon, 17 Oct 2011 15:10:23 +0000 (15:10 +0000)]
nginx-1.1.6-RELEASE

14 years agoMoving RELEASE target in more safe place.
Igor Sysoev [Mon, 17 Oct 2011 15:09:34 +0000 (15:09 +0000)]
Moving RELEASE target in more safe place.

14 years agoAdded clearing of modules' contexts in ngx_http_named_location().
Maxim Dounin [Sat, 15 Oct 2011 21:42:03 +0000 (21:42 +0000)]
Added clearing of modules' contexts in ngx_http_named_location().

Patch by Yichun Zhang (agentzh).

14 years agoFixed utf8 decode (ticket #25).
Maxim Dounin [Thu, 13 Oct 2011 13:56:41 +0000 (13:56 +0000)]
Fixed utf8 decode (ticket #25).

Patch by Alexey Kuts.

14 years agoSkipping location rewrite phase for server null location.
Igor Sysoev [Thu, 13 Oct 2011 12:43:22 +0000 (12:43 +0000)]
Skipping location rewrite phase for server null location.

14 years agoBetter recheck of dead upstream servers.
Maxim Dounin [Wed, 12 Oct 2011 14:22:48 +0000 (14:22 +0000)]
Better recheck of dead upstream servers.

Previously nginx used to mark backend again as live as soon as fail_timeout
passes (10s by default) since last failure.  On the other hand, detecting
dead backend takes up to 60s (proxy_connect_timeout) in typical situation
"backend is down and doesn't respond to any packets".  This resulted in
suboptimal behaviour in the above situation (up to 23% of requests were
directed to dead backend with default settings).

More detailed description of the problem may be found here (in Russian):
http://mailman.nginx.org/pipermail/nginx-ru/2011-August/042172.html

Fix is to only allow one request after fail_timeout passes, and
mark backend as "live" only if this request succeeds.

Note that with new code backend will not be marked "live" unless "check"
request is completed, and this may take a while in some specific workloads
(e.g. streaming).  This is believed to be acceptable.

14 years agoClear old Location header (if any) while adding a new one.
Maxim Dounin [Wed, 12 Oct 2011 13:28:03 +0000 (13:28 +0000)]
Clear old Location header (if any) while adding a new one.

This prevents incorrect behaviour when another redirect is issued within
error_page 302 handler.

14 years agoWording fix, "many data" is incorrect.
Maxim Dounin [Wed, 12 Oct 2011 13:24:59 +0000 (13:24 +0000)]
Wording fix, "many data" is incorrect.

Noted by Piotr Sikora.

14 years agoFixed two minor bugs in "types" parsing code.
Ruslan Ermilov [Wed, 12 Oct 2011 09:36:21 +0000 (09:36 +0000)]
Fixed two minor bugs in "types" parsing code.

14 years agoFixed grammar in a comment.
Ruslan Ermilov [Wed, 12 Oct 2011 09:34:53 +0000 (09:34 +0000)]
Fixed grammar in a comment.

14 years agoReplaced magic constants representing default values of some directives
Ruslan Ermilov [Wed, 12 Oct 2011 09:33:43 +0000 (09:33 +0000)]
Replaced magic constants representing default values of some directives
with appropriate #define's.

14 years agoStylistic change in checking the boolean expression.
Ruslan Ermilov [Wed, 12 Oct 2011 09:27:34 +0000 (09:27 +0000)]
Stylistic change in checking the boolean expression.

14 years agoPreallocating exact number of default MIME types entries.
Igor Sysoev [Wed, 12 Oct 2011 09:19:57 +0000 (09:19 +0000)]
Preallocating exact number of default MIME types entries.

14 years agoFixed configuration summary and manpage contents for the special
Ruslan Ermilov [Wed, 12 Oct 2011 09:04:59 +0000 (09:04 +0000)]
Fixed configuration summary and manpage contents for the special
--error-log-path=stderr case.

14 years agoRemoved old warning that suggested to use "server_name_in_redirect off"
Ruslan Ermilov [Wed, 12 Oct 2011 07:20:20 +0000 (07:20 +0000)]
Removed old warning that suggested to use "server_name_in_redirect off"
(now the default) in place of no longer supported "server_name *".

14 years agoAdditional headers for proxy/fastcgi/uwsgi/scgi_ignore_headers.
Maxim Dounin [Tue, 11 Oct 2011 18:10:49 +0000 (18:10 +0000)]
Additional headers for proxy/fastcgi/uwsgi/scgi_ignore_headers.

Now the following headers may be ignored as well: X-Accel-Limit-Rate,
X-Accel-Buffering, X-Accel-Charset.

14 years agoHandling of Content-Encoding set from perl.
Maxim Dounin [Tue, 11 Oct 2011 18:01:38 +0000 (18:01 +0000)]
Handling of Content-Encoding set from perl.

This fixes double gzipping in case of gzip filter being enabled while perl
returns already gzipped response.

14 years agoFix for socket leak with "aio sendfile" and "limit_rate".
Maxim Dounin [Tue, 11 Oct 2011 18:00:23 +0000 (18:00 +0000)]
Fix for socket leak with "aio sendfile" and "limit_rate".

Second aio post happened when timer set by limit_rate expired while we have
aio request in flight, resulting in "second aio post" alert and socket leak.

The patch adds actual protection from aio calls with r->aio already set to
aio sendfile code in ngx_http_copy_filter().  This should fix other cases
as well, e.g. when sending buffered to disk upstream replies while still
talking to upstream.

The ngx_http_writer() is also fixed to handle the above case (though it's
mostly optimization now).

Reported by Oleksandr V. Typlyns'kyi.

14 years agoFix for connection drops with AIO.
Maxim Dounin [Tue, 11 Oct 2011 17:58:51 +0000 (17:58 +0000)]
Fix for connection drops with AIO.

Connections serving content with AIO to fast clients were dropped with
"client timed out" messages after send_timeout from response start.

14 years agoAutoindex: escape html in file names.
Maxim Dounin [Tue, 11 Oct 2011 17:57:41 +0000 (17:57 +0000)]
Autoindex: escape html in file names.

14 years agoAutoindex: escape '?' in file names.
Maxim Dounin [Tue, 11 Oct 2011 17:56:51 +0000 (17:56 +0000)]
Autoindex: escape '?' in file names.

For files with '?' in their names autoindex generated links with '?' not
escaped.  This resulted in effectively truncated links as '?' indicates
query string start.

This is an updated version of the patch originally posted at [1].  It
introduces generic NGX_ESCAPE_URI_COMPONENT which escapes everything but
unreserved characters as per RFC 3986.  This approach also renders unneeded
special colon processing (as colon is percent-encoded now), it's dropped
accordingly.

[1] http://nginx.org/pipermail/nginx-devel/2010-February/000112.html

Reported by Konstantin Leonov.

14 years agoImproved access log escaping to better protect other software.
Maxim Dounin [Tue, 11 Oct 2011 17:54:38 +0000 (17:54 +0000)]
Improved access log escaping to better protect other software.

Some character sets (notably ISO-8859-1) have C1 control characters in
upper half, make sure to escape them.

Reported by Jesus Olmos Gonzalez.

14 years agoFixing directive name in error message if types hash size is not enough.
Igor Sysoev [Tue, 11 Oct 2011 11:11:44 +0000 (11:11 +0000)]
Fixing directive name in error message if types hash size is not enough.

14 years agoFixing mp4 module seeking on 32-bit platforms.
Igor Sysoev [Tue, 11 Oct 2011 10:12:44 +0000 (10:12 +0000)]
Fixing mp4 module seeking on 32-bit platforms.

14 years agoFixed macro name.
Ruslan Ermilov [Mon, 10 Oct 2011 08:38:28 +0000 (08:38 +0000)]
Fixed macro name.

14 years agoThe reference documentation is moving elsewhere.
Ruslan Ermilov [Sun, 9 Oct 2011 06:49:54 +0000 (06:49 +0000)]
The reference documentation is moving elsewhere.

14 years agoReleasing memory of idle SSL connection. This saves about 34K per SSL
Igor Sysoev [Fri, 7 Oct 2011 12:15:20 +0000 (12:15 +0000)]
Releasing memory of idle SSL connection. This saves about 34K per SSL
connection. The SSL_MODE_RELEASE_BUFFERS option is available since
OpenSSL 1.0.0d.

14 years agoDisabling SSL compression. This saves about 300K per SSL connection.
Igor Sysoev [Fri, 7 Oct 2011 10:59:02 +0000 (10:59 +0000)]
Disabling SSL compression. This saves about 300K per SSL connection.
The SSL_OP_NO_COMPRESSION option is available since OpenSSL 1.0.0.

14 years agoVersion bump.
Igor Sysoev [Fri, 7 Oct 2011 10:41:13 +0000 (10:41 +0000)]
Version bump.

14 years agoImproved ngx_parse_time() code readability.
Ruslan Ermilov [Fri, 7 Oct 2011 08:03:16 +0000 (08:03 +0000)]
Improved ngx_parse_time() code readability.

14 years agoTweaked error messages.
Ruslan Ermilov [Fri, 7 Oct 2011 07:57:24 +0000 (07:57 +0000)]
Tweaked error messages.

14 years agoAdding repository path missed in r4179.
Igor Sysoev [Thu, 6 Oct 2011 13:09:00 +0000 (13:09 +0000)]
Adding repository path missed in r4179.

14 years agorelease-1.1.5 tag
Igor Sysoev [Wed, 5 Oct 2011 14:46:09 +0000 (14:46 +0000)]
release-1.1.5 tag

14 years agonginx-1.1.5-RELEASE release-1.1.5
Igor Sysoev [Wed, 5 Oct 2011 14:44:11 +0000 (14:44 +0000)]
nginx-1.1.5-RELEASE

14 years agoAdding RELEASE procedure in GNUmakefile.
Igor Sysoev [Wed, 5 Oct 2011 13:24:32 +0000 (13:24 +0000)]
Adding RELEASE procedure in GNUmakefile.

14 years agoVersion bump.
Igor Sysoev [Wed, 5 Oct 2011 13:13:25 +0000 (13:13 +0000)]
Version bump.

14 years agoFixed cache bypass caching of non-cacheable replies (ticket #21).
Maxim Dounin [Wed, 5 Oct 2011 10:14:21 +0000 (10:14 +0000)]
Fixed cache bypass caching of non-cacheable replies (ticket #21).

If cache was bypassed with proxy_cache_bypass, cache-controlling headers
(Cache-Control, Expires) wasn't considered and response was cached even
if it was actually non-cacheable.

Patch by John Ferlito.

14 years agoAdded uwsgi_buffering and scgi_buffering directives.
Maxim Dounin [Fri, 30 Sep 2011 11:53:27 +0000 (11:53 +0000)]
Added uwsgi_buffering and scgi_buffering directives.

Patch by Peter Smit.

14 years agoUsing strtod() instead of atofp() to support a lot of digits after dot in
Igor Sysoev [Fri, 30 Sep 2011 09:18:28 +0000 (09:18 +0000)]
Using strtod() instead of atofp() to support a lot of digits after dot in
"start" parameter value.

14 years agoFix of building on platforms with 32-bit off_t. (closed #23)
Igor Sysoev [Thu, 29 Sep 2011 15:19:36 +0000 (15:19 +0000)]
Fix of building on platforms with 32-bit off_t. (closed #23)

14 years agoFixed segmentation fault with empty config on Windows.
Maxim Dounin [Tue, 27 Sep 2011 12:07:09 +0000 (12:07 +0000)]
Fixed segmentation fault with empty config on Windows.

See here for report:
http://mailman.nginx.org/pipermail/nginx-ru/2011-September/043288.html

14 years agoFix for "ssl_session_cache builtin" (broken since 1.1.1, r3993).
Maxim Dounin [Tue, 27 Sep 2011 12:06:07 +0000 (12:06 +0000)]
Fix for "ssl_session_cache builtin" (broken since 1.1.1, r3993).

14 years agoBetter handling of late upstream creation.
Maxim Dounin [Tue, 27 Sep 2011 11:18:51 +0000 (11:18 +0000)]
Better handling of late upstream creation.

Configuration with duplicate upstream blocks defined after first use, i.e.
like

    server {
        ...
        location / {
            proxy_pass http://backend;
        }
    }

    upstream backend { ... }
    upstream backend { ... }

now correctly results in "duplicate upstream" error.

Additionally, upstream blocks defined after first use now handle various
server directive parameters ("weight", "max_fails", etc.).  Previously
configuration like

    server {
        ...
        location / {
            proxy_pass http://backend;
        }
    }

    upstream backend {
        server 127.0.0.1 max_fails=5;
    }

incorrectly resulted in "invalid parameter "max_fails=5"" error.

14 years agoCache: fix for sending of stale responses.
Maxim Dounin [Tue, 27 Sep 2011 11:17:11 +0000 (11:17 +0000)]
Cache: fix for sending of stale responses.

For normal cached responses ngx_http_cache_send() sends last buffer and then
request finalized via ngx_http_finalize_request() call, i.e. everything is
ok.

But for stale responses (i.e. when upstream died, but we have something in
cache) the same ngx_http_cache_send() sends last buffer, but then in
ngx_http_upstream_finalize_request() another last buffer is send.  This
causes duplicate final chunk to appear if chunked encoding is used (and
resulting problems with keepalive connections and so on).

Fix this by not sending in ngx_http_upstream_finalize_request()
another last buffer if we know response was from cache.

14 years agoCache: fix for sending of empty responses.
Maxim Dounin [Tue, 27 Sep 2011 11:15:35 +0000 (11:15 +0000)]
Cache: fix for sending of empty responses.

Revert wrong fix for empty responses introduced in 0.8.31 and apply new one,
rewritten to match things done by static module as close as possible.

14 years agoIncorrect special case for "return 204" removed.
Maxim Dounin [Tue, 27 Sep 2011 11:14:02 +0000 (11:14 +0000)]
Incorrect special case for "return 204" removed.

The special case in question leads to replies without body in
configuration like

    location / { error_page 404 /zero; return 404; }
    location /zero { return 204; }

while replies with empty body are expected per protocol specs.

Correct one will look like

    if (status == NGX_HTTP_NO_CONTENT) {

        rc = ngx_http_send_header(r);

        if (rc == NGX_ERROR || r->header_only) {
            return rc;
        }

        return ngx_http_send_special(r, NGX_HTTP_LAST);
    }

though it looks like it's better to drop this special case at all.

14 years agoFix for "return 202" not discarding body.
Maxim Dounin [Tue, 27 Sep 2011 11:13:00 +0000 (11:13 +0000)]
Fix for "return 202" not discarding body.

Big POST (not fully preread) to a

    location / {
        return 202;
    }

resulted in incorrect behaviour due to "return" code path not calling
ngx_http_discard_request_body().  The same applies to all "return" used
with 2xx/3xx codes except 201 and 204, and to all "return ... text" uses.

Fix is to add ngx_http_discard_request_body() call to ngx_http_send_response()
function where it looks appropriate.  Discard body call from emtpy gif module
removed as it's now redundant.

Reported by Pyry Hakulinen, see
http://mailman.nginx.org/pipermail/nginx/2011-August/028503.html

14 years agoFix for double content when return is used in error_page handler.
Maxim Dounin [Tue, 27 Sep 2011 11:11:30 +0000 (11:11 +0000)]
Fix for double content when return is used in error_page handler.

Test case:

   location / {
       error_page 405 /nope;
       return 405;
   }

   location /nope {
       return 200;
   }

This is expected to return 405 with empty body, but in 0.8.42+ will return
builtin 405 error page as well (though not counted in Content-Length, thus
breaking protocol).

Fix is to use status provided by rewrite script execution in case
it's less than NGX_HTTP_BAD_REQUEST even if r->error_status set.  This
check is in line with one in ngx_http_script_return_code().

Note that this patch also changes behaviour for "return 302 ..." and
"rewrite ... redirect" used as error handler.  E.g.

    location / {
        error_page 405 /redirect;
        return 405;
    }

    location /redirect {
        rewrite ^ http://example.com/;
    }

will actually return redirect to "http://example.com/" instead of builtin 405
error page with meaningless Location header.  This looks like correct change
and it's in line with what happens on e.g. directory redirects in error
handlers.

14 years agoFix for incorrect 201 replies from dav module.
Maxim Dounin [Tue, 27 Sep 2011 11:09:55 +0000 (11:09 +0000)]
Fix for incorrect 201 replies from dav module.

Replies with 201 code contain body, and we should clearly indicate it's
empty if it's empty.  Before 0.8.32 chunked was explicitly disabled for
201 replies and as a result empty body was indicated by connection close
(not perfect, but worked).  Since 0.8.32 chunked is enabled, and this
causes incorrect responses from dav module when HTTP/1.1 is used: with
"Transfer-Encoding: chunked" but no chunks at all.

Fix is to actually return empty body in special response handler instead
of abusing r->header_only flag.

See here for initial report:
http://mailman.nginx.org/pipermail/nginx-ru/2010-October/037535.html

14 years agoProxy: logging levels tuned, double logging fixed.
Maxim Dounin [Sun, 25 Sep 2011 20:04:20 +0000 (20:04 +0000)]
Proxy: logging levels tuned, double logging fixed.

14 years agoProxy: whitespaces after chunk size allowed.
Maxim Dounin [Sun, 25 Sep 2011 20:03:27 +0000 (20:03 +0000)]
Proxy: whitespaces after chunk size allowed.

Whitespaces after chunk size seems to be be allowed by the "implied *LWS" rule
and emitted by some servers.

14 years agoUpstream: clearing of u->peer.connection on close.
Maxim Dounin [Sun, 25 Sep 2011 20:00:36 +0000 (20:00 +0000)]
Upstream: clearing of u->peer.connection on close.

This fixes crashes observed with some 3rd party balancer modules.  Standard
balancer modules (round-robin and ip hash) explicitly set pc->connection
(aka u->peer.connection) to NULL and aren't affected.

14 years agoFixed error message.
Ruslan Ermilov [Fri, 23 Sep 2011 20:15:27 +0000 (20:15 +0000)]
Fixed error message.