summaryrefslogtreecommitdiffhomepage
path: root/src/http (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-11-16Realip: the $realip_remote_addr variable.Ruslan Ermilov1-1/+71
2015-11-13HTTP/2: reused HEADERS and CONTINUATION frames buffers.Valentin Bartenev2-10/+21
2015-11-13HTTP/2: fixed handling of output HEADERS frames.Valentin Bartenev1-6/+19
The HEADERS frame is always represented by more than one buffer since b930e598a199, but the handling code hasn't been adjusted. Only the first buffer of HEADERS frame was checked and if it had been sent while others had not, the rest of the frame was dropped, resulting in broken connection. Before b930e598a199, the problem could only be seen in case of HEADERS frame with CONTINUATION.
2015-11-13HTTP/2: fixed invalid headers handling (ticket #831).Valentin Bartenev1-0/+2
The r->invalid_header flag wasn't reset once an invalid header appeared in a request, resulting in all subsequent headers in the request were also marked as invalid.
2015-11-11Upstream: proxy_cache_convert_head directive.Roman Arutyunyan3-1/+13
The directive toggles conversion of HEAD to GET for cacheable proxy requests. When disabled, $request_method must be added to cache key for consistency. By default, HEAD is converted to GET as before.
2015-11-05SSL: only select HTTP/2 using NPN if "http2" is enabled.Valentin Bartenev1-10/+16
OpenSSL doesn't check if the negotiated protocol has been announced. As a result, the client might force using HTTP/2 even if it wasn't enabled in configuration.
2015-11-05HTTP/2: backed out 16905ecbb49e (ticket #822).Valentin Bartenev1-3/+5
It caused inconsistency between setting "in_closed" flag and the moment when the last DATA frame was actually read. As a result, the body buffer might not be initialized properly in ngx_http_v2_init_request_body(), which led to a segmentation fault in ngx_http_v2_state_read_data(). Also it might cause start processing of incomplete body. This issue could be triggered when the processing of a request was delayed, e.g. in the limit_req or auth_request modules.
2015-10-27HTTP/2: changed behavior of the "http2_max_field_size" directive.Valentin Bartenev2-21/+13
Now it limits only the maximum length of literal string (either raw or compressed) in HPACK request header fields. It's easier to understand and to describe in the documentation.
2015-10-27HTTP/2: fixed spelling.Valentin Bartenev1-2/+2
2015-10-26HTTP/2: simplified checking the END_STREAM flag.Valentin Bartenev1-5/+3
No functional changes.
2015-10-26HTTP/2: improved the ngx_http_v2_integer_octets(v) macro.Valentin Bartenev1-1/+6
Previously, it didn't work well for 0, 127, and 128, returning less than needed.
2015-10-26HTTP/2: fixed the NGX_HTTP_V2_MAX_FIELD macro.Valentin Bartenev1-1/+2
2015-09-28HTTP/2: fixed splitting of response headers on CONTINUATION frames.Valentin Bartenev1-173/+158
Previous code has been based on assumption that the header block can only be splitted at the borders of individual headers. That wasn't the case and might result in emitting frames bigger than the frame size limit. The current approach is to split header blocks by the frame size limit.
2015-10-26HTTP/2: introduced NGX_HTTP_V2_ENCODE_* macros.Valentin Bartenev1-11/+14
No functional changes.
2015-10-26HTTP/2: simplified producing of the Last-Modified header.Valentin Bartenev1-3/+2
2015-10-26HTTP/2: fixed header block size calculation.Valentin Bartenev1-1/+1
2015-10-01HTTP/2: fix handling of connection errors.Piotr Sikora1-6/+6
Previously, nginx worker would crash because of a double free if client disconnected or timed out before sending all headers. Found with afl-fuzz. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
2015-10-01HTTP/2: fix indirect reprioritization.Piotr Sikora1-4/+13
Previously, streams that were indirectly reprioritized (either because of a new exclusive dependency on their parent or because of removal of their parent from the dependency tree), didn't have their pointer to the parent node updated. This broke detection of circular dependencies and, as a result, nginx worker would crash due to stack overflow whenever such dependency was introduced. Found with afl-fuzz. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
2015-10-01HTTP/2: reject self-dependent streams.Piotr Sikora1-0/+16
Per RFC7540, a stream cannot depend on itself. Previously, this requirement was enforced on PRIORITY frames, but not on HEADERS frames and due to the implementation details nginx worker would crash (stack overflow) while opening self-dependent stream. Found with afl-fuzz. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
2015-10-20HTTP/2: improved error handling while parsing integers.Valentin Bartenev1-4/+4
The case when an integer is out of frame bounds should be checked first as a more accurate error.
2015-10-20HTTP/2: improved HPACK integer parsing code readability.Ruslan Ermilov1-3/+3
No functional changes.
2015-10-19Fixed variables prefix comparison.Maxim Dounin1-12/+26
Variable names are not null-terminated, so using ngx_strncmp() without extra length checks is wrong. Reported by Markus Linnala, http://mailman.nginx.org/pipermail/nginx-devel/2015-August/007211.html.
2015-10-19Fixed handling of empty root.Maxim Dounin1-1/+3
Previously, a configuration with "root" set to an empty string tried test a character at clcf->root.data[-1]. Additional test added to make sure this won't happen. Reported by Markus Linnala, see http://mailman.nginx.org/pipermail/nginx-devel/2015-August/007210.html.
2015-10-19HTTP/2: fixed parsing of literal header fields without indexing.Valentin Bartenev1-1/+1
2015-09-28HTTP/2: fixed $server_protocol value (ticket #800).Valentin Bartenev1-0/+2
2015-09-22Style.Maxim Dounin1-1/+2
2015-09-15Increased the default number of output buffers.Valentin Bartenev1-1/+1
Since an output buffer can only be used for either reading or sending, small amounts of data left from the previous operation (due to some limits) must be sent before nginx will be able to read further into the buffer. Using only one output buffer can result in suboptimal behavior that manifests itself in forming and sending too small chunks of data. This is particularly painful with SPDY (or HTTP/2) where each such chunk needs to be prefixed with some header. The default flow-control window in HTTP/2 is 64k minus one bytes. With one 32k output buffer this results is one byte left after exhausting the window. With two 32k buffers the data will be read into the second free buffer before sending, thus the minimum output is increased to 32k + 1 bytes which is much better.
2015-09-22HTTP/2: fixed header block parsing with CONTINUATION frames (#792).Valentin Bartenev2-70/+136
It appears that the CONTINUATION frames don't need to be aligned to bounds of individual headers.
2015-09-22HTTP/2: fixed HPACK header field parsing.Valentin Bartenev1-0/+5
2015-09-21Sub filter: fixed initialization in http{} level (ticket #791).Roman Arutyunyan1-1/+2
If sub_filter directive was only specified at http{} level, sub filter internal data remained uninitialized. That would lead to a crash in runtime.
2015-09-11The HTTP/2 implementation (RFC 7240, 7241).Valentin Bartenev21-5680/+9225
The SPDY support is removed, as it's incompatible with the new module.
2015-09-11Fixed segfault with incorrect location nesting.Maxim Dounin2-2/+2
A configuration with a named location inside a zero-length prefix or regex location used to trigger a segmentation fault, as ngx_http_core_location() failed to properly detect if a nested location was created. Example configuration to reproduce the problem: location "" { location @foo {} } Fix is to not rely on a parent location name length, but rather check command type we are currently parsing. Identical fix is also applied to ngx_http_rewrite_if(), which used to incorrectly assume the "if" directive is on server{} level in such locations. Reported by Markus Linnala. Found with afl-fuzz.
2015-09-11Cache: check the whole cache key in addition to hashes.Maxim Dounin1-2/+19
This prevents a potential attack that discloses cached data if an attacker will be able to craft a hash collision between some cache key the attacker is allowed to access and another cache key with protected data. See http://mailman.nginx.org/pipermail/nginx-devel/2015-September/007288.html. Thanks to Gena Makhomed and Sergey Brester.
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-31Decreased the NGX_HTTP_MAX_SUBREQUESTS limit.Valentin Bartenev1-1/+1
There is no much sense in such a big value since its semantics has been changed in 06e850859a26 to limit recursive subrequests.
2015-08-31Added protection against r->main->count overflow by subrequests.Valentin Bartenev2-1/+11
This overflow has become possible after the change in 06e850859a26, since concurrent subrequests are not limited now and each of them is counted in r->main->count.
2015-08-23Limit recursive subrequests instead of simultaneous.Valentin Bartenev2-5/+2
2015-08-18Perl: prototyping behavior explicitly specified.Maxim Dounin1-0/+3
When prototyping behavior is not explicitly specified, xsubpp emits a message to stderr asking to do so (see ticket #608).
2015-08-18Perl: fixed warning about "sep" may be used uninitialized.Maxim Dounin1-9/+6
2015-08-17Win32: MSVC 2015 compatibility.Maxim Dounin2-6/+5
Resolved warnings about declarations that hide previous local declarations. Warnings about WSASocketA() being deprecated resolved by explicit use of WSASocketW() instead of WSASocket(). When compiling without IPv6 support, WinSock deprecated warnings are disabled to allow use of gethostbyname().
2015-08-17Sub filter: support of variables in the strings to replace.Dmitry Volyntsev1-28/+146
2015-08-17Sub filter: support of multiple strings to replace.Dmitry Volyntsev1-166/+247
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-08-11Core: idle connections now closed only once on exiting.Valentin Bartenev1-0/+4
Iterating through all connections takes a lot of CPU time, especially with large number of worker connections configured. As a result nginx processes used to consume CPU time during graceful shutdown. To mitigate this we now only do a full scan for idle connections when shutdown signal is received. Transitions of connections to idle ones are now expected to be avoided if the ngx_exiting flag is set. The upstream keepalive module was modified to follow this.
2015-07-16Fixed strict aliasing warnings with old GCC versions.Ruslan Ermilov1-1/+1
2015-06-16Upstream: fixed shared upstreams on win32.Ruslan Ermilov2-12/+32
2015-06-16Disabled duplicate http, mail, and stream blocks.Vladimir Homutov1-0/+4
Such configurations have very limited use, introduce various problems and are not officially supported.
2015-06-16Core: renamed ngx_proxy_protocol_parse to ngx_proxy_protocol_read.Roman Arutyunyan2-3/+3
The new name is consistent with the ngx_proxy_protocol_write function.
2015-06-11Moved ngx_http_parse_time() to core, renamed accordingly.Maxim Dounin8-290/+10
The function is now called ngx_parse_http_time(), and can be used by any code to parse HTTP-style date and time. In particular, it will be used for OCSP stapling. For compatibility, a macro to map ngx_http_parse_time() to the new name provided for a while.