]> git.kaiwu.me - nginx.git/log
nginx.git
11 years agoCore: fixed default log initialization.
Vladimir Homutov [Thu, 24 Jul 2014 12:25:07 +0000 (16:25 +0400)]
Core: fixed default log initialization.

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.

11 years agoUpstream: ngx_http_upstream_store() error handling fixes.
Maxim Dounin [Fri, 18 Jul 2014 16:11:40 +0000 (20:11 +0400)]
Upstream: ngx_http_upstream_store() error handling fixes.

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.

11 years agoReset of r->uri.len on URI parsing errors.
Maxim Dounin [Fri, 18 Jul 2014 16:02:11 +0000 (20:02 +0400)]
Reset of r->uri.len on URI parsing errors.

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.

11 years agoResolver: fixed resend on malformed responses.
Ruslan Ermilov [Wed, 16 Jul 2014 06:21:28 +0000 (10:21 +0400)]
Resolver: fixed resend on malformed responses.

DNS request resend on malformed responses was broken in 98876ce2a7fd (1.5.8).

Reported by Pramod Korathota.

11 years agoSSL: fix build with recent OpenSSL.
Piotr Sikora [Wed, 9 Jul 2014 19:27:15 +0000 (12:27 -0700)]
SSL: fix build with recent OpenSSL.

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>
11 years agoCore: bugfix for the ngx_slab_max_size case.
Jianjun Zheng [Wed, 18 Jun 2014 08:39:59 +0000 (16:39 +0800)]
Core: bugfix for the ngx_slab_max_size case.

11 years agoStyle: use ngx_str_set().
Tatsuhiko Kubo [Wed, 9 Jul 2014 14:23:59 +0000 (23:23 +0900)]
Style: use ngx_str_set().

11 years agoStyle: use ngx_str_null().
Tatsuhiko Kubo [Wed, 9 Jul 2014 14:22:14 +0000 (23:22 +0900)]
Style: use ngx_str_null().

11 years agoStyle: use ngx_strlen() instead of strlen().
Tatsuhiko Kubo [Wed, 9 Jul 2014 14:20:40 +0000 (23:20 +0900)]
Style: use ngx_strlen() instead of strlen().

11 years agoSPDY: fix support for headers with multiple values.
Piotr Sikora [Tue, 8 Jul 2014 09:17:44 +0000 (02:17 -0700)]
SPDY: fix support for headers with multiple values.

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>
11 years agoStyle: fix typo.
Piotr Sikora [Tue, 8 Jul 2014 10:03:14 +0000 (03:03 -0700)]
Style: fix typo.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoStyle: use ngx_memcpy() instead of memcpy().
Piotr Sikora [Tue, 8 Jul 2014 10:03:14 +0000 (03:03 -0700)]
Style: use ngx_memcpy() instead of memcpy().

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoStyle: keep return type and function name on different lines.
Piotr Sikora [Tue, 8 Jul 2014 10:03:14 +0000 (03:03 -0700)]
Style: keep return type and function name on different lines.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoStyle: remove whitespace between function name and parentheses.
Piotr Sikora [Tue, 8 Jul 2014 10:03:14 +0000 (03:03 -0700)]
Style: remove whitespace between function name and parentheses.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoStyle: add whitespace between control statement and parentheses.
Piotr Sikora [Tue, 8 Jul 2014 10:03:13 +0000 (03:03 -0700)]
Style: add whitespace between control statement and parentheses.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoSSL: stop accessing SSL_SESSION's fields directly.
Piotr Sikora [Sun, 6 Jul 2014 23:41:14 +0000 (16:41 -0700)]
SSL: stop accessing SSL_SESSION's fields directly.

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>
11 years agoSSL: fixed build with OPENSSL_NO_DEPRECATED defined.
Maxim Dounin [Wed, 9 Jul 2014 00:08:13 +0000 (04:08 +0400)]
SSL: fixed build with OPENSSL_NO_DEPRECATED defined.

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.

