summaryrefslogtreecommitdiffhomepage
path: root/src (follow)
AgeCommit message (Collapse)AuthorFilesLines
2014-06-26Core: use uppercase hexadecimal digits for percent-encoding.Piotr Sikora1-1/+1
RFC3986 says that, for consistency, URI producers and normalizers should use uppercase hexadecimal digits for all percent-encodings. This is also what modern web browsers and other tools use. Using lowercase hexadecimal digits makes it harder to interact with those tools in case when use of the percent-encoded URI is required, for example when $request_uri is part of the cache key. Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-07-24Core: fixed default log initialization.Vladimir Homutov1-4/+6
The ngx_log_insert() function may invalidate pointer passed to it, so make sure to don't use it after the ngx_log_insert() call.
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-16Resolver: fixed resend on malformed responses.Ruslan Ermilov1-2/+27
DNS request resend on malformed responses was broken in 98876ce2a7fd (1.5.8). Reported by Pramod Korathota.
2014-07-09SSL: fix build with recent OpenSSL.Piotr Sikora1-4/+4
X509_check_host() prototype changed recently: - http://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=ced3d91 - http://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=297c67f Bump version requirement, so that OpenSSL-1.0.2-beta1 uses fallback code. Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-06-18Core: bugfix for the ngx_slab_max_size case.Jianjun Zheng1-1/+1
2014-07-09Style: use ngx_str_set().Tatsuhiko Kubo1-5/+2
2014-07-09Style: use ngx_str_null().Tatsuhiko Kubo1-2/+1
2014-07-09Style: use ngx_strlen() instead of strlen().Tatsuhiko Kubo1-1/+1
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: fix typo.Piotr Sikora1-1/+1
Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-07-08Style: use ngx_memcpy() instead of memcpy().Piotr Sikora1-1/+1
Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-07-08Style: keep return type and function name on different lines.Piotr Sikora1-3/+6
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 Sikora5-9/+9
Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-07-06SSL: stop accessing SSL_SESSION's fields directly.Piotr Sikora2-22/+48
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-09SSL: fixed build with OPENSSL_NO_DEPRECATED defined.Maxim Dounin1-0/+4
The RSA_generate_key() is marked as deprecated and causes build to fail. On the other hand, replacement function, RSA_generate_key_ex(), requires much more code. Since RSA_generate_key() is only needed for barely usable EXP ciphers, the #ifdef was added instead. Prodded by Piotr Sikora.
2014-07-06SSL: return temporary RSA key only when the key length matches.Piotr Sikora1-4/+6
This change is mostly cosmetic, because in practice this callback is used only for 512-bit RSA keys. Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-07-06SSL: include correct OpenSSL headers.Piotr Sikora1-0/+7
Previously, <bn.h>, <dh.h>, <rand.h> and <rsa.h> were pulled in by <engine.h> using OpenSSL's deprecated interface, which meant that nginx couldn't have been built with -DOPENSSL_NO_DEPRECATED. Both <x509.h> and <x509v3.h> are pulled in by <ocsp.h>, but we're calling X509 functions directly, so let's include those as well. <crypto.h> is pulled in by virtually everything, but we're calling CRYPTO_add() directly, so let's include it as well. Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-07-09Version bump.Maxim Dounin1-2/+2
2014-07-05Win32: ngx_open_dir() and ngx_close_dir() fixes.Maxim Dounin2-1/+14
The ngx_open_dir() function changed to restore name passed to it. This fixes removing destination directory in dav module, as caught by dav.t. The ngx_close_dir() function introduced to properly convert errors, as FindClose() returns 0 on error.
2014-07-04SSL: logging level of "peer closed connection in SSL handshake".Maxim Dounin1-2/+2
Previously, the NGX_LOG_INFO level was used unconditionally. This is correct for client SSL connections, but too low for connections to upstream servers. To resolve this, ngx_connection_error() now used to log this error, it will select logging level appropriately. With this change, if an upstream connection is closed during SSL handshake, it is now properly logged at "error" level.
2014-07-04Upstream: p->downstream_error instead of closing connection.Maxim Dounin2-21/+12
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 Bartenev6-11/+293
2014-06-26Core: removed meaningless check from ngx_palloc_block().Maxim Dounin1-7/+3
The check became meaningless after refactoring in 2a92804f4109. With the loop currently in place, "current" can't be NULL, hence the check can be dropped. Additionally, the local variable "current" was removed to simplify code, and pool->current now used directly instead. Found by Coverity (CID 714236).
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-26Core: plugged socket leak during configuration test.Maxim Dounin1-6/+6
This isn't really important as configuration testing shortly ends with a process termination which will free all sockets, though Coverity complains. Prodded by Coverity (CID 400872).
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-19FreeBSD has migrated to Bugzilla.Sergey Kandaurov2-2/+2
2014-06-04Core: added ngx_slab_calloc() and ngx_slab_calloc_locked().Ruslan Ermilov3-16/+37
These functions return zeroed memory, analogous to ngx_pcalloc().
2014-06-18Version bump.Ruslan Ermilov1-2/+2
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-03Core: slab allocator free pages defragmentation.Maxim Dounin2-1/+60
Large allocations from a slab pool result in free page blocks being fragmented, eventually leading to a situation when no further allocation larger than a page size are possible from the pool. While this isn't a problem for nginx itself, it is known to be bad for various 3rd party modules. Fix is to merge adjacent blocks of free pages in the ngx_slab_free_pages() function. Prodded by Wandenberg Peixoto and Yichun Zhang.
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-28Configure: added -Wno-deprecated-declarations on OS X.Maxim Dounin1-3/+0
Previous workaround to avoid warnings on OS X due to deprecated system OpenSSL library (introduced in a3870ea96ccd) no longer works, as the MAC_OS_X_VERSION_MIN_REQUIRED macro is ignored on OS X 10.9 if a compiler used supports __attribute__(availability).