summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* nginx-1.13.3-RELEASErelease-1.13.3Maxim Dounin2017-07-111-0/+20
|
* Range filter: avoid negative range start.Maxim Dounin2017-07-111-1/+1
| | | | | | Suffix ranges no longer allowed to set negative start values, to prevent ranges with negative start from appearing even if total size protection will be removed.
* Range filter: protect from total size overflows.Maxim Dounin2017-07-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | The overflow can be used to circumvent the restriction on total size of ranges introduced in c2a91088b0c0 (1.1.2). Additionally, overflow allows producing ranges with negative start (such ranges can be created by using a suffix, "bytes=-100"; normally this results in 200 due to the total size check). These can result in the following errors in logs: [crit] ... pread() ... failed (22: Invalid argument) [alert] ... sendfile() failed (22: Invalid argument) When using cache, it can be also used to reveal cache file header. It is believed that there are no other negative effects, at least with standard nginx modules. In theory, this can also result in memory disclosure and/or segmentation faults if multiple ranges are allowed, and the response is returned in a single in-memory buffer. This never happens with standard nginx modules though, as well as known 3rd party modules. Fix is to properly protect from possible overflow when incrementing size.
* Variables: use ngx_http_variable_null_value where appropriate.Ruslan Ermilov2017-07-071-11/+5
|
* Resolver: cancelable resend timer event.Ruslan Ermilov2017-07-042-0/+3
| | | | | | | | | It is safe because re-sending still works during graceful shutdown as long as resolving takes place (and resolve tasks set their own timeouts that are not cancelable). Also, the new ctx->cancelable flag can be set to make resolve task's timeout event cancelable.
* Resolver: factored out setting a timer for resolver timeout.Sergey Kandaurov2017-07-041-50/+33
| | | | No functional changes.
* Slab: fixed small allocations on systems with large pagesize.Ruslan Ermilov2017-07-041-4/+13
| | | | | | Notably, on ppc64 with 64k pagesize, slab 0 (of size 8) requires 128 64-bit elements for bitmasks. The code bogusly assumed that one uintptr_t is enough for bitmasks plus at least one free slot.
* Slab: style.Ruslan Ermilov2017-07-041-10/+10
|
* Resolver: fixed possible use-after-free while resolving SRV.Roman Arutyunyan2017-07-041-19/+19
| | | | | | | | | | | | | Resolving an SRV record includes resolving its host names in subrequests. Previously, if memory allocation failed while reporting a subrequest result after receiving a response from a DNS server, the SRV resolve handler was called immediately with the NGX_ERROR state. However, if the SRV record included another copy of the resolved name, it was reported once again. This could trigger the use-after-free memory access after SRV resolve handler freed the resolve context by calling ngx_resolve_name_done(). Now the SRV resolve handler is called only when all its subrequests are completed.
* Proxy: split configured header names and values.Piotr Sikora2017-03-151-106/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, each configured header was represented in one of two ways, depending on whether or not its value included any variables. If the value didn't include any variables, then it would be represented as as a single script that contained complete header line with HTTP/1.1 delimiters, i.e.: "Header: value\r\n" But if the value included any variables, then it would be represented as a series of three scripts: first contained header name and the ": " delimiter, second evaluated to header value, and third contained only "\r\n", i.e.: "Header: " "$value" "\r\n" This commit changes that, so that each configured header is represented as a series of two scripts: first contains only header name, and second contains (or evaluates to) only header value, i.e.: "Header" "$value" or "Header" "value" This not only makes things more consistent, but also allows header name and value to be accessed separately. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* Version bump.Maxim Dounin2017-07-031-2/+2
|
* release-1.13.2 tagMaxim Dounin2017-06-271-0/+1
|
* nginx-1.13.2-RELEASErelease-1.13.2Maxim Dounin2017-06-271-0/+73
|
* Range filter: allowed ranges on empty files (ticket #1031).Maxim Dounin2017-06-271-0/+3
| | | | | | | | | | | | | | As per RFC 2616 / RFC 7233, any range request to an empty file is expected to result in 416 Range Not Satisfiable response, as there cannot be a "byte-range-spec whose first-byte-pos is less than the current length of the entity-body". On the other hand, this makes use of byte-range requests inconvenient in some cases, as reported for the slice module here: http://mailman.nginx.org/pipermail/nginx-devel/2017-June/010177.html This commit changes range filter to instead return 200 if the file is empty and the range requested starts at 0.
* Upstream: introduced ngx_http_upstream_ssl_handshake_handler().Maxim Dounin2017-06-221-14/+24
| | | | | | | | | | | | | | | | | This change reworks 13a5f4765887 to only run posted requests once, with nothing on stack. Running posted requests with other request functions on stack may result in use-after-free in case of errors, similar to the one reported in #788. To only run posted request once, a separate function was introduced to be used as ssl handshake handler in c->ssl->handler, ngx_http_upstream_ssl_handshake_handler(). The ngx_http_run_posted_requests() is only called in this function, and not in ngx_http_upstream_ssl_handshake() which may be called directly on stack. Additionaly, ngx_http_upstream_ssl_handshake_handler() now does appropriate debug logging of the current subrequest, similar to what is done in other event handlers.
* Upstream: fixed running posted requests (ticket #788).Roman Arutyunyan2017-06-141-1/+6
| | | | | | | | | | | | | | | | | | | Previously, the upstream resolve handler always called ngx_http_run_posted_requests() to run posted requests after processing the resolver response. However, if the handler was called directly from the ngx_resolve_name() function (for example, if the resolver response was cached), running posted requests from the handler could lead to the following errors: - If the request was scheduled for termination, it could actually be terminated in the resolve handler. Upper stack frames could reference the freed request object in this case. - If a significant number of requests were posted, and for each of them the resolve handler was called directly from the ngx_resolve_name() function, posted requests could be run recursively and lead to stack overflow. Now ngx_http_run_posted_requests() is only called from asynchronously invoked resolve handlers.
* Resolver: added the "async" flag to resolver context.Roman Arutyunyan2017-06-142-1/+7
| | | | | The flag indicates that the resolve handler is called asynchronously after the resolve function ngx_resolve_name()/ngx_resolve_addr() exited.
* Resolver: fixed allocation error handling while resolving SRV.Bart Warmerdam2017-06-191-1/+3
|
* Introduced ngx_rwlock_downgrade().Ruslan Ermilov2017-06-162-0/+10
|
* Added memory barrier semantics to ngx_rwlock_unlock().Ruslan Ermilov2017-06-161-1/+1
|
* Headers filter: added "add_trailer" directive.Piotr Sikora2017-03-241-22/+142
| | | | | | | | | Trailers added using this directive are evaluated after response body is processed by output filters (but before it's written to the wire), so it's possible to use variables calculated from the response body as the trailer value. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* HTTP/2: added support for trailers in HTTP responses.Piotr Sikora2017-03-241-14/+152
| | | | Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* Added support for trailers in HTTP responses.Piotr Sikora2017-03-245-27/+157
| | | | | | | | | | | | | | | | | | | | | | | | | Example: ngx_table_elt_t *h; h = ngx_list_push(&r->headers_out.trailers); if (h == NULL) { return NGX_ERROR; } ngx_str_set(&h->key, "Fun"); ngx_str_set(&h->value, "with trailers"); h->hash = ngx_hash_key_lc(h->key.data, h->key.len); The code above adds "Fun: with trailers" trailer to the response. Modules that want to emit trailers must set r->expect_trailers = 1 in header filter, otherwise they might not be emitted for HTTP/1.1 responses that aren't already chunked. This change also adds $sent_trailer_* variables. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* Gzip: fixed style in $gzip_ratio variable handler.Ruslan Ermilov2017-06-141-4/+4
| | | | | | | | | | | | | The current style in variable handlers returning NGX_OK is to either set v->not_found to 1, or to initialize the entire ngx_http_variable_value_t structure. In theory, always setting v->valid = 1 for NGX_OK would be useful, which would mean that the value was computed and is thus valid, including the special case of v->not_found = 1. But currently that's not the case and causes the (v->valid || v->not_found) check to access an uninitialized v->valid value, which is safe only because its value doesn't matter when v->not_found is set.
* Removed excessive casts for ngx_file_info().Ruslan Ermilov2017-06-142-6/+2
|
* Configure: use .exe for binaries for all win32 compilers.Orgad Shaneh2017-06-064-3/+1
|
* Configure: fix compilation on MSYS2 / MinGW64.Orgad Shaneh2017-06-061-1/+1
|
* HTTP/2: reject HTTP/2 requests without ":scheme" pseudo-header.Piotr Sikora2017-06-131-0/+1
| | | | Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* Userid: ngx_http_get_indexed_variable() error handling.Sergey Kandaurov2017-06-071-0/+4
| | | | | | When evaluating a mapped $reset_uid variable in the userid filter, if get_handler set to ngx_http_map_variable() returned an error, this previously resulted in a NULL pointer dereference.
* Fixed segfault in try_files with nested location.Sergey Kandaurov2017-06-071-0/+1
| | | | | If memory allocation of a new r->uri.data storage failed, reset its length as well. Request URI is used in ngx_http_finalize_request() for debug logging.
* SSI: return NGX_ERROR when timefmt memory allocation failed.Sergey Kandaurov2017-06-071-1/+1
| | | | | | Previously, when using NGX_HTTP_SSI_ERROR, error was ignored in ssi processing, thus timefmt could be accessed later in ngx_http_ssi_date_gmt_local_variable() as part of "set" handler, or NULL format pointer could be passed to strftime().
* HTTP/2: don't send SETTINGS ACK before already queued DATA frames.Piotr Sikora2017-06-022-1/+10
| | | | | | | | | | | | | Previously, SETTINGS ACK was sent immediately upon receipt of SETTINGS frame, before already queued DATA frames created using old SETTINGS. This incorrect behavior was source of interoperability issues, because peers rely on the fact that new SETTINGS are in effect after receiving SETTINGS ACK. Reported by Feng Li. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* HTTP/2: make SETTINGS ACK frame reusable.Piotr Sikora2017-06-021-25/+31
| | | | Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* HTTP/2: send SETTINGS ACK after applying all SETTINGS params.Piotr Sikora2017-06-021-2/+2
| | | | | | This avoids sending unnecessary SETTINGS ACK in case of PROTOCOL_ERROR. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* HTTP/2: emit new frames only after applying all SETTINGS params.Piotr Sikora2017-06-021-6/+11
| | | | | | | Previously, new frames could be emitted in the middle of applying new (and already acknowledged) SETTINGS params, which is illegal. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* Configure: enabled rpath for NetBSD.Sergey Kandaurov2017-06-021-0/+8
|
* Configure: disabled IP_PKTINFO feature on certain platforms.Roman Arutyunyan2017-06-011-1/+4
| | | | | | | | On Cygwin and NetBSD 7.0+ struct in_pktinfo has no ipi_spec_dst field, which caused nginx compilation error. Now presence of this field is ensured by the IP_PKTINFO feature test. The problem was introduced by dbb0c854e308 (1.13.0).
* Style.Maxim Dounin2017-06-011-3/+3
|
* Upstream: style.Piotr Sikora2017-05-311-1/+1
| | | | Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* Headers filter: style.Piotr Sikora2017-05-311-2/+2
| | | | Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* HTTP/2: add debug logging of pseudo-headers and cookies.Piotr Sikora2017-05-301-20/+28
| | | | Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* Version bump.Valentin Bartenev2017-05-301-2/+2
|
* release-1.13.1 tagMaxim Dounin2017-05-301-0/+1
|
* nginx-1.13.1-RELEASErelease-1.13.1Maxim Dounin2017-05-301-0/+98
|
* Updated OpenSSL used for win32 builds.Maxim Dounin2017-05-301-1/+1
|
* Fixed background requests with asynchronous operations.Roman Arutyunyan2017-05-291-5/+3
| | | | | | | | | | | | | | | | | | | | | If the main request was finalized while a background request performed an asynchronous operation, the main request ended up in ngx_http_writer() and was not finalized until a network event or a timeout. For example, cache background update with aio enabled made nginx unable to process further client requests or close the connection, keeping it open until client closes it. Now regular finalization of the main request is not suspended because of an asynchronous operation in another request. If a background request was terminated while an asynchronous operation was in progress, background request's write event handler was changed to ngx_http_request_finalizer() and never called again. Now, whenever a request is terminated while an asynchronous operation is in progress, connection error flag is set to make further finalizations of any request with this connection lead to termination. These issues appeared in 1aeaae6e9446 (not yet released).
* Configure: sched_setaffinity() test moved to auto/unix.Maxim Dounin2017-05-292-14/+12
| | | | | | | The sched_setaffinity() function was introduced in DragonFly BSD 4.7, so it is no longer Linux-specific. Prodded by Sepherosa Ziehau.
* Style: changed checks of ngx_ssl_create_connection() to != NGX_OK.Maxim Dounin2017-05-292-2/+2
| | | | | | In http these checks were changed in a6d6d762c554, though mail module was missed at that time. Since then, the stream module was introduced based on mail, using "== NGX_ERROR" check.
* SSL: set TCP_NODELAY on SSL connections before handshake.Maxim Dounin2017-05-292-11/+27
| | | | | | | | | | | | With OpenSSL 1.1.0+, the workaround for handshake buffer size as introduced in a720f0b0e083 (ticket #413) no longer works, as OpenSSL no longer exposes handshake buffers, see https://github.com/openssl/openssl/commit/2e7dc7cd688. Moreover, it is no longer possible to adjust handshake buffers at all now. To avoid additional RTT if handshake uses more than 4k we now set TCP_NODELAY on SSL connections before handshake. While this still results in sub-optimal network utilization due to incomplete packets being sent, it seems to be better than nothing.
* Introduced ngx_tcp_nodelay().Ruslan Ermilov2017-05-267-155/+69
|