summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)AuthorFilesLines
2016-01-26nginx-1.8.1-RELEASErelease-1.8.1Maxim Dounin1-0/+159
2016-01-26Resolver: limited CNAME recursion.Ruslan Ermilov1-6/+22
Previously, the recursion was only limited for cached responses.
2016-01-26Resolver: fixed use-after-free memory accesses with CNAME.Roman Arutyunyan2-39/+35
When several requests were waiting for a response, then after getting a CNAME response only the last request's context had the name updated. Contexts of other requests had the wrong name. This name was used by ngx_resolve_name_done() to find the node to remove the request context from. When the name was wrong, the request could not be properly cancelled, its context was freed but stayed linked to the node's waiting list. This happened e.g. when the first request was aborted or timed out before the resolving completed. When it completed, this triggered a use-after-free memory access by calling ctx->handler of already freed request context. The bug manifests itself by "could not cancel <name> resolving" alerts in error_log. When a request was responded with a CNAME, the request context kept the pointer to the original node's rn->u.cname. If the original node expired before the resolving timed out or completed with an error, this would trigger a use-after-free memory access via ctx->name in ctx->handler(). The fix is to keep ctx->name unmodified. The name from context is no longer used by ngx_resolve_name_done(). Instead, we now keep the pointer to resolver node to which this request is linked. Keeping the original name intact also improves logging.
2016-01-26Resolver: changed the ngx_resolver_create_*_query() arguments.Roman Arutyunyan1-30/+27
No functional changes. This is needed by the following change.
2016-01-26Resolver: fixed CNAME processing for several requests.Ruslan Ermilov1-6/+15
When several requests were waiting for a response, then after getting a CNAME response only the last request was properly processed, while others were left waiting.
2016-01-26Resolver: fixed crashes in timeout handler.Ruslan Ermilov2-25/+42
If one or more requests were waiting for a response, then after getting a CNAME response, the timeout event on the first request remained active, pointing to the wrong node with an empty rn->waiting list, and that could cause either null pointer dereference or use-after-free memory access if this timeout expired. If several requests were waiting for a response, and the first request terminated (e.g., due to client closing a connection), other requests were left without a timeout and could potentially wait indefinitely. This is fixed by introducing per-request independent timeouts. This change also reverts 954867a2f0a6 and 5004210e8c78.
2016-01-26Resolver: fixed possible segmentation fault on DNS format error.Roman Arutyunyan1-1/+1
2016-01-25Updated OpenSSL and PCRE used for win32 builds.Maxim Dounin1-2/+2
2015-11-05SSL: only select SPDY using NPN if "spdy" is enabled.Valentin Bartenev1-8/+16
OpenSSL doesn't check if the negotiated protocol has been announced. As a result, the client might force using SPDY even if it wasn't enabled in configuration.
2015-10-30Fixed ngx_parse_time() out of bounds access (ticket #821).Maxim Dounin1-1/+1
The code failed to ensure that "s" is within the buffer passed for parsing when checking for "ms", and this resulted in unexpected errors when parsing non-null-terminated strings with trailing "m". The bug manifested itself when the expires directive was used with variables. Found by Roman Arutyunyan.
2015-10-19SSL: preserve default server context in connection (ticket #235).Maxim Dounin2-12/+8
This context is needed for shared sessions cache to work in configurations with multiple virtual servers sharing the same port. Unfortunately, OpenSSL does not provide an API to access the session context, thus storing it separately. In collaboration with Vladimir Homutov.
2015-09-03Upstream: fixed cache send error handling.Roman Arutyunyan1-11/+14
The value of NGX_ERROR, returned from filter handlers, was treated as a generic upstream error and changed to NGX_HTTP_INTERNAL_SERVER_ERROR before calling ngx_http_finalize_request(). This resulted in "header already sent" alert if header was already sent in filter handlers. The problem appeared in 54e9b83d00f0 (1.7.5).
2015-08-16Fixed wrong URI after try_files in nested location (ticket #97).Maxim Dounin1-3/+5
The following configuration with alias, nested location and try_files resulted in wrong file being used. Request "/foo/test.gif" tried to use "/tmp//foo/test.gif" instead of "/tmp/test.gif": location /foo/ { alias /tmp/; location ~ gif { try_files $uri =405; } } Additionally, rev. c985d90a8d1f introduced a regression if the "/tmp//foo/test.gif" file was found (ticket #768). Resulting URI was set to "gif?/foo/test.gif", as the code used clcf->name of current location ("location ~ gif") instead of parent one ("location /foo/"). Fix is to use r->uri instead of clcf->name in all cases in the ngx_http_core_try_files_phase() function. It is expected to be already matched and identical to the clcf->name of the right location.
2015-08-16Fixed segfault with try_files introduced by c985d90a8d1f.Maxim Dounin1-1/+3
If alias was used in a location given by a regular expression, nginx used to do wrong thing in try_files if a location name (i.e., regular expression) was an exact prefix of URI. The following configuration triggered a segmentation fault on a request to "/mail": location ~ /mail { alias /path/to/directory; try_files $uri =404; } Reported by Per Hansson.
2015-05-06Events: made a failure to create a notification channel non-fatal.Ruslan Ermilov1-1/+1
This may happen if eventfd() returns ENOSYS, notably seen on CentOS 5.4. Such a failure will now just disable the notification mechanism and let the callers cope with it, instead of failing to start worker processes. If thread pools are not configured, this can safely be ignored.
2015-04-24Merge proxy_protocol setting of listen directives.Roman Arutyunyan1-1/+4
It's now enough to specify proxy_protocol option in one listen directive to enable it in all servers listening on the same address/port. Previously, the setting from the first directive was always used.
2016-01-25Version bump.Maxim Dounin1-2/+2
2015-04-21release-1.8.0 tagMaxim Dounin1-0/+1
2015-04-21nginx-1.8.0-RELEASErelease-1.8.0Maxim Dounin1-0/+14
2015-04-16Core: ensure that ngx_config.h is always included first.Sergey Kandaurov1-0/+3
This fixes compilation of various 3rd party modules when nginx is configured with threads.
2015-04-16Stable branch.Maxim Dounin1-2/+2
2015-04-16Fixed build, broken by 8b7f062a3fe6.Ruslan Ermilov1-1/+2
Casting a "const char *" to "char *" doesn't work on older gcc versions.
2015-04-16Core: added OpenSSL version information to "nginx -V" output.Vladimir Homutov1-5/+16
2015-04-16Version bump.Vladimir Homutov1-2/+2
2015-04-07release-1.7.12 tagMaxim Dounin1-0/+1
2015-04-07nginx-1.7.12-RELEASErelease-1.7.12Maxim Dounin1-0/+63
2015-03-26Core: guard against spinlock usage without atomic ops.Ruslan Ermilov1-1/+1
The new thread pools code uses spinlocks.
2015-04-07Core: limited levels of subdirectory hierarchy used for temp files.Sergey Kandaurov1-0/+4
Similar to ngx_http_file_cache_set_slot(), the last component of file->name with a fixed length of 10 bytes, as generated in ngx_create_temp_path(), is used as a source for the names of intermediate subdirectories with each one taking its own part. Ensure that the sum of specified levels with slashes fits into the length (ticket #731).
2015-04-07Core: removed excessive initialization in ngx_conf_set_path_slot().Sergey Kandaurov1-4/+0
Level hierarchy is pre-zeroed in ngx_pcalloc() of the surrounding ngx_path_t.
2015-04-07Core: fixed error handling on ngx_conf_full_name() failure.Sergey Kandaurov1-1/+1
2015-04-07Upstream: abbreviated SSL handshake may interact badly with Nagle.Ruslan Ermilov1-1/+25
2015-04-06Request body: always flush buffers if request buffering is off.Valentin Bartenev1-0/+2
This fixes unbuffered proxying to SSL backends, since it prevents ngx_ssl_send_chain() from accumulation of request body in the SSL buffer.
2015-04-06Used the correct type for the AIO preload handler return value.Valentin Bartenev1-2/+2
2015-04-03Configure: style.Maxim Dounin1-1/+1
2015-04-01OCSP stapling: missing free calls.Filipe da Silva1-0/+2
Missing call to X509_STORE_CTX_free when X509_STORE_CTX_init fails. Missing call to OCSP_CERTID_free when OCSP_request_add0_id fails. Possible leaks in vary particular scenariis of memory shortage.
2015-04-01Cache: added support for reading of the header in thread pools.Valentin Bartenev2-19/+109
2015-03-31Fixed invalid access to complex value defined as an empty string.Sergey Kandaurov2-5/+5
Found by Valgrind.
2015-03-27Events: fixed possible crash on start or reload.Valentin Bartenev1-2/+2
The main thread could wake up and start processing the notify event before the handler was set.
2015-03-27Events: made posted events macros safe.Valentin Bartenev1-8/+8
2015-03-23SPDY: always push pending data.Valentin Bartenev1-51/+40
This helps to avoid suboptimal behavior when a client waits for a control frame or more data to increase window size, but the frames have been delayed in the socket buffer. The delays can be caused by bad interaction between Nagle's algorithm on nginx side and delayed ACK on the client side or by TCP_CORK/TCP_NOPUSH if SPDY was working without SSL and sendfile() was used. The pushing code is now very similar to ngx_http_set_keepalive().
2015-03-23SPDY: fixed error handling in ngx_http_spdy_send_output_queue().Valentin Bartenev1-8/+12
2015-03-26Version bump.Maxim Dounin1-2/+2
2015-03-26Proxy: fixed proxy_request_buffering and chunked with preread body.Maxim Dounin1-3/+4
If any preread body bytes were sent in the first chain, chunk size was incorrectly added before the whole chain, including header, resulting in an invalid request sent to upstream. Fixed to properly add chunk size after the header.
2015-03-24release-1.7.11 tagMaxim Dounin1-0/+1
2015-03-24nginx-1.7.11-RELEASErelease-1.7.11Maxim Dounin1-0/+168
2015-03-23Upstream: uwsgi_request_buffering, scgi_request_buffering.Maxim Dounin2-2/+44
2015-03-23FastCGI: fastcgi_request_buffering.Maxim Dounin1-18/+342
2015-03-23Proxy: proxy_request_buffering chunked support.Maxim Dounin1-6/+216
2015-03-23Request body: unbuffered reading.Maxim Dounin8-25/+306
The r->request_body_no_buffering flag was introduced. It instructs client request body reading code to avoid reading the whole body, and to call post_handler early instead. The caller should use the ngx_http_read_unbuffered_request_body() function to read remaining parts of the body. Upstream module is now able to use this mode, if configured with the proxy_request_buffering directive.
2015-03-23Request body: filters support.Maxim Dounin5-8/+22