11 years agoSSL: return temporary RSA key only when the key length matches.
Piotr Sikora [Sun, 6 Jul 2014 23:41:13 +0000 (16:41 -0700)]
SSL: return temporary RSA key only when the key length matches.

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>
11 years agoSSL: include correct OpenSSL headers.
Piotr Sikora [Sun, 6 Jul 2014 23:41:13 +0000 (16:41 -0700)]
SSL: include correct OpenSSL headers.

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>
11 years agoVersion bump.
Maxim Dounin [Tue, 8 Jul 2014 23:15:00 +0000 (03:15 +0400)]
Version bump.

11 years agorelease-1.7.3 tag
Maxim Dounin [Tue, 8 Jul 2014 13:22:38 +0000 (17:22 +0400)]
release-1.7.3 tag

11 years agonginx-1.7.3-RELEASE release-1.7.3
Maxim Dounin [Tue, 8 Jul 2014 13:22:38 +0000 (17:22 +0400)]
nginx-1.7.3-RELEASE

11 years agoWin32: ngx_open_dir() and ngx_close_dir() fixes.
Maxim Dounin [Sat, 5 Jul 2014 19:29:47 +0000 (23:29 +0400)]
Win32: ngx_open_dir() and ngx_close_dir() fixes.

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.

11 years agoUpdated PCRE used for win32 builds.
Maxim Dounin [Fri, 4 Jul 2014 18:34:03 +0000 (22:34 +0400)]
Updated PCRE used for win32 builds.

11 years agoSSL: logging level of "peer closed connection in SSL handshake".
Maxim Dounin [Fri, 4 Jul 2014 18:14:36 +0000 (22:14 +0400)]
SSL: logging level of "peer closed connection in SSL handshake".

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.

11 years agoUpstream: p->downstream_error instead of closing connection.
Maxim Dounin [Fri, 4 Jul 2014 16:47:16 +0000 (20:47 +0400)]
Upstream: p->downstream_error instead of closing connection.

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.

11 years agoUpstream: fixed handling of write event after sending request.
Valentin Bartenev [Tue, 1 Jul 2014 16:52:08 +0000 (20:52 +0400)]
Upstream: fixed handling of write event after sending request.

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().

11 years agoSSL: the "ssl_password_file" directive.
Valentin Bartenev [Mon, 16 Jun 2014 15:43:25 +0000 (19:43 +0400)]
SSL: the "ssl_password_file" directive.

11 years agoConfigure: restored "nginx/" missed in 6e4bb1d6679d.
Maxim Dounin [Thu, 26 Jun 2014 01:08:59 +0000 (05:08 +0400)]
Configure: restored "nginx/" missed in 6e4bb1d6679d.

11 years agoCore: removed meaningless check from ngx_palloc_block().
Maxim Dounin [Wed, 25 Jun 2014 23:34:19 +0000 (03:34 +0400)]
Core: removed meaningless check from ngx_palloc_block().

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).

11 years agoFixed wrong sizeof() in ngx_http_init_locations().
Maxim Dounin [Wed, 25 Jun 2014 23:34:13 +0000 (03:34 +0400)]
Fixed wrong sizeof() in ngx_http_init_locations().

There is no real difference on all known platforms, but it's still wrong.

Found by Coverity (CID 400876).

11 years agoCore: plugged socket leak during configuration test.
Maxim Dounin [Wed, 25 Jun 2014 23:34:05 +0000 (03:34 +0400)]
Core: plugged socket leak during configuration test.

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).

11 years agoConfigure: style.
Maxim Dounin [Wed, 25 Jun 2014 23:34:02 +0000 (03:34 +0400)]
Configure: style.

11 years agoUpstream: cache revalidation using If-None-Match.
Maxim Dounin [Wed, 25 Jun 2014 22:35:01 +0000 (02:35 +0400)]
Upstream: cache revalidation using If-None-Match.

11 years agoCache: ETag now saved into cache header.
Maxim Dounin [Wed, 25 Jun 2014 22:28:23 +0000 (02:28 +0400)]
Cache: ETag now saved into cache header.

11 years agoCache: version in cache files.
Maxim Dounin [Wed, 25 Jun 2014 22:27:21 +0000 (02:27 +0400)]
Cache: version in cache files.

This allows to change the structure of cache files without spamming logs
with false alerts.

11 years agoEntity tags: explicit flag to skip not modified filter.
Maxim Dounin [Wed, 25 Jun 2014 22:27:11 +0000 (02:27 +0400)]
Entity tags: explicit flag to skip not modified filter.

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().

11 years agoEntity tags: weak comparison for If-None-Match.
Maxim Dounin [Wed, 25 Jun 2014 22:21:20 +0000 (02:21 +0400)]
Entity tags: weak comparison for If-None-Match.

11 years agoEntity tags: downgrade strong etags to weak ones as needed.
Maxim Dounin [Wed, 25 Jun 2014 22:21:01 +0000 (02:21 +0400)]
Entity tags: downgrade strong etags to weak ones as needed.

See http://mailman.nginx.org/pipermail/nginx-devel/2013-November/004523.html.

11 years agoUpstream: fixed cache revalidation with SSI.
Maxim Dounin [Wed, 25 Jun 2014 22:20:09 +0000 (02:20 +0400)]
Upstream: fixed cache revalidation with SSI.

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.

11 years agoUpstream: removed unused offset to content_length.
Maxim Dounin [Wed, 25 Jun 2014 22:20:05 +0000 (02:20 +0400)]
Upstream: removed unused offset to content_length.

It's not needed since introduction of ngx_http_upstream_content_length()
in 103b0d9afe07.

11 years agoUpstream: no need to clear r->headers_out.last_modified_time.
Maxim Dounin [Wed, 25 Jun 2014 22:19:58 +0000 (02:19 +0400)]
Upstream: no need to clear r->headers_out.last_modified_time.

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.

11 years agoNot modified filter: debug log format fixed.
Maxim Dounin [Wed, 25 Jun 2014 22:19:55 +0000 (02:19 +0400)]
Not modified filter: debug log format fixed.

11 years agoUpstream: reduced diffs to the plus version of nginx.
Ruslan Ermilov [Fri, 20 Jun 2014 08:55:41 +0000 (12:55 +0400)]
Upstream: reduced diffs to the plus version of nginx.

No functional changes.

11 years agoFreeBSD has migrated to Bugzilla.
Sergey Kandaurov [Thu, 19 Jun 2014 09:55:59 +0000 (13:55 +0400)]
FreeBSD has migrated to Bugzilla.

11 years agoCore: added ngx_slab_calloc() and ngx_slab_calloc_locked().
Ruslan Ermilov [Wed, 4 Jun 2014 11:09:19 +0000 (15:09 +0400)]
Core: added ngx_slab_calloc() and ngx_slab_calloc_locked().

These functions return zeroed memory, analogous to ngx_pcalloc().

11 years agoVersion bump.
Ruslan Ermilov [Wed, 18 Jun 2014 09:39:20 +0000 (13:39 +0400)]
Version bump.

11 years agorelease-1.7.2 tag
Maxim Dounin [Tue, 17 Jun 2014 12:51:25 +0000 (16:51 +0400)]
release-1.7.2 tag

11 years agonginx-1.7.2-RELEASE release-1.7.2
Maxim Dounin [Tue, 17 Jun 2014 12:51:25 +0000 (16:51 +0400)]
nginx-1.7.2-RELEASE

11 years agoConfigure: workaround for system perl on OS X (ticket #576).
Maxim Dounin [Tue, 17 Jun 2014 08:07:06 +0000 (12:07 +0400)]
Configure: workaround for system perl on OS X (ticket #576).

11 years agoUpdated OpenSSL used for win32 builds.
Maxim Dounin [Tue, 17 Jun 2014 07:38:55 +0000 (11:38 +0400)]
Updated OpenSSL used for win32 builds.

11 years agoUpstream: simplified some code that accesses peers.
Ruslan Ermilov [Thu, 12 Jun 2014 17:13:24 +0000 (21:13 +0400)]
Upstream: simplified some code that accesses peers.

No functional changes.

11 years agoAccess log: fix default value, broken by cb308813b453.
Piotr Sikora [Tue, 3 Jun 2014 17:53:48 +0000 (10:53 -0700)]
Access log: fix default value, broken by cb308813b453.

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>
11 years agoCore: slab allocator free pages defragmentation.
Maxim Dounin [Tue, 3 Jun 2014 13:53:03 +0000 (17:53 +0400)]
Core: slab allocator free pages defragmentation.

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.

11 years agoUpstream: generic hash module.
Roman Arutyunyan [Mon, 2 Jun 2014 12:16:22 +0000 (16:16 +0400)]
Upstream: generic hash module.

11 years agoSPDY: fixed operator precedence in uint16/uint32 write macros.
Valentin Bartenev [Thu, 29 May 2014 17:15:19 +0000 (21:15 +0400)]
SPDY: fixed operator precedence in uint16/uint32 write macros.

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.

11 years agoFixed config parsing of the last try_files parameter.
Sergey Kandaurov [Wed, 28 May 2014 16:18:05 +0000 (20:18 +0400)]
Fixed config parsing of the last try_files parameter.

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 /; }

11 years agoConfigure: added -Wno-deprecated-declarations on OS X.
Maxim Dounin [Wed, 28 May 2014 13:41:44 +0000 (17:41 +0400)]
Configure: added -Wno-deprecated-declarations on OS X.

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).

11 years agoVersion bump.
Maxim Dounin [Wed, 28 May 2014 13:41:33 +0000 (17:41 +0400)]
Version bump.

11 years agorelease-1.7.1 tag
Maxim Dounin [Tue, 27 May 2014 13:58:09 +0000 (17:58 +0400)]
release-1.7.1 tag

11 years agonginx-1.7.1-RELEASE release-1.7.1
Maxim Dounin [Tue, 27 May 2014 13:58:08 +0000 (17:58 +0400)]
nginx-1.7.1-RELEASE

11 years agoSub filter: fixed subrequests handling.
Maxim Dounin [Tue, 27 May 2014 12:37:35 +0000 (16:37 +0400)]
Sub filter: fixed subrequests handling.

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.

11 years agoSyslog: fixed message sending on win32.
Vladimir Homutov [Tue, 27 May 2014 11:42:34 +0000 (15:42 +0400)]
Syslog: fixed message sending on win32.

11 years agoSyslog: fixed possible resource leak and more verbose logging.
Vladimir Homutov [Mon, 26 May 2014 19:34:44 +0000 (23:34 +0400)]
Syslog: fixed possible resource leak and more verbose logging.

Found by Coverity (CID 1215646).

11 years agoEvents: use eventfd() instead of syscall(SYS_eventfd) if possible.
Ruslan Ermilov [Fri, 23 May 2014 12:37:05 +0000 (16:37 +0400)]
Events: use eventfd() instead of syscall(SYS_eventfd) if possible.

This fixes --with-file-aio support on systems that lack eventfd()
syscall, notably aarch64 Linux.

The syscall(SYS_eventfd) may still be necessary on systems that
have eventfd() syscall in the kernel but lack it in glibc, e.g.
as seen in the current CentOS 5 release.

11 years agoUpstream: fix tries check in ip_hash.
Roman Arutyunyan [Fri, 23 May 2014 09:47:05 +0000 (13:47 +0400)]
Upstream: fix tries check in ip_hash.

Make two checks for maximum number of tries consistent.
The other one checks '>' condition.

11 years agoMail: output client port number on client connects (ticket #531).
Ruslan Ermilov [Wed, 21 May 2014 20:16:17 +0000 (00:16 +0400)]
Mail: output client port number on client connects (ticket #531).

11 years agoCore: output client port number when logging accept event.
Ruslan Ermilov [Wed, 21 May 2014 20:16:09 +0000 (00:16 +0400)]
Core: output client port number when logging accept event.

11 years agoMail: added a check for the number of arguments in MAIL/RCPT.
Maxim Dounin [Wed, 21 May 2014 17:56:20 +0000 (21:56 +0400)]
Mail: added a check for the number of arguments in MAIL/RCPT.

Missed during introduction of the SMTP pipelining support (04e43d03e153,
1.5.6).  Previously, the check wasn't needed as s->buffer was used directly
and the number of arguments didn't matter.

Reported by Svyatoslav Nikolsky.

12 years agoAdded syslog support for error_log and access_log directives.
Vladimir Homutov [Mon, 12 May 2014 12:34:15 +0000 (16:34 +0400)]
Added syslog support for error_log and access_log directives.

11 years agoConfigure: the --build= option.
Ruslan Ermilov [Tue, 20 May 2014 12:10:07 +0000 (16:10 +0400)]
Configure: the --build= option.

If set, its value is output in "nginx -v" and in the error log.

11 years agoSSL: $ssl_client_fingerprint variable.
Sergey Budnevitch [Tue, 20 May 2014 10:03:03 +0000 (14:03 +0400)]
SSL: $ssl_client_fingerprint variable.

11 years agoSetting $args now invalidates unparsed uri.
Maxim Dounin [Mon, 19 May 2014 18:45:35 +0000 (22:45 +0400)]
Setting $args now invalidates unparsed uri.

Prodded by Yichun Zhang.

11 years agoCharset filter: fixed charset setting on encoded replies.
Maxim Dounin [Mon, 19 May 2014 18:45:34 +0000 (22:45 +0400)]
Charset filter: fixed charset setting on encoded replies.

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.

11 years agoFixed alias in regex locations with limit_except/if.
Maxim Dounin [Fri, 16 May 2014 13:42:24 +0000 (17:42 +0400)]
Fixed alias in regex locations with limit_except/if.

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.

12 years agoSPDY: added protection from overrun of the receive buffer.
Valentin Bartenev [Wed, 30 Apr 2014 16:34:20 +0000 (20:34 +0400)]
SPDY: added protection from overrun of the receive buffer.

12 years agoSPDY: added a debug point to the state buffer overflow protection.
Valentin Bartenev [Wed, 30 Apr 2014 16:34:20 +0000 (20:34 +0400)]
SPDY: added a debug point to the state buffer overflow protection.

12 years agoSPDY: refactored ngx_http_spdy_state_headers().
Valentin Bartenev [Wed, 30 Apr 2014 16:34:20 +0000 (20:34 +0400)]
SPDY: refactored ngx_http_spdy_state_headers().

This change is similar to d2ac5cf4056d.  Special flag of completeness looks
surplus when there is also a counter of frame bytes left.

12 years agoSPDY: improved logging.
Valentin Bartenev [Wed, 30 Apr 2014 16:34:20 +0000 (20:34 +0400)]
SPDY: improved logging.

12 years agoSPDY: set log action for PROXY protocol only while parsing it.
Valentin Bartenev [Thu, 15 May 2014 15:22:06 +0000 (19:22 +0400)]
SPDY: set log action for PROXY protocol only while parsing it.

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.

12 years agoSPDY: ngx_http_spdy_state_headers() error handling cleanup.
Valentin Bartenev [Wed, 30 Apr 2014 16:34:20 +0000 (20:34 +0400)]
SPDY: ngx_http_spdy_state_headers() error handling cleanup.

 - 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.

12 years agoSPDY: improved error handling of header block decompression.
Valentin Bartenev [Wed, 30 Apr 2014 16:34:20 +0000 (20:34 +0400)]
SPDY: improved error handling of header block decompression.

Now cases when decompression failed due to internal error
and when a client sent corrupted data are distinguished.

12 years agoSPDY: removed ngx_http_spdy_state_headers_error().
Valentin Bartenev [Wed, 30 Apr 2014 16:34:20 +0000 (20:34 +0400)]
SPDY: removed ngx_http_spdy_state_headers_error().

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.

12 years agoSPDY: prevented creation of RST_STREAM in protocol error state.
Valentin Bartenev [Thu, 15 May 2014 15:18:26 +0000 (19:18 +0400)]
SPDY: prevented creation of RST_STREAM in protocol error state.

Previously, the frame wasn't sent anyway (and had a wrong status code).

12 years agoSPDY: improved ngx_http_spdy_state_protocol_error().
Valentin Bartenev [Wed, 30 Apr 2014 16:33:58 +0000 (20:33 +0400)]
SPDY: improved ngx_http_spdy_state_protocol_error().

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.

12 years agoSPDY: fixed one case of improper memory allocation error handling.
Valentin Bartenev [Tue, 29 Apr 2014 22:16:21 +0000 (02:16 +0400)]
SPDY: fixed one case of improper memory allocation error handling.

Now ngx_http_spdy_construct_request_line() doesn't try to finalize request
in case of failed memory allocation.

12 years agoStyle: use %N instead of '\n' where appropriate.
Ruslan Ermilov [Wed, 14 May 2014 18:26:30 +0000 (22:26 +0400)]
Style: use %N instead of '\n' where appropriate.

12 years agoCore: use '\r' for CR and '\n' for LF definitions.
Ruslan Ermilov [Wed, 14 May 2014 18:26:05 +0000 (22:26 +0400)]
Core: use '\r' for CR and '\n' for LF definitions.

12 years agoOCSP stapling: missing OCSP request free call.
Filipe da Silva [Tue, 29 Apr 2014 20:22:38 +0000 (22:22 +0200)]
OCSP stapling: missing OCSP request free call.

12 years agoUpstream: restored workaround for "if".
Maxim Dounin [Wed, 30 Apr 2014 15:16:55 +0000 (19:16 +0400)]
Upstream: restored workaround for "if".

The 7022564a9e0e changeset made ineffective workaround from 2464ccebdb52
to avoid NULL pointer dereference with "if".  It is now restored by
moving the u->ssl_name initialization after the check.

Found by Coverity (CID 1210408).

12 years agoCore: improved ngx_conf_parse() error handling.
Maxim Dounin [Wed, 30 Apr 2014 15:16:49 +0000 (19:16 +0400)]
Core: improved ngx_conf_parse() error handling.

Previous code failed to properly restore cf->conf_file in case of
ngx_close_file() errors, potentially resulting in double free of
cf->conf_file->buffer->start.

Found by Coverity (CID 1087507).

12 years agoCore: fixed error handling in ngx_reopen_files().
Maxim Dounin [Wed, 30 Apr 2014 15:16:40 +0000 (19:16 +0400)]
Core: fixed error handling in ngx_reopen_files().

Found by Coverity (CID 1087509).

12 years agoCache: added ngx_quit check to ngx_http_file_cache_expire().
Maxim Dounin [Wed, 30 Apr 2014 15:16:35 +0000 (19:16 +0400)]
Cache: added ngx_quit check to ngx_http_file_cache_expire().

While managing big caches it is possible that expiring old cache items
in ngx_http_file_cache_expire() will take a while.  Added a check for
ngx_quit / ngx_terminate to make sure cache manager can be terminated
while in ngx_http_file_cache_expire().

12 years agoConfigure: typo fixed.
Maxim Dounin [Wed, 30 Apr 2014 15:16:30 +0000 (19:16 +0400)]
Configure: typo fixed.

12 years agoUpstream: added the "$upstream_cookie_<name>" variables.
Vladimir Homutov [Tue, 29 Apr 2014 08:28:41 +0000 (12:28 +0400)]
Upstream: added the "$upstream_cookie_<name>" variables.

12 years agoProxy: fixed possible uninitialized memory access.
Valentin Bartenev [Sun, 17 Nov 2013 23:06:45 +0000 (03:06 +0400)]
Proxy: fixed possible uninitialized memory access.

The ngx_http_proxy_rewrite_cookie() function expects the value of the
"Set-Cookie" header to be null-terminated, and for headers obtained
from proxied server it is usually true.

Now the ngx_http_proxy_rewrite() function preserves the null character
while rewriting headers.

This fixes accessing memory outside of rewritten value if both the
"proxy_cookie_path" and "proxy_cookie_domain" directives are used in
the same location.

12 years agoVersion bump.
Valentin Bartenev [Thu, 24 Apr 2014 16:50:10 +0000 (20:50 +0400)]
Version bump.

12 years agorelease-1.7.0 tag
Maxim Dounin [Thu, 24 Apr 2014 12:54:23 +0000 (16:54 +0400)]
release-1.7.0 tag

12 years agonginx-1.7.0-RELEASE release-1.7.0
Maxim Dounin [Thu, 24 Apr 2014 12:54:22 +0000 (16:54 +0400)]
nginx-1.7.0-RELEASE

12 years agoSSL: explicit handling of empty names.
Maxim Dounin [Wed, 23 Apr 2014 16:31:31 +0000 (20:31 +0400)]
SSL: explicit handling of empty names.

X509_check_host() can't handle non null-terminated names with zero length,
so make sure to fail before calling it.