summaryrefslogtreecommitdiffhomepage
path: root/src (follow)
AgeCommit message (Collapse)AuthorFilesLines
2011-10-05Version bump.Igor Sysoev2-3/+3
2011-10-05Fixed cache bypass caching of non-cacheable replies (ticket #21).Maxim Dounin1-4/+2
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.
2011-09-30Added uwsgi_buffering and scgi_buffering directives.Maxim Dounin2-2/+20
Patch by Peter Smit.
2011-09-30Using strtod() instead of atofp() to support a lot of digits after dot inIgor Sysoev1-2/+9
"start" parameter value.
2011-09-29Fix of building on platforms with 32-bit off_t. (closed #23)Igor Sysoev1-9/+9
2011-09-27Fixed segmentation fault with empty config on Windows.Maxim Dounin1-3/+5
See here for report: http://mailman.nginx.org/pipermail/nginx-ru/2011-September/043288.html
2011-09-27Fix for "ssl_session_cache builtin" (broken since 1.1.1, r3993).Maxim Dounin2-4/+4
2011-09-27Better handling of late upstream creation.Maxim Dounin1-0/+4
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.
2011-09-27Cache: fix for sending of stale responses.Maxim Dounin1-1/+6
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.
2011-09-27Cache: fix for sending of empty responses.Maxim Dounin1-3/+5
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.
2011-09-27Incorrect special case for "return 204" removed.Maxim Dounin1-5/+0
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.
2011-09-27Fix for "return 202" not discarding body.Maxim Dounin2-7/+4
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
2011-09-27Fix for double content when return is used in error_page handler.Maxim Dounin1-2/+2
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.
2011-09-27Fix for incorrect 201 replies from dav module.Maxim Dounin1-3/+2
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
2011-09-25Proxy: logging levels tuned, double logging fixed.Maxim Dounin1-6/+3
2011-09-25Proxy: whitespaces after chunk size allowed.Maxim Dounin1-0/+4
Whitespaces after chunk size seems to be be allowed by the "implied *LWS" rule and emitted by some servers.
2011-09-25Upstream: clearing of u->peer.connection on close.Maxim Dounin1-0/+1
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.
2011-09-23Fixed error message.Ruslan Ermilov1-1/+1
2011-09-20Fix of separate pool for upstream connections (r4117).Maxim Dounin1-2/+8
Pool may not be created if connection was created but rejected in connect() call. Make sure to check if it is here before trying to destroy it.
2011-09-20Fixed loss of chain links in ngx_event_pipe_read_upstream().Maxim Dounin1-0/+1
2011-09-20Fixed loss of chain links in fastcgi module.Maxim Dounin1-2/+4
2011-09-20Fix of cpu hog in event pipe.Maxim Dounin1-2/+2
If client closed connection in ngx_event_pipe_write_to_downstream(), buffers in the "out" chain were lost. This caused cpu hog if all available buffers were in the "out" chain. Fix is to call ngx_chain_update_chains() before checking return code of output filter to avoid loosing buffers in the "out" chain. Note that this situation (all available buffers in the "out" chain) isn't normal, it should be prevented by busy buffers limit. Though right now it may happen with complex protocols like fastcgi. This should be addressed separately.
2011-09-20The "worker_aio_requests" directive.Igor Sysoev1-3/+13
The default value is 32 AIO simultaneous requests per worker. Previously they were hardcoded to 1024, and it was too large, since Linux allocated them early on io_setup(), but not on request itself. So with default value of /proc/sys/fs/aio-max-nr equal to 65536 only 64 worker processes could be run simultaneously. 32 AIO requests are enough for modern disks even if server runs only 1 worker.
2011-09-19Replaced "can not" with "cannot" and "could not" in a bunch of places.Ruslan Ermilov16-20/+21
Fixed nearby grammar errors.
2011-09-19Cosmetics: replaced NGX_CONF_TAKE1 to NGX_CONF_FLAG for "sendfile"Ruslan Ermilov1-2/+2
and "chunked_transfer_encoding" directives, to be in line with all directives taking a boolean argument. Both flags will ensure that a directive takes one argument.
2011-09-19Overhauled diagnostic messages.Ruslan Ermilov1-21/+21
2011-09-16Fixing Linux AIO initiatialization: AIO operations are disabled if kernelIgor Sysoev1-47/+82
does not support them. Previously worker just exited.
2011-09-16Fixing Linux AIO syscalls return value handling:Igor Sysoev2-19/+18
syscall(2) uses usual libc convention, it returns -1 on error and sets errno. Obsolete _syscall(2) returns negative value of error. Thanks to Hagai Avrahami.
2011-09-16Trailing space fix.Maxim Dounin1-1/+1
2011-09-15Upstream keepalive module.Maxim Dounin1-0/+569
2011-09-15Proxy: basic HTTP/1.1 support (including keepalive).Maxim Dounin1-5/+773
By default we still send requests using HTTP/1.0. This may be changed with new proxy_http_version directive.
2011-09-15Protocol version parsing in ngx_http_parse_status_line().Maxim Dounin3-0/+11
Once we know protocol version, set u->headers_in.connection_close to indicate implicitly assumed connection close with HTTP before 1.1.
2011-09-15Upstream: Connection header processing.Maxim Dounin2-1/+21
2011-09-15Upstream: Transfer-Encoding header processing.Maxim Dounin2-0/+27
2011-09-15Keepalive support in fastcgi.Maxim Dounin1-7/+69
By default follow the old behaviour, i.e. FASTCGI_KEEP_CONN flag isn't set in request and application is responsible for closing connection once request is done. To keep connections alive fastcgi_keep_conn must be activated.
2011-09-15Keepalive support in memcached.Maxim Dounin1-0/+16
2011-09-15Upstream: keepalive flag.Maxim Dounin2-1/+9
This patch introduces r->upstream->keepalive flag, which is set by protocol handlers if connection to upstream is in good state and can be kept alive.
2011-09-15Upstream: pipe length and input_filter_init in buffered mode.Maxim Dounin3-0/+39
As long as ngx_event_pipe() has more data read from upstream than specified in p->length it's passed to input filter even if buffer isn't yet full. This allows to process data with known length without relying on connection close to signal data end. By default p->length is set to -1 in upstream module, i.e. end of data is indicated by connection close. To set it from per-protocol handlers upstream input_filter_init() now called in buffered mode (as well as in unbuffered mode).
2011-09-15Upstream: r->upstream->length type change to off_t.Maxim Dounin3-13/+4
Previous use of size_t may cause wierd effects on 32bit platforms with certain big responses transferred in unbuffered mode. Nuke "if (size > u->length)" check as it's not usefull anyway (preread body data isn't subject to this check) and now requires additional check for u->length being positive.
2011-09-15Upstream: content_length_n API change.Maxim Dounin2-29/+28
We no longer use r->headers_out.content_length_n as a primary source of backend's response length. Instead we parse response length to u->headers_in.content_length_n and copy to r->headers_out.content_length_n when needed.
2011-09-15Upstream: separate pool for peer connections.Maxim Dounin1-1/+15
This is required to support persistent https connections as various ssl structures are allocated from connection's pool.
2011-09-15Workaround for cpu hog on errors with cached connections.Maxim Dounin1-0/+4
Just doing another connect isn't safe as peer.get() may expect peer.tries to be strictly positive (this is the case e.g. with round robin with multiple upstream servers). Increment peer.tries to at least avoid cpu hog in round robin balancer (with the patch alert will be seen instead). This is not enough to fully address the problem though, hence TODO. We should be able to inform balancer that the error wasn't considered fatal and it may make sense to retry the same peer.
2011-09-15API change: ngx_chain_update_chains() now requires pool.Maxim Dounin7-15/+18
The ngx_chain_update_chains() needs pool to free chain links used for buffers with non-matching tags. Providing one helps to reduce memory consumption for long-lived requests.
2011-09-15Buffers reuse in chunked filter.Maxim Dounin1-31/+68
There were 2 buffers allocated on each buffer chain sent through chunked filter (one buffer for chunk size, another one for trailing CRLF, about 120 bytes in total on 32-bit platforms). This resulted in large memory consumption with long-lived requests sending many buffer chains. Usual example of problematic scenario is streaming though proxy with proxy_buffering set to off. Introduced buffers reuse reduces memory consumption in the above problematic scenario. See here for initial report: http://mailman.nginx.org/pipermail/nginx/2010-April/019814.html
2011-09-15MP4 co64 atom support added.Igor Sysoev1-6/+164
2011-09-15Fix of struct field name.Igor Sysoev1-4/+4
2011-09-14Style fix.Igor Sysoev1-1/+2
2011-09-14Fixing building by gcc-4.7.Igor Sysoev1-3/+0
2011-09-14Version bump.Igor Sysoev2-3/+3
2011-09-14Fix of the previous commit: is_directio flag processing introduced in r4077Igor Sysoev1-0/+2
is still worthwhile.