]> git.kaiwu.me - nginx.git/log
nginx.git
10 years agonginx-1.9.11-RELEASE release-1.9.11
Maxim Dounin [Tue, 9 Feb 2016 14:11:56 +0000 (17:11 +0300)]
nginx-1.9.11-RELEASE

10 years agoDynamic modules: NGX_STREAM define removed.
Maxim Dounin [Mon, 8 Feb 2016 15:02:04 +0000 (18:02 +0300)]
Dynamic modules: NGX_STREAM define removed.

It's not used and contradicts the idea of dynamic loading.

10 years agoDynamic modules: added dlsym() to configure test.
Valentin Bartenev [Fri, 5 Feb 2016 18:48:25 +0000 (21:48 +0300)]
Dynamic modules: added dlsym() to configure test.

It appears that AddressSanitizer in GCC 5 intercepts dlopen() and dlclose()
but not dlsym().

10 years agoDynamic modules: fixed a copy-n-paste error.
Ruslan Ermilov [Fri, 5 Feb 2016 11:02:54 +0000 (14:02 +0300)]
Dynamic modules: fixed a copy-n-paste error.

10 years agoDynamic modules.
Maxim Dounin [Thu, 4 Feb 2016 17:25:29 +0000 (20:25 +0300)]
Dynamic modules.

The auto/module script is extended to understand ngx_module_link=DYNAMIC.
When set, it links the module as a shared object rather than statically
into nginx binary.  The module can later be loaded using the "load_module"
directive.

New auto/module parameter ngx_module_order allows to define module loading
order in complex cases.  By default the order is set based on ngx_module_type.

3rd party modules can be compiled dynamically using the --add-dynamic-module
configure option, which will preset ngx_module_link to "DYNAMIC" before
calling the module config script.

Win32 support is rudimentary, and only works when using MinGW gcc (which
is able to handle exports/imports automatically).

In collaboration with Ruslan Ermilov.

10 years agoDynamic modules: auto/module script.
Maxim Dounin [Thu, 4 Feb 2016 15:30:21 +0000 (18:30 +0300)]
Dynamic modules: auto/module script.

This script simplifies configuration of additional modules,
including 3rd party ones.  The script is extensible, and
will be used to introduce dynamic linking of modules in upcoming
changes.

3rd party module config scripts are called with ngx_module_link
preset to "ADDON" - this allows config scripts to call auto/module
without ngx_module_link explicitly defined, as well as testing if
new interface is in place if compatibility with older nginx versions
is desired.

In collaboration with Ruslan Ermilov.

10 years agoDynamic modules: introduced HTTP_INIT_FILTER_MODULES.
Maxim Dounin [Thu, 4 Feb 2016 15:30:21 +0000 (18:30 +0300)]
Dynamic modules: introduced HTTP_INIT_FILTER_MODULES.

Additionally, HTTP_HEADERS_FILTER_MODULE now added to HTTP_FILTER_MODULES.
This avoids explict use of modules at the later stages, now only module
lists are used.  This will be needed in later patches.

10 years agoDynamic modules: dlopen() support.
Maxim Dounin [Thu, 4 Feb 2016 15:30:21 +0000 (18:30 +0300)]
Dynamic modules: dlopen() support.

10 years agoDynamic modules: changed ngx_modules to cycle->modules.
Maxim Dounin [Thu, 4 Feb 2016 15:30:21 +0000 (18:30 +0300)]
Dynamic modules: changed ngx_modules to cycle->modules.

10 years agoDynamic modules: moved module-related stuff to separate files.
Maxim Dounin [Thu, 4 Feb 2016 15:30:21 +0000 (18:30 +0300)]
Dynamic modules: moved module-related stuff to separate files.

10 years agoHTTP/2: fixed possible buffer overrun (ticket #893).
Valentin Bartenev [Thu, 4 Feb 2016 15:01:04 +0000 (18:01 +0300)]
HTTP/2: fixed possible buffer overrun (ticket #893).

Due to greater priority of the unary plus operator over the ternary operator
the expression didn't work as expected.  That might result in one byte less
allocation than needed for the HEADERS frame buffer.

10 years agoHTTP/2: fixed padding handling in HEADERS frame with CONTINUATION.
Valentin Bartenev [Tue, 2 Feb 2016 13:33:55 +0000 (16:33 +0300)]
HTTP/2: fixed padding handling in HEADERS frame with CONTINUATION.

10 years agoHTTP/2: fixed request length accounting.
Valentin Bartenev [Tue, 2 Feb 2016 13:33:55 +0000 (16:33 +0300)]
HTTP/2: fixed request length accounting.

Now it includes not only the received body size,
but the size of headers block as well.

10 years agoHTTP/2: fixed excessive memory allocation for pool cleanup.
Valentin Bartenev [Tue, 2 Feb 2016 13:33:55 +0000 (16:33 +0300)]
HTTP/2: fixed excessive memory allocation for pool cleanup.

10 years agoHTTP/2: removed unused field from ngx_http_v2_stream_t.
Valentin Bartenev [Tue, 2 Feb 2016 13:33:55 +0000 (16:33 +0300)]
HTTP/2: removed unused field from ngx_http_v2_stream_t.

10 years agoResolver: style.
Ruslan Ermilov [Thu, 17 Dec 2015 14:30:22 +0000 (17:30 +0300)]
Resolver: style.

Use the original query name in error and debug messages when
processing PTR responses.

10 years agoResolver: improved PTR response processing.
Ruslan Ermilov [Thu, 17 Dec 2015 14:21:16 +0000 (17:21 +0300)]
Resolver: improved PTR response processing.

The previous code only parsed the first answer, without checking its
type, and required a compressed RR name.

The new code checks the RR type, supports responses with multiple
answers, and doesn't require the RR name to be compressed.

This has a side effect in limited support of CNAME.  If a response
includes both CNAME and PTR RRs, like when recursion is enabled on
the server, PTR RR is handled.

Full CNAME support in PTR response is not implemented in this change.

10 years agoResolver: style.
Ruslan Ermilov [Thu, 17 Dec 2015 14:21:12 +0000 (17:21 +0300)]
Resolver: style.

Renamed argument in ngx_resolver_process_a() for consistency.

10 years agoResolver: free TCP buffers on resolver cleanup.
Roman Arutyunyan [Tue, 2 Feb 2016 10:42:55 +0000 (13:42 +0300)]
Resolver: free TCP buffers on resolver cleanup.

10 years agoResolver: fixed possible resource leak introduced in 5a16d40c63de.
Ruslan Ermilov [Tue, 2 Feb 2016 08:35:19 +0000 (11:35 +0300)]
Resolver: fixed possible resource leak introduced in 5a16d40c63de.

Found by Coverity (CID 1351175).

10 years agoResolver: TCP support.
Roman Arutyunyan [Thu, 28 Jan 2016 12:28:20 +0000 (15:28 +0300)]
Resolver: TCP support.

Resend DNS query over TCP once UDP response came truncated.

10 years agoResolver: per-request DNS server balancer.
Roman Arutyunyan [Thu, 28 Jan 2016 12:28:20 +0000 (15:28 +0300)]
Resolver: per-request DNS server balancer.

Previously, a global server balancer was used to assign the next DNS server to
send a query to.  That could lead to a non-uniform distribution of servers per
request.  A request could be assigned to the same dead server several times in a
row and wait longer for a valid server or even time out without being processed.

Now each query is sent to all servers sequentially in a circle until a
response is received or timeout expires.  Initial server for each request is
still globally balanced.

10 years agoResolver: renamed UDP-specific structures, fields and variables.
Roman Arutyunyan [Thu, 28 Jan 2016 12:28:20 +0000 (15:28 +0300)]
Resolver: renamed UDP-specific structures, fields and variables.

They will be used for TCP connections as well.

10 years agoResolver: removed unused field from ngx_resolver_ctx_t.
Roman Arutyunyan [Thu, 28 Jan 2016 12:28:19 +0000 (15:28 +0300)]
Resolver: removed unused field from ngx_resolver_ctx_t.

10 years agoVersion bump.
Roman Arutyunyan [Thu, 28 Jan 2016 12:25:58 +0000 (15:25 +0300)]
Version bump.

10 years agorelease-1.9.10 tag
Maxim Dounin [Tue, 26 Jan 2016 14:27:41 +0000 (17:27 +0300)]
release-1.9.10 tag

10 years agonginx-1.9.10-RELEASE release-1.9.10
Maxim Dounin [Tue, 26 Jan 2016 14:27:40 +0000 (17:27 +0300)]
nginx-1.9.10-RELEASE

10 years agoResolver: limited CNAME recursion.
Ruslan Ermilov [Tue, 26 Jan 2016 13:47:14 +0000 (16:47 +0300)]
Resolver: limited CNAME recursion.

Previously, the recursion was only limited for cached responses.

10 years agoResolver: fixed use-after-free memory accesses with CNAME.
Roman Arutyunyan [Tue, 26 Jan 2016 13:46:59 +0000 (16:46 +0300)]
Resolver: fixed use-after-free memory accesses with CNAME.

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.

10 years agoResolver: changed the ngx_resolver_create_*_query() arguments.
Roman Arutyunyan [Tue, 26 Jan 2016 13:46:48 +0000 (16:46 +0300)]
Resolver: changed the ngx_resolver_create_*_query() arguments.

No functional changes.

This is needed by the following change.

10 years agoResolver: fixed CNAME processing for several requests.
Ruslan Ermilov [Tue, 26 Jan 2016 13:46:38 +0000 (16:46 +0300)]
Resolver: fixed CNAME processing for several requests.

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.

10 years agoResolver: fixed crashes in timeout handler.
Ruslan Ermilov [Tue, 26 Jan 2016 13:46:31 +0000 (16:46 +0300)]
Resolver: fixed crashes in timeout handler.

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.

10 years agoResolver: fixed possible segmentation fault on DNS format error.
Roman Arutyunyan [Tue, 26 Jan 2016 13:46:18 +0000 (16:46 +0300)]
Resolver: fixed possible segmentation fault on DNS format error.

10 years agoRequest body: removed surplus assigment, no functional changes.
Valentin Bartenev [Tue, 12 Jan 2016 16:19:07 +0000 (19:19 +0300)]
Request body: removed surplus assigment, no functional changes.

Setting rb->bufs to NULL is surplus after ngx_http_write_request_body()
has returned NGX_OK.

10 years agoCore: worker_cpu_affinity auto.
Maxim Dounin [Mon, 11 Jan 2016 16:23:17 +0000 (19:23 +0300)]
Core: worker_cpu_affinity auto.

If enabled, workers are bound to available CPUs, each worker to once CPU
in order.  If there are more workers than available CPUs, remaining are
bound in a loop, starting again from the first available CPU.

The optional mask parameter defines which CPUs are available for automatic
binding.

In collaboration with Vladimir Homutov.

10 years agoUpstream: fixed changing method on X-Accel-Redirect.
Maxim Dounin [Mon, 11 Jan 2016 16:08:12 +0000 (19:08 +0300)]
Upstream: fixed changing method on X-Accel-Redirect.

Previously, only r->method was changed, resulting in handling of a request
as GET within nginx itself, but not in requests to proxied servers.

See http://mailman.nginx.org/pipermail/nginx/2015-December/049518.html.

10 years agoYear 2016.
Ruslan Ermilov [Mon, 11 Jan 2016 07:53:49 +0000 (10:53 +0300)]
Year 2016.

10 years agoUpstream: don't keep connections on early responses (ticket #669).
Maxim Dounin [Thu, 17 Dec 2015 13:39:15 +0000 (16:39 +0300)]
Upstream: don't keep connections on early responses (ticket #669).

10 years agoFixed PROXY protocol on IPv6 sockets (ticket #858).
Maxim Dounin [Thu, 17 Dec 2015 13:39:02 +0000 (16:39 +0300)]
Fixed PROXY protocol on IPv6 sockets (ticket #858).

10 years agoVersion bump.
Maxim Dounin [Thu, 17 Dec 2015 13:38:51 +0000 (16:38 +0300)]
Version bump.

10 years agoFixed a typo.
Ruslan Ermilov [Sat, 12 Dec 2015 07:32:58 +0000 (10:32 +0300)]
Fixed a typo.

10 years agorelease-1.9.9 tag
Maxim Dounin [Wed, 9 Dec 2015 14:47:21 +0000 (17:47 +0300)]
release-1.9.9 tag

10 years agonginx-1.9.9-RELEASE release-1.9.9
Maxim Dounin [Wed, 9 Dec 2015 14:47:20 +0000 (17:47 +0300)]
nginx-1.9.9-RELEASE

10 years agoFixed fastcgi_pass with UNIX socket and variables (ticket #855).
Ruslan Ermilov [Wed, 9 Dec 2015 13:26:59 +0000 (16:26 +0300)]
Fixed fastcgi_pass with UNIX socket and variables (ticket #855).

This was broken in a93345ee8f52 (1.9.8).

10 years agoVersion bump.
Ruslan Ermilov [Wed, 9 Dec 2015 11:41:16 +0000 (14:41 +0300)]
Version bump.

10 years agorelease-1.9.8 tag
Maxim Dounin [Tue, 8 Dec 2015 15:16:52 +0000 (18:16 +0300)]
release-1.9.8 tag

10 years agonginx-1.9.8-RELEASE release-1.9.8
Maxim Dounin [Tue, 8 Dec 2015 15:16:51 +0000 (18:16 +0300)]
nginx-1.9.8-RELEASE

10 years agoSlice filter: terminate first slice with last_in_chain flag.
Roman Arutyunyan [Tue, 8 Dec 2015 14:39:56 +0000 (17:39 +0300)]
Slice filter: terminate first slice with last_in_chain flag.

This flag makes sub filter flush buffered data and optimizes allocation in copy
filter.

10 years agoSlice filter: never run subrequests when main request is buffered.
Roman Arutyunyan [Tue, 8 Dec 2015 14:39:56 +0000 (17:39 +0300)]
Slice filter: never run subrequests when main request is buffered.

With main request buffered, it's possible, that a slice subrequest will send
output before it.  For example, while main request is waiting for aio read to
complete, a slice subrequest can start an aio operation as well.  The order
in which aio callbacks are called is undetermined.

10 years agoSSL: fixed possible segfault on renegotiation (ticket #845).
Sergey Kandaurov [Tue, 8 Dec 2015 13:59:43 +0000 (16:59 +0300)]
SSL: fixed possible segfault on renegotiation (ticket #845).

Skip SSL_CTX_set_tlsext_servername_callback in case of renegotiation.
Do nothing in SNI callback as in this case it will be supplied with
request in c->data which isn't expected and doesn't work this way.

This was broken by b40af2fd1c16 (1.9.6) with OpenSSL master branch and LibreSSL.

10 years agoUpdated OpenSSL and PCRE used for win32 builds.
Maxim Dounin [Mon, 7 Dec 2015 17:09:34 +0000 (20:09 +0300)]
Updated OpenSSL and PCRE used for win32 builds.

10 years agoAdded slice module to win32 builds.
Maxim Dounin [Mon, 7 Dec 2015 17:08:13 +0000 (20:08 +0300)]
Added slice module to win32 builds.

10 years agoSlice filter.
Roman Arutyunyan [Mon, 7 Dec 2015 13:30:48 +0000 (16:30 +0300)]
Slice filter.

Splits a request into subrequests, each providing a specific range of response.
The variable "$slice_range" must be used to set subrequest range and proper
cache key.  The directive "slice" sets slice size.

The following example splits requests into 1-megabyte cacheable subrequests.

server {
    listen 8000;

    location / {
        slice 1m;

        proxy_cache cache;
        proxy_cache_key $uri$is_args$args$slice_range;
        proxy_set_header Range $slice_range;
        proxy_cache_valid 200 206 1h;
        proxy_pass http://127.0.0.1:9000;
    }
}

10 years agoUpstream: fill r->headers_out.content_range from upstream response.
Roman Arutyunyan [Mon, 7 Dec 2015 13:30:47 +0000 (16:30 +0300)]
Upstream: fill r->headers_out.content_range from upstream response.

10 years agoCore: fix typo in error message.
Piotr Sikora [Thu, 3 Dec 2015 03:17:19 +0000 (19:17 -0800)]
Core: fix typo in error message.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
10 years agoStyle: NGX_PTR_SIZE replaced with sizeof(void *).
Maxim Dounin [Thu, 3 Dec 2015 17:06:45 +0000 (20:06 +0300)]
Style: NGX_PTR_SIZE replaced with sizeof(void *).

The NGX_PTR_SIZE macro is only needed in preprocessor directives where
it's not possible to use sizeof().

10 years agoStyle.
Maxim Dounin [Tue, 1 Dec 2015 22:06:54 +0000 (01:06 +0300)]
Style.

10 years agoStop emulating a space character after r->method_name.
Ruslan Ermilov [Mon, 30 Nov 2015 09:54:01 +0000 (12:54 +0300)]
Stop emulating a space character after r->method_name.

This is an API change.

The proxy module was modified to not depend on this in 44122bddd9a1.
No known third-party modules seem to depend on this.

10 years agoProxy: improved code readability.
Ruslan Ermilov [Fri, 6 Nov 2015 12:21:51 +0000 (15:21 +0300)]
Proxy: improved code readability.

Do not assume that space character follows the method name, just pass it
explicitly.

The fuss around it has already proved to be unsafe, see bbdb172f0927 and
http://mailman.nginx.org/pipermail/nginx-ru/2013-January/049692.html for
details.

10 years agoReduced the number of GET method constants.
Ruslan Ermilov [Mon, 30 Nov 2015 09:04:35 +0000 (12:04 +0300)]
Reduced the number of GET method constants.

10 years agoIncreased the default "connection_pool_size" on 64-bit platforms.
Valentin Bartenev [Mon, 30 Nov 2015 13:27:33 +0000 (16:27 +0300)]
Increased the default "connection_pool_size" on 64-bit platforms.

The previous default of 256 bytes isn't enough and results in two
allocations on each accepted connection, which is suboptimal.

10 years agoConfigure: improved workaround for system perl on OS X.
Ruslan Ermilov [Mon, 30 Nov 2015 09:04:29 +0000 (12:04 +0300)]
Configure: improved workaround for system perl on OS X.

The workaround from baf2816d556d stopped to work because the order of
"-arch x86_64" and "-arch i386" has changed.

10 years agoConfigure: removed comment obsolete in 3b763d36e055.
Ruslan Ermilov [Mon, 30 Nov 2015 16:01:53 +0000 (19:01 +0300)]
Configure: removed comment obsolete in 3b763d36e055.

10 years agoStyle: unified request method checks.
Ruslan Ermilov [Fri, 6 Nov 2015 12:22:43 +0000 (15:22 +0300)]
Style: unified request method checks.

10 years agoCore: enabled "include" inside http upstreams (ticket #635).
Ruslan Ermilov [Mon, 23 Nov 2015 09:40:19 +0000 (12:40 +0300)]
Core: enabled "include" inside http upstreams (ticket #635).

The directive already works inside stream upstream blocks.

10 years agoConfigure: fixed using OpenSSL include paths.
Maxim Dounin [Mon, 23 Nov 2015 19:48:31 +0000 (22:48 +0300)]
Configure: fixed using OpenSSL include paths.

10 years agoUpstream: fixed "no port" detection in evaluated upstreams.
Ruslan Ermilov [Sat, 21 Nov 2015 07:44:07 +0000 (10:44 +0300)]
Upstream: fixed "no port" detection in evaluated upstreams.

If an upstream with variables evaluated to address without a port,
then instead of a "no port in upstream" error an attempt was made
to connect() which failed with EADDRNOTAVAIL.

10 years agoMissing "variable" word added.
Maxim Dounin [Tue, 17 Nov 2015 16:41:39 +0000 (19:41 +0300)]
Missing "variable" word added.

10 years agoUsed the pwritev() syscall for writing files where possible.
Valentin Bartenev [Tue, 17 Nov 2015 16:01:41 +0000 (19:01 +0300)]
Used the pwritev() syscall for writing files where possible.

It is more effective, because it doesn't require a separate lseek().

10 years agoMoved file writev() handling code to a separate function.
Valentin Bartenev [Tue, 17 Nov 2015 16:01:41 +0000 (19:01 +0300)]
Moved file writev() handling code to a separate function.

No functional changes.

10 years agoHandled EINTR from write() and pwrite() syscalls.
Valentin Bartenev [Tue, 17 Nov 2015 16:01:41 +0000 (19:01 +0300)]
Handled EINTR from write() and pwrite() syscalls.

This is in addition to 6fce16b1fc10.

10 years agoAdjusted file->sys_offset after the write() syscall.
Valentin Bartenev [Tue, 17 Nov 2015 16:01:41 +0000 (19:01 +0300)]
Adjusted file->sys_offset after the write() syscall.

This fixes suboptimal behavior caused by surplus lseek() for sequential writes
on systems without pwrite().  A consecutive read after write might result in an
error on systems without pread() and pwrite().

Fortunately, at the moment there are no widely used systems without these
syscalls.

10 years agoVersion bump.
Valentin Bartenev [Tue, 17 Nov 2015 16:01:41 +0000 (19:01 +0300)]
Version bump.

10 years agorelease-1.9.7 tag
Maxim Dounin [Tue, 17 Nov 2015 14:50:57 +0000 (17:50 +0300)]
release-1.9.7 tag

10 years agonginx-1.9.7-RELEASE release-1.9.7
Maxim Dounin [Tue, 17 Nov 2015 14:50:56 +0000 (17:50 +0300)]
nginx-1.9.7-RELEASE

10 years agoRealip: the $realip_remote_addr variable.
Ruslan Ermilov [Mon, 16 Nov 2015 13:02:02 +0000 (16:02 +0300)]
Realip: the $realip_remote_addr variable.

10 years agoHTTP/2: reused HEADERS and CONTINUATION frames buffers.
Valentin Bartenev [Fri, 13 Nov 2015 17:10:50 +0000 (20:10 +0300)]
HTTP/2: reused HEADERS and CONTINUATION frames buffers.

10 years agoHTTP/2: fixed handling of output HEADERS frames.
Valentin Bartenev [Fri, 13 Nov 2015 17:10:50 +0000 (20:10 +0300)]
HTTP/2: fixed handling of output HEADERS frames.

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.

10 years agoHTTP/2: fixed invalid headers handling (ticket #831).
Valentin Bartenev [Fri, 13 Nov 2015 17:10:50 +0000 (20:10 +0300)]
HTTP/2: fixed invalid headers handling (ticket #831).

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.

10 years agoUpstream: proxy_cache_convert_head directive.
Roman Arutyunyan [Wed, 11 Nov 2015 12:47:30 +0000 (15:47 +0300)]
Upstream: proxy_cache_convert_head directive.

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.

10 years agoSSL: only select HTTP/2 using NPN if "http2" is enabled.
Valentin Bartenev [Thu, 5 Nov 2015 12:01:09 +0000 (15:01 +0300)]
SSL: only select HTTP/2 using NPN if "http2" is enabled.

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.

10 years agoHTTP/2: backed out 16905ecbb49e (ticket #822).
Valentin Bartenev [Thu, 5 Nov 2015 12:01:01 +0000 (15:01 +0300)]
HTTP/2: backed out 16905ecbb49e (ticket #822).

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.

10 years agoFixed ngx_parse_time() out of bounds access (ticket #821).
Maxim Dounin [Fri, 30 Oct 2015 18:43:30 +0000 (21:43 +0300)]
Fixed ngx_parse_time() out of bounds access (ticket #821).

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.

10 years agoSyslog: added "nohostname" option.
Vladimir Homutov [Mon, 26 Oct 2015 16:06:42 +0000 (19:06 +0300)]
Syslog: added "nohostname" option.

The option disables sending hostname in the syslog message header.  This is
useful with syslog daemons that do not expect it (tickets #677 and #783).

10 years agoHTTP/2: changed behavior of the "http2_max_field_size" directive.
Valentin Bartenev [Tue, 27 Oct 2015 20:16:35 +0000 (23:16 +0300)]
HTTP/2: changed behavior of the "http2_max_field_size" directive.

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.

10 years agoHTTP/2: fixed spelling.
Valentin Bartenev [Tue, 27 Oct 2015 20:16:35 +0000 (23:16 +0300)]
HTTP/2: fixed spelling.

10 years agoVersion bump.
Valentin Bartenev [Tue, 27 Oct 2015 20:16:29 +0000 (23:16 +0300)]
Version bump.

10 years agorelease-1.9.6 tag
Maxim Dounin [Tue, 27 Oct 2015 13:47:30 +0000 (16:47 +0300)]
release-1.9.6 tag

10 years agonginx-1.9.6-RELEASE release-1.9.6
Maxim Dounin [Tue, 27 Oct 2015 13:47:29 +0000 (16:47 +0300)]
nginx-1.9.6-RELEASE

10 years agoHTTP/2: simplified checking the END_STREAM flag.
Valentin Bartenev [Mon, 26 Oct 2015 14:46:28 +0000 (17:46 +0300)]
HTTP/2: simplified checking the END_STREAM flag.

No functional changes.

10 years agoHTTP/2: improved the ngx_http_v2_integer_octets(v) macro.
Valentin Bartenev [Mon, 26 Oct 2015 14:46:16 +0000 (17:46 +0300)]
HTTP/2: improved the ngx_http_v2_integer_octets(v) macro.

Previously, it didn't work well for 0, 127, and 128, returning less than needed.

10 years agoHTTP/2: fixed the NGX_HTTP_V2_MAX_FIELD macro.
Valentin Bartenev [Mon, 26 Oct 2015 14:46:13 +0000 (17:46 +0300)]
HTTP/2: fixed the NGX_HTTP_V2_MAX_FIELD macro.

10 years agoHTTP/2: fixed splitting of response headers on CONTINUATION frames.
Valentin Bartenev [Sun, 27 Sep 2015 23:32:44 +0000 (02:32 +0300)]
HTTP/2: fixed splitting of response headers on CONTINUATION frames.

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.

10 years agoHTTP/2: introduced NGX_HTTP_V2_ENCODE_* macros.
Valentin Bartenev [Mon, 26 Oct 2015 14:43:08 +0000 (17:43 +0300)]
HTTP/2: introduced NGX_HTTP_V2_ENCODE_* macros.

No functional changes.

10 years agoHTTP/2: simplified producing of the Last-Modified header.
Valentin Bartenev [Mon, 26 Oct 2015 14:43:08 +0000 (17:43 +0300)]
HTTP/2: simplified producing of the Last-Modified header.

10 years agoHTTP/2: fixed header block size calculation.
Valentin Bartenev [Mon, 26 Oct 2015 14:43:08 +0000 (17:43 +0300)]
HTTP/2: fixed header block size calculation.

10 years agoHTTP/2: fix handling of connection errors.
Piotr Sikora [Fri, 2 Oct 2015 03:25:55 +0000 (20:25 -0700)]
HTTP/2: fix handling of connection errors.

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>
10 years agoHTTP/2: fix indirect reprioritization.
Piotr Sikora [Fri, 2 Oct 2015 03:25:55 +0000 (20:25 -0700)]
HTTP/2: fix indirect reprioritization.

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>
10 years agoHTTP/2: reject self-dependent streams.
Piotr Sikora [Fri, 2 Oct 2015 03:25:55 +0000 (20:25 -0700)]
HTTP/2: reject self-dependent streams.

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>
10 years agoCore: read/write locks are also required by the Stream module.
Piotr Sikora [Sat, 24 Oct 2015 01:21:33 +0000 (18:21 -0700)]
Core: read/write locks are also required by the Stream module.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>