summaryrefslogtreecommitdiffhomepage
path: root/src/http (follow)
AgeCommit message (Collapse)AuthorFilesLines
2014-08-01Status: indentation and style, no functional changes.Sergey Kandaurov1-7/+9
2014-07-30Dav: ngx_http_map_uri_to_path() errors were not checked.FengGu1-4/+16
Once error occured, it could lead to use uninitialized variables to log, even more segmentation fault.
2014-07-28Upstream: SSL handshake timeouts.Maxim Dounin1-0/+5
Timeout may not be set on an upstream connection when we call ngx_ssl_handshake() in ngx_http_upstream_ssl_init_connection(), so make sure to arm it if it's not set. Based on a patch by Yichun Zhang.
2014-07-25GeoIP: not all variable fields were initialized.Yichun Zhang1-0/+6
The ngx_http_geoip_city_float_variable and ngx_http_geoip_city_int_variable functions did not always initialize all variable fields like "not_found", which could lead to empty values for those corresponding nginx variables randomly.
2014-07-18Upstream: ngx_http_upstream_store() error handling fixes.Maxim Dounin1-2/+5
Previously, ngx_http_map_uri_to_path() errors were not checked in ngx_http_upstream_store(). Moreover, in case of errors temporary files were not deleted, as u->store was set to 0, preventing cleanup code in ngx_http_upstream_finalize_request() from removing them. With this patch, u->store is set to 0 only if there were no errors. Reported by Feng Gu.
2014-07-18Reset of r->uri.len on URI parsing errors.Maxim Dounin1-0/+2
This ensures that debug logging and the $uri variable (if used in 400 Bad Request processing) will not try to access uninitialized memory. Found by Sergey Bobrov.
2014-07-09Style: use ngx_str_set().Tatsuhiko Kubo1-5/+2
2014-07-08SPDY: fix support for headers with multiple values.Piotr Sikora1-0/+2
Split SPDY header with multiple, NULL-separated values: cookie: foo\0bar into two separate HTTP headers with the same name: cookie: foo cookie: bar Even though the logic for this behavior already existed in the source code, it doesn't look that it ever worked and SPDY streams with such headers were simply rejected. Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-07-08Style: remove whitespace between function name and parentheses.Piotr Sikora3-5/+5
Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-07-08Style: add whitespace between control statement and parentheses.Piotr Sikora4-8/+8
Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-07-06SSL: stop accessing SSL_SESSION's fields directly.Piotr Sikora1-8/+6
SSL_SESSION struct is internal part of the OpenSSL library and it's fields should be accessed via API (when exposed), not directly. The unfortunate side-effect of this change is that we're losing reference count that used to be printed at the debug log level, but this seems to be an acceptable trade-off. Almost fixes build with -DOPENSSL_NO_SSL_INTERN. Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-07-04Upstream: p->downstream_error instead of closing connection.Maxim Dounin1-11/+7
Previously, nginx closed client connection in cases when a response body from upstream was needed to be cached or stored but shouldn't be sent to the client. While this is normal for HTTP, it is unacceptable for SPDY. Fix is to use instead the p->downstream_error flag to prevent nginx from sending anything downstream. To make this work, the event pipe code was modified to properly cache empty responses with the flag set.
2014-07-01Upstream: fixed handling of write event after sending request.Valentin Bartenev1-7/+7
The ngx_http_upstream_dummy_handler() must be set regardless of the read event state. This prevents possible additional call of ngx_http_upstream_send_request_handler().
2014-06-16SSL: the "ssl_password_file" directive.Valentin Bartenev2-1/+38
2014-06-26Fixed wrong sizeof() in ngx_http_init_locations().Maxim Dounin1-2/+2
There is no real difference on all known platforms, but it's still wrong. Found by Coverity (CID 400876).
2014-06-26Upstream: cache revalidation using If-None-Match.Maxim Dounin5-4/+33
2014-06-26Cache: ETag now saved into cache header.Maxim Dounin3-1/+22
2014-06-26Cache: version in cache files.Maxim Dounin2-1/+13
This allows to change the structure of cache files without spamming logs with false alerts.
2014-06-26Entity tags: explicit flag to skip not modified filter.Maxim Dounin3-1/+12
Previously, last_modified_time was tested against -1 to check if the not modified filter should be skipped. Notably, this prevented nginx from additional If-Modified-Since (et al.) checks on proxied responses. Such behaviour is suboptimal in some cases though, as checks are always skipped on responses from a cache with ETag only (without Last-Modified), resulting in If-None-Match being ignored in such cases. Additionally, it was not possible to return 412 from the If-Unmodified-Since if last modification time was not known for some reason. This change introduces explicit r->disable_not_modified flag instead, which is set by ngx_http_upstream_process_headers().
2014-06-26Entity tags: weak comparison for If-None-Match.Maxim Dounin1-10/+28
2014-06-26Entity tags: downgrade strong etags to weak ones as needed.Maxim Dounin8-7/+56
See http://mailman.nginx.org/pipermail/nginx-devel/2013-November/004523.html.
2014-06-26Upstream: fixed cache revalidation with SSI.Maxim Dounin2-7/+32
Previous code in ngx_http_upstream_send_response() used last modified time from r->headers_out.last_modified_time after the header filter chain was already called. At this point, last_modified_time may be already cleared, e.g., with SSI, resulting in incorrect last modified time stored in a cache file. Fix is to introduce u->headers_in.last_modified_time instead.
2014-06-26Upstream: removed unused offset to content_length.Maxim Dounin1-2/+1
It's not needed since introduction of ngx_http_upstream_content_length() in 103b0d9afe07.
2014-06-26Upstream: no need to clear r->headers_out.last_modified_time.Maxim Dounin1-1/+0
Clearing of the r->headers_out.last_modified_time field if a response isn't cacheable in ngx_http_upstream_send_response() was introduced in 3b6afa999c2f, the commit to enable not modified filter for cacheable responses. It doesn't make sense though, as at this point header was already sent, and not modified filter was already executed. Therefore, the line was removed to simplify code.
2014-06-26Not modified filter: debug log format fixed.Maxim Dounin1-2/+2
2014-06-20Upstream: reduced diffs to the plus version of nginx.Ruslan Ermilov1-23/+21
No functional changes.
2014-06-04Core: added ngx_slab_calloc() and ngx_slab_calloc_locked().Ruslan Ermilov1-16/+6
These functions return zeroed memory, analogous to ngx_pcalloc().
2014-06-12Upstream: simplified some code that accesses peers.Ruslan Ermilov1-54/+62
No functional changes.
2014-06-03Access log: fix default value, broken by cb308813b453.Piotr Sikora1-5/+2
log->filter ("if" parameter) was uninitialized when the default value was being used, which would lead to a crash (SIGSEGV) when access_log directive wasn't specified in the configuration. Zero-fill the whole structure instead of zeroing fields one-by-one in order to prevent similar issues in the future. Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-06-02Upstream: generic hash module.Roman Arutyunyan5-0/+636
2014-05-29SPDY: fixed operator precedence in uint16/uint32 write macros.Valentin Bartenev1-5/+8
Since the type cast has precedence higher than the bit shift operator, all values were truncated to 8 bits. These macros are used to construct header block for SYN_REPLY frame on platforms with strict alignment requirements. As a result, any response that contains a header with name or value longer than 255 bytes was corrupted on such platforms.
2014-05-28Fixed config parsing of the last try_files parameter.Sergey Kandaurov1-1/+2
Do not taste the last parameter against directory, as otherwise it would result in the trailing slash being cut from the parameter value. Notably, this prevents an internal redirect to an empty URI if the parameter is set to the literal slash: location / { try_files $uri /; }
2014-05-27Sub filter: fixed subrequests handling.Maxim Dounin1-2/+6
In particular, properly output partial match at the end of a subrequest response (much like we do at the end of a response), and reset/set the last_in_chain flag as appropriate. Reported by KAWAHARA Masashi.
2014-05-23Upstream: fix tries check in ip_hash.Roman Arutyunyan1-1/+1
Make two checks for maximum number of tries consistent. The other one checks '>' condition.
2014-05-12Added syslog support for error_log and access_log directives.Vladimir Homutov2-1/+72
2014-05-20SSL: $ssl_client_fingerprint variable.Sergey Budnevitch1-0/+3
2014-05-19Setting $args now invalidates unparsed uri.Maxim Dounin1-1/+19
Prodded by Yichun Zhang.
2014-05-19Charset filter: fixed charset setting on encoded replies.Maxim Dounin3-18/+19
If response is gzipped we can't recode response, but in case it's not needed we still can add charset to Content-Type. The r->ignore_content_encoding is dropped accordingly, charset with gzip_static now properly works without any special flags.
2014-05-16Fixed alias in regex locations with limit_except/if.Maxim Dounin1-18/+10
The ngx_http_map_uri_to_path() function used clcf->regex to detect if it's working within a location given by a regular expression and have to replace full URI with alias (instead of a part matching the location prefix). This is incorrect due to clcf->regex being false in implicit locations created by if and limit_except. Fix is to preserve relevant information in clcf->alias instead, by setting it to NGX_MAX_SIZE_T_VALUE if an alias was specified in a regex location.
2014-04-30SPDY: added protection from overrun of the receive buffer.Valentin Bartenev1-0/+8
2014-04-30SPDY: added a debug point to the state buffer overflow protection.Valentin Bartenev1-0/+1
2014-04-30SPDY: refactored ngx_http_spdy_state_headers().Valentin Bartenev1-9/+4
This change is similar to d2ac5cf4056d. Special flag of completeness looks surplus when there is also a counter of frame bytes left.
2014-04-30SPDY: improved logging.Valentin Bartenev2-62/+151
2014-05-15SPDY: set log action for PROXY protocol only while parsing it.Valentin Bartenev1-8/+9
Handling of PROXY protocol for SPDY connection is currently implemented as a SPDY state. And while nginx waiting for PROXY protocol data it continues to process SPDY connection: initializes zlib context, sends control frames.
2014-04-30SPDY: ngx_http_spdy_state_headers() error handling cleanup.Valentin Bartenev1-39/+61
- Specification-friendly handling of invalid header block or special headers. Such errors are not fatal for session and shouldn't lead to connection close; - Avoid mix of NGX_HTTP_PARSE_INVALID_REQUEST/NGX_HTTP_PARSE_INVALID_HEADER.
2014-04-30SPDY: improved error handling of header block decompression.Valentin Bartenev1-17/+43
Now cases when decompression failed due to internal error and when a client sent corrupted data are distinguished.
2014-04-30SPDY: removed ngx_http_spdy_state_headers_error().Valentin Bartenev1-20/+6
The function just calls ngx_http_spdy_state_headers_skip() most of the time. There was also an attempt of optimization to stop parsing if the client already closed connection, but it looks strange and unfinished anyway.
2014-05-15SPDY: prevented creation of RST_STREAM in protocol error state.Valentin Bartenev1-0/+1
Previously, the frame wasn't sent anyway (and had a wrong status code).
2014-04-30SPDY: improved ngx_http_spdy_state_protocol_error().Valentin Bartenev1-9/+15
Now ngx_http_spdy_state_protocol_error() is able to close stream, so there is no need in a separate call for this. Also fixed zero status code in logs for some cases.
2014-04-30SPDY: fixed one case of improper memory allocation error handling.Valentin Bartenev1-1/+2
Now ngx_http_spdy_construct_request_line() doesn't try to finalize request in case of failed memory allocation.