aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* Stable branch.Maxim Dounin2017-04-12
|
* Upstream: allow recovery from "429 Too Many Requests" response.Piotr Sikora2017-03-24
| | | | | | | | This change adds "http_429" parameter to "proxy_next_upstream" for retrying rate-limited requests, and to "proxy_cache_use_stale" for serving stale cached responses after being rate-limited. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* Added support for "429 Too Many Requests" response (RFC6585).Piotr Sikora2017-03-24
| | | | | | | | This change adds reason phrase in status line and pretty response body when "429" status code is used in "return", "limit_conn_status" and/or "limit_req_status" directives. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* Fixed type.hucongcong2017-04-03
|
* Slice filter: prevented slice redirection (ticket #1219).Roman Arutyunyan2017-03-31
| | | | | | | When a slice subrequest was redirected to a new location, its context was lost. After its completion, a new slice subrequest for the same slice was created. This could lead to infinite loop. Now the slice module makes sure each slice subrequest starts output with the slice context available.
* Slice filter: allowed at most one subrequest at a time.Roman Arutyunyan2017-03-28
| | | | | Previously, if slice main request write handler was called while a slice subrequest was running, a new subrequest for the same slice was started.
* Moved handling of wev->delayed to the connection event handler.Maxim Dounin2017-04-02
| | | | | | | | | | | With post_action or subrequests, it is possible that the timer set for wev->delayed will expire while the active subrequest write event handler is not ready to handle this. This results in request hangs as observed with limit_rate / sendfile_max_chunk and post_action (ticket #776) or subrequests (ticket #1228). Moving the handling to the connection event handler fixes the hangs observed, and also slightly simplifies the code.
* Perl: fixed delaying subrequests.Maxim Dounin2017-04-02
| | | | | Much like in limit_req, use the wev->delayed flag to ensure proper handling and interoperability with limit_rate.
* Limit req: fixed delaying subrequests.Maxim Dounin2017-04-02
| | | | | | | | | | | | | | Since limit_req uses connection's write event to delay request processing, it can conflict with timers in other subrequests. In particular, even if applied to an active subrequest, it can break things if wev->delayed is already set (due to limit_rate or sendfile_max_chunk), since after limit_req finishes the wev->delayed flag will be set and no timer will be active. Fix is to use the wev->delayed flag in limit_req as well. This ensures that wev->delayed won't be set after limit_req finishes, and also ensures that limit_req's timers will be properly handled by other subrequests if the one delayed by limit_req is not active.
* HTTP/2: style and typos.Piotr Sikora2017-03-26
| | | | Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* HTTP/2: fixed connection finalization.Valentin Bartenev2017-03-29
| | | | | | | | | | | | | | | | | | | | | | All streams in connection must be finalized before the connection itself can be finalized and all related memory is freed. That's not always possible on the current event loop iteration. Thus when the last stream is finalized, it sets the special read event handler ngx_http_v2_handle_connection_handler() and posts the event. Previously, this handler didn't check the connection state and could call the regular event handler on a connection that was already in finalization stage. In the worst case that could lead to a segmentation fault, since some data structures aren't supposed to be used during connection finalization. Particularly, the waiting queue can contain already freed streams, so the WINDOW_UPDATE frame received by that moment could trigger accessing to these freed streams. Now, the connection error flag is explicitly checked in ngx_http_v2_handle_connection_handler().
* HTTP/2: fixed stream finalization.Valentin Bartenev2017-03-29
| | | | | | | | | | In order to finalize stream the error flag is set on fake connection and either "write" or "read" event handler is called. The read events of fake connections are always ready, but it's not the case with the write events. When the ready flag isn't set, the error flag can be not checked in some cases and as a result stream isn't finalized. Now the ready flag is explicilty set on write events for proper finalization in all cases.
* HTTP/2: emit PROTOCOL_ERROR on padding errors.Piotr Sikora2017-03-26
| | | | Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* HTTP/2: fix flow control with padded DATA frames.Piotr Sikora2017-03-26
| | | | | | | | | Previously, flow control didn't account for padding in DATA frames, which meant that its view of the world could drift from peer's view by up to 256 bytes per received padded DATA frame, which could lead to a deadlock. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* HTTP/2: fix $body_bytes_sent variable.Piotr Sikora2017-03-26
| | | | | | | Previously, its value included payloads and frame headers of HEADERS and CONTINUATION frames. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* HTTP/2: fix $bytes_sent variable.Piotr Sikora2017-03-26
| | | | | | | | Previously, its value accounted for payloads of HEADERS, CONTINUATION and DATA frames, as well as frame headers of HEADERS and DATA frames, but it didn't account for frame headers of CONTINUATION frames. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* Copy filter: wake up subrequests after aio operations.Maxim Dounin2017-03-28
| | | | | | | | Previously, connection write handler was called, resulting in wake up of the active subrequest. This change makes it possible to read data in non-active subrequests as well. For example, this allows SSI to process instructions in non-active subrequests earlier and start additional subrequests if needed, reducing overall response time.
* Threads: fixed request hang with aio_write and subrequests.Maxim Dounin2017-03-28
| | | | | | | | | | | If the subrequest is already finalized, the handler set with aio_write may still be used by sendfile in threads when using range requests (see also e4c1f5b32868, and the original note in 9fd738b85fad). Calling already finalized subrequest's r->write_event_handler in practice results in request hang in some cases. Fix is to trigger connection event handler if the subrequest was already finalized.
* Simplified and improved sendfile() code on Linux.Maxim Dounin2017-03-28
| | | | | | | | | | | | | | | | | The ngx_linux_sendfile() function is now used for both normal sendfile() and sendfile in threads. The ngx_linux_sendfile_thread() function was modified to use the same interface as ngx_linux_sendfile(), and is simply called from ngx_linux_sendfile() when threads are enabled. Special return code NGX_DONE is used to indicate that a thread task was posted and no further actions are needed. If number of bytes sent is less that what we were sending, we now always retry sending. This is needed for sendfile() in threads as the number of bytes we are sending might have been changed since the thread task was posted. And this is also needed for Linux 4.3+, as sendfile() might be interrupted at any time and provides no indication if it was interrupted or not (ticket #1174).
* Fixed ngx_open_cached_file() error handling.Sergey Kandaurov2017-03-28
| | | | | | If of.err is 0, it means that there was a memory allocation error and no further logging and/or processing is needed. The of.failed string can be only accessed if of.err is not 0.
* Core: set nginx_shared_zone name via ngx_str_set().Ruslan Ermilov2017-03-28
|
* Use ngx_array_init() to initialize arrays.Ruslan Ermilov2017-03-28
|
* Version bump.Ruslan Ermilov2017-03-28
|
* Fixed CPU hog while freeing hc->busy after e662cbf1b932 (1.11.11).Maxim Dounin2017-03-24
| | | | | Reported by Richard Stanway, http://mailman.nginx.org/pipermail/nginx/2017-March/053296.html.
* Simplified code about duplicate root/alias directive.Ruslan Ermilov2017-03-22
|
* Unified error messages about duplicate directives.Ruslan Ermilov2017-03-22
|
* Version bump.Ruslan Ermilov2017-03-22
|
* Fixed a comment.Ruslan Ermilov2017-03-17
|
* Added missing "static" specifier found by gcc -Wtraditional.Ruslan Ermilov2017-03-16
| | | | This has somehow escaped from fbdaad9b0e7b.
* Style.Maxim Dounin2017-03-07
|
* Introduced worker_shutdown_timeout.Maxim Dounin2017-03-07
| | | | | | The directive configures a timeout to be used when gracefully shutting down worker processes. When the timer expires, nginx will try to close all the connections currently open to facilitate shutdown.
* Cancelable timers are now preserved if there are other timers.Maxim Dounin2017-03-07
| | | | | | | | | There is no need to cancel timers early if there are other timers blocking shutdown anyway. Preserving such timers allows nginx to continue some periodic work till the shutdown is actually possible. With the new approach, timers with ev->cancelable are simply ignored when checking if there are any timers left during shutdown.
* Core: introduced ngx_rbtree_next().Maxim Dounin2017-03-07
|
* Access log: removed dead ev->timedout check in flush timer handler.Maxim Dounin2017-03-07
| | | | | | | | | | | | | | The ev->timedout flag is set on first timer expiration, and never reset after it. Due to this the code to stop the timer when the timer was canceled never worked (except in a very specific time frame immediately after start), and the timer was always armed again. This essentially resulted in a buffer flush at the end of an event loop iteration. This behaviour actually seems to be better than just stopping the flush timer for the whole shutdown, so it is preserved as is instead of fixing the code to actually remove the timer. It will be further improved by upcoming changes to preserve cancelable timers if there are other timers blocking shutdown.
* Converted hc->busy/hc->free to use chain links.Maxim Dounin2017-03-07
| | | | | | | | Most notably, this fixes possible buffer overflows if number of large client header buffers in a virtual server is different from the one in the default server. Reported by Daniil Bondarev.
* Removed casts not needed after 1f513d7f1b45.Ruslan Ermilov2017-03-07
|
* Mail: don't emit separator in capability lists for APOP.Sergey Kandaurov2017-03-06
| | | | | | Notably, this fixes CAPA and AUTH output. The bug had appeared in nginx 1.11.6 (73b451d304c0).
* Added missing "static" specifiers found by gcc -Wtraditional.Ruslan Ermilov2017-03-06
|
* Added missing static specifiers.Eran Kornblau2017-03-02
|
* Fixed background update with "if".Maxim Dounin2017-02-27
| | | | | | | | | | | | | | | | | | | | | | | | Cloned subrequests should inherit r->content_handler. This way they will be able to use the same location configuration as the original request if there are "if" directives in the configuration. Without r->content_handler inherited, the following configuration tries to access a static file in the update request: location / { set $true 1; if ($true) { # nothing } proxy_pass http://backend; proxy_cache one; proxy_cache_use_stale updating; proxy_cache_background_update on; } See http://mailman.nginx.org/pipermail/nginx/2017-February/053019.html for initial report.
* Fixed ngx_parse_size() / ngx_parse_offset() with 0-length strings.Maxim Dounin2017-02-17
|
* Version bump.Maxim Dounin2017-02-16
|
* Gzip: free chain links on the hot path (ticket #1046).Maxim Dounin2017-02-13
|
* Upstream: read handler cleared on upstream finalization.Maxim Dounin2017-02-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | With "proxy_ignore_client_abort off" (the default), upstream module changes r->read_event_handler to ngx_http_upstream_rd_check_broken_connection(). If the handler is not cleared during upstream finalization, it can be triggered later, causing unexpected effects, if, for example, a request was redirected to a different location using error_page or X-Accel-Redirect. In particular, it makes "proxy_ignore_client_abort on" non-working after a redirection in a configuration like this: location = / { error_page 502 = /error; proxy_pass http://127.0.0.1:8082; } location /error { proxy_pass http://127.0.0.1:8083; proxy_ignore_client_abort on; } It is also known to cause segmentation faults with aio used, see http://mailman.nginx.org/pipermail/nginx-ru/2015-August/056570.html. Fix is to explicitly set r->read_event_handler to ngx_http_block_reading() during upstream finalization, similar to how it is done in the request body reading code and in the limit_req module.
* Cache: increased cache header Vary and ETag lengths to 128.Maxim Dounin2017-02-10
| | | | | | | | | | | | This allows to store larger ETag values for proxy_cache_revalidate, including ones generated as SHA256, and cache responses with longer Vary (ticket #826). In particular, this fixes caching of Amazon S3 responses with CORS enabled, which now use "Vary: Origin, Access-Control-Request-Headers, Access-Control-Request-Method". Cache version bumped accordingly.
* Slice filter: fetch slices in cloned subrequests.Roman Arutyunyan2017-02-10
| | | | | | | | | Previously, slice subrequest location was selected based on request URI. If request is then redirected to a new location, its context array is cleared, making the slice module loose current slice range information. This lead to broken output. Now subrequests with the NGX_HTTP_SUBREQUEST_CLONE flag are created for slices. Such subrequests stay in the same location as the parent request and keep the right slice context.
* Upstream: proxy_cache_background_update and friends.Roman Arutyunyan2017-02-10
| | | | The directives enable cache updates in subrequests.
* Cache: support for stale-while-revalidate and stale-if-error.Roman Arutyunyan2016-12-22
| | | | | | | | Previously, there was no way to enable the proxy_cache_use_stale behavior by reading the backend response. Now, stale-while-revalidate and stale-if-error Cache-Control extensions (RFC 5861) are supported. They specify, how long a stale response can be used when a cache entry is being updated, or in case of an error.
* Request body: commented out debug printing of old buffers.Maxim Dounin2017-02-08
| | | | | This is not really needed in practice, and causes excessive debug output in some of our tests.
* Request body: c->error on "100 Continue" errors (ticket #1194).Maxim Dounin2017-02-08
|