]> git.kaiwu.me - nginx.git/log
nginx.git
8 years agoHTTP/2: emit new frames only after applying all SETTINGS params.
Piotr Sikora [Fri, 2 Jun 2017 12:05:20 +0000 (15:05 +0300)]
HTTP/2: emit new frames only after applying all SETTINGS params.

Previously, new frames could be emitted in the middle of applying
new (and already acknowledged) SETTINGS params, which is illegal.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
8 years agoConfigure: enabled rpath for NetBSD.
Sergey Kandaurov [Fri, 2 Jun 2017 09:55:31 +0000 (12:55 +0300)]
Configure: enabled rpath for NetBSD.

8 years agoConfigure: disabled IP_PKTINFO feature on certain platforms.
Roman Arutyunyan [Thu, 1 Jun 2017 12:44:23 +0000 (15:44 +0300)]
Configure: disabled IP_PKTINFO feature on certain platforms.

On Cygwin and NetBSD 7.0+ struct in_pktinfo has no ipi_spec_dst field, which
caused nginx compilation error.  Now presence of this field is ensured by the
IP_PKTINFO feature test.

The problem was introduced by dbb0c854e308 (1.13.0).

8 years agoStyle.
Maxim Dounin [Thu, 1 Jun 2017 13:49:14 +0000 (16:49 +0300)]
Style.

8 years agoUpstream: style.
Piotr Sikora [Wed, 31 May 2017 20:51:36 +0000 (13:51 -0700)]
Upstream: style.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
8 years agoHeaders filter: style.
Piotr Sikora [Wed, 31 May 2017 20:51:35 +0000 (13:51 -0700)]
Headers filter: style.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
8 years agoHTTP/2: add debug logging of pseudo-headers and cookies.
Piotr Sikora [Tue, 30 May 2017 14:42:27 +0000 (17:42 +0300)]
HTTP/2: add debug logging of pseudo-headers and cookies.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
8 years agoVersion bump.
Valentin Bartenev [Tue, 30 May 2017 16:29:45 +0000 (19:29 +0300)]
Version bump.

8 years agorelease-1.13.1 tag
Maxim Dounin [Tue, 30 May 2017 14:55:23 +0000 (17:55 +0300)]
release-1.13.1 tag

8 years agonginx-1.13.1-RELEASE release-1.13.1
Maxim Dounin [Tue, 30 May 2017 14:55:22 +0000 (17:55 +0300)]
nginx-1.13.1-RELEASE

8 years agoUpdated OpenSSL used for win32 builds.
Maxim Dounin [Tue, 30 May 2017 14:14:00 +0000 (17:14 +0300)]
Updated OpenSSL used for win32 builds.

8 years agoFixed background requests with asynchronous operations.
Roman Arutyunyan [Mon, 29 May 2017 20:33:38 +0000 (23:33 +0300)]
Fixed background requests with asynchronous operations.

If the main request was finalized while a background request performed an
asynchronous operation, the main request ended up in ngx_http_writer() and was
not finalized until a network event or a timeout.  For example, cache
background update with aio enabled made nginx unable to process further client
requests or close the connection, keeping it open until client closes it.

Now regular finalization of the main request is not suspended because of an
asynchronous operation in another request.

If a background request was terminated while an asynchronous operation was in
progress, background request's write event handler was changed to
ngx_http_request_finalizer() and never called again.

Now, whenever a request is terminated while an asynchronous operation is in
progress, connection error flag is set to make further finalizations of any
request with this connection lead to termination.

These issues appeared in 1aeaae6e9446 (not yet released).

8 years agoConfigure: sched_setaffinity() test moved to auto/unix.
Maxim Dounin [Mon, 29 May 2017 13:48:30 +0000 (16:48 +0300)]
Configure: sched_setaffinity() test moved to auto/unix.

The sched_setaffinity() function was introduced in DragonFly BSD 4.7,
so it is no longer Linux-specific.

Prodded by Sepherosa Ziehau.

8 years agoStyle: changed checks of ngx_ssl_create_connection() to != NGX_OK.
Maxim Dounin [Mon, 29 May 2017 13:34:35 +0000 (16:34 +0300)]
Style: changed checks of ngx_ssl_create_connection() to != NGX_OK.

In http these checks were changed in a6d6d762c554, though mail module
was missed at that time.  Since then, the stream module was introduced
based on mail, using "== NGX_ERROR" check.

8 years agoSSL: set TCP_NODELAY on SSL connections before handshake.
Maxim Dounin [Mon, 29 May 2017 13:34:29 +0000 (16:34 +0300)]
SSL: set TCP_NODELAY on SSL connections before handshake.

With OpenSSL 1.1.0+, the workaround for handshake buffer size as introduced
in a720f0b0e083 (ticket #413) no longer works, as OpenSSL no longer exposes
handshake buffers, see https://github.com/openssl/openssl/commit/2e7dc7cd688.
Moreover, it is no longer possible to adjust handshake buffers at all now.

To avoid additional RTT if handshake uses more than 4k we now set TCP_NODELAY
on SSL connections before handshake.  While this still results in sub-optimal
network utilization due to incomplete packets being sent, it seems to be
better than nothing.

8 years agoIntroduced ngx_tcp_nodelay().
Ruslan Ermilov [Fri, 26 May 2017 19:52:48 +0000 (22:52 +0300)]
Introduced ngx_tcp_nodelay().

8 years agoBackground subrequests for cache updates.
Roman Arutyunyan [Thu, 25 May 2017 12:57:59 +0000 (15:57 +0300)]
Background subrequests for cache updates.

Previously, cache background update might not work as expected, making client
wait for it to complete before receiving the final part of a stale response.
This could happen if the response could not be sent to the client socket in one
filter chain call.

Now background cache update is done in a background subrequest.  This type of
subrequest does not block any other subrequests or the main request.

8 years agoFixed deferred accept with EPOLLRDHUP enabled (ticket #1278).
Roman Arutyunyan [Wed, 24 May 2017 10:17:08 +0000 (13:17 +0300)]
Fixed deferred accept with EPOLLRDHUP enabled (ticket #1278).

Previously, the read event of the accepted connection was marked ready, but not
available.  This made EPOLLRDHUP-related code (for example, in ngx_unix_recv())
expect more data from the socket, leading to unexpected behavior.

For example, if SSL, PROXY protocol and deferred accept were enabled on a listen
socket, the client connection was aborted due to unexpected return value of
c->recv().

8 years agoHTTP/2: fixed segfault when memory allocation failed.
Valentin Bartenev [Tue, 23 May 2017 17:19:39 +0000 (20:19 +0300)]
HTTP/2: fixed segfault when memory allocation failed.

If allocation of cleanup handler in the HTTP/2 header filter failed, then
a stream might be freed with a HEADERS frame left in the output queue.

Now the HEADERS frame is accounted in the queue before trying to allocate
the cleanup handler.

8 years agoContrib: proper syntax parsing in vim syntax highlighting.
Maxim Dounin [Mon, 22 May 2017 13:34:47 +0000 (16:34 +0300)]
Contrib: proper syntax parsing in vim syntax highlighting.

Instead of highlighting directives in arbitrary positions, proper
parsing of nginx.conf syntax was implemented, matching what nginx does
internally.  This allows vim to correctly highlight various complex cases,
including:

    return 301 http://example.com/path#fragment";

and also avoids highlighting of parameters as directives, as in

    server_name missing.semicolon.example.com
    index index.php;

where "index" is not a directive but a parameter of the "server_name"
directive due to missing semicolon.

Most important downside of this approach seems to be that there is no
easy way to introduce directive-specific parameters.  As such, only "listen"
directive parameters were preserved.

8 years agoCache: ignore long locked entries during forced expire.
Dmitry Volyntsev [Thu, 18 May 2017 15:39:16 +0000 (18:39 +0300)]
Cache: ignore long locked entries during forced expire.

Abnormally exited workers may leave locked cache entries, this can
result in the cache size on disk exceeding max_size and shared memory
exhaustion.

This change mitigates the issue by ignoring locked entries during forced
expire.  It also increases the visibility of the problem by logging such
entries.

8 years agoUpstream: fixed u->headers_in.headers allocation error handling.
Sergey Kandaurov [Thu, 18 May 2017 11:17:00 +0000 (14:17 +0300)]
Upstream: fixed u->headers_in.headers allocation error handling.

Previously, an allocation error resulted in uninitialized memory access
when evaluating $upstream_http_ variables.

On a related note, see r->headers_out.headers cleanup work in 0cdee26605f3.

8 years agoConfigure: recent Sun C versions.
Maxim Dounin [Mon, 15 May 2017 17:09:44 +0000 (20:09 +0300)]
Configure: recent Sun C versions.

8 years agoConfigure: disabled gcc atomics with Sun C (ticket #1261).
Maxim Dounin [Mon, 15 May 2017 17:09:43 +0000 (20:09 +0300)]
Configure: disabled gcc atomics with Sun C (ticket #1261).

Oracle Developer Studio 12.5 introduced GCC-compatible __sync builtins.
Unfortunately, these builtins are neither GCC-compatible (they generate
warnings when used with volatile), nor working (unexpectedly fail on
unpredictable combinations of code layout and compiler flags).  As such,
the gcc builtin atomic operations configure test explicitly disabled when
compiling with Sun C.

8 years agoConfigure: style.
Maxim Dounin [Mon, 15 May 2017 17:09:40 +0000 (20:09 +0300)]
Configure: style.

8 years agoRealip: allow hostnames in set_real_ip_from (ticket #1180).
Ruslan Ermilov [Mon, 15 May 2017 14:17:01 +0000 (17:17 +0300)]
Realip: allow hostnames in set_real_ip_from (ticket #1180).

8 years agoAccess: simplified rule parser code.
Ruslan Ermilov [Mon, 15 May 2017 14:16:32 +0000 (17:16 +0300)]
Access: simplified rule parser code.

9 years agoSSL: allowed renegotiation in client mode with OpenSSL < 1.1.0.
Sergey Kandaurov [Wed, 3 May 2017 12:15:56 +0000 (15:15 +0300)]
SSL: allowed renegotiation in client mode with OpenSSL < 1.1.0.

In ac9b1df5b246 (1.13.0) we attempted to allow renegotiation in client mode,
but when using OpenSSL 1.0.2 or older versions it was additionally disabled
by SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS.

9 years agoAdded missing "fall through" comments (ticket #1259).
Maxim Dounin [Thu, 27 Apr 2017 13:57:18 +0000 (16:57 +0300)]
Added missing "fall through" comments (ticket #1259).

Found by gcc7 (-Wimplicit-fallthrough).

9 years agoDon't pretend we support HTTP major versions >1 as HTTP/1.1.
Ruslan Ermilov [Tue, 25 Apr 2017 20:39:13 +0000 (23:39 +0300)]
Don't pretend we support HTTP major versions >1 as HTTP/1.1.

9 years agoVersion bump.
Ruslan Ermilov [Tue, 25 Apr 2017 20:39:06 +0000 (23:39 +0300)]
Version bump.

9 years agorelease-1.13.0 tag
Maxim Dounin [Tue, 25 Apr 2017 14:18:22 +0000 (17:18 +0300)]
release-1.13.0 tag

9 years agonginx-1.13.0-RELEASE release-1.13.0
Maxim Dounin [Tue, 25 Apr 2017 14:18:21 +0000 (17:18 +0300)]
nginx-1.13.0-RELEASE

9 years agoHTTP/2: reduced difference to HTTP/1.x in reading request body.
Valentin Bartenev [Mon, 24 Apr 2017 11:17:13 +0000 (14:17 +0300)]
HTTP/2: reduced difference to HTTP/1.x in reading request body.

Particularly, this eliminates difference in behavior for requests without body
and deduplicates code.

Prodded by Piotr Sikora.

9 years agoHTTP/2: rejecting zero WINDOW_UPDATE with PROTOCOL_ERROR.
Valentin Bartenev [Mon, 24 Apr 2017 11:16:57 +0000 (14:16 +0300)]
HTTP/2: rejecting zero WINDOW_UPDATE with PROTOCOL_ERROR.

It's required by RFC 7540.  While there is no real harm from such frames,
that should help to detect broken clients.

Based on a patch by Piotr Sikora.

9 years agoGzip static: use an appropriate error on memory allocation failure.
Sergey Kandaurov [Thu, 20 Apr 2017 15:26:38 +0000 (18:26 +0300)]
Gzip static: use an appropriate error on memory allocation failure.

9 years agoCleaned up r->headers_out.headers allocation error handling.
Sergey Kandaurov [Thu, 20 Apr 2017 15:26:37 +0000 (18:26 +0300)]
Cleaned up r->headers_out.headers allocation error handling.

If initialization of a header failed for some reason after ngx_list_push(),
leaving the header as is can result in uninitialized memory access by
the header filter or the log module.  The fix is to clear partially
initialized headers in case of errors.

For the Cache-Control header, the fix is to postpone pushing
r->headers_out.cache_control until its value is completed.

9 years agoCore: signal sender pid logging.
Igor Sysoev [Thu, 20 Apr 2017 10:58:16 +0000 (13:58 +0300)]
Core: signal sender pid logging.

9 years agoSub filter: restored ngx_http_set_ctx() at the proper place.
Sergey Kandaurov [Tue, 18 Apr 2017 16:55:23 +0000 (19:55 +0300)]
Sub filter: restored ngx_http_set_ctx() at the proper place.

Previously, ngx_http_sub_header_filter() could fail with a partially
initialized context, later accessed in ngx_http_sub_body_filter()
if called from the perl content handler.

The issue had appeared in 2c045e5b8291 (1.9.4).

A better fix would be to handle ngx_http_send_header() errors in
the perl module, though this doesn't seem to be easy enough.

9 years agoSSL: compatibility with OpenSSL master branch.
Sergey Kandaurov [Tue, 18 Apr 2017 13:08:46 +0000 (16:08 +0300)]
SSL: compatibility with OpenSSL master branch.

The SSL_CTRL_SET_CURVES_LIST macro is removed in the OpenSSL master branch.
SSL_CTX_set1_curves_list is preserved as compatibility with previous versions.

9 years agoSSL: disabled renegotiation detection in client mode.
Sergey Kandaurov [Tue, 18 Apr 2017 13:08:44 +0000 (16:08 +0300)]
SSL: disabled renegotiation detection in client mode.

CVE-2009-3555 is no longer relevant and mitigated by the renegotiation
info extension (secure renegotiation).  On the other hand, unexpected
renegotiation still introduces potential security risks, and hence we do
not allow renegotiation on the server side, as we never request renegotiation.

On the client side the situation is different though.  There are backends
which explicitly request renegotiation, and disabled renegotiation
introduces interoperability problems.  This change allows renegotiation
on the client side, and fixes interoperability problems as observed with
such backends (ticket #872).

Additionally, with TLSv1.3 the SSL_CB_HANDSHAKE_START flag is currently set
by OpenSSL when receiving a NewSessionTicket message, and was detected by
nginx as a renegotiation attempt.  This looks like a bug in OpenSSL, though
this change also allows better interoperability till the problem is fixed.

9 years agoSSL: added support for TLSv1.3 in ssl_protocols directive.
Sergey Kandaurov [Tue, 18 Apr 2017 12:12:38 +0000 (15:12 +0300)]
SSL: added support for TLSv1.3 in ssl_protocols directive.

Support for the TLSv1.3 protocol will be introduced in OpenSSL 1.1.1.

9 years agoSet UDP datagram source address (ticket #1239).
Roman Arutyunyan [Tue, 11 Apr 2017 13:41:53 +0000 (16:41 +0300)]
Set UDP datagram source address (ticket #1239).

Previously, the source IP address of a response UDP datagram could differ from
the original datagram destination address.  This could happen if the server UDP
socket is bound to a wildcard address and the network interface chosen to output
the response packet has a different default address than the destination address
of the original packet.  For example, if two addresses from the same network are
configured on an interface.

Now source address is set explicitly if a response is sent for a server UDP
socket bound to a wildcard address.

9 years agoCore: removed extra ngx_alloc() and ngx_calloc() prototypes.
Sergey Kandaurov [Tue, 18 Apr 2017 10:01:19 +0000 (13:01 +0300)]
Core: removed extra ngx_alloc() and ngx_calloc() prototypes.

9 years agoEnabled IPV6_RECVPKTINFO / IPV6_PKTINFO on macOS.
Sergey Kandaurov [Mon, 17 Apr 2017 11:42:12 +0000 (14:42 +0300)]
Enabled IPV6_RECVPKTINFO / IPV6_PKTINFO on macOS.

This change allows setting the destination IPv6 address of a UDP datagram
received on a wildcard socket.

9 years agoAdded support for the "308 Permanent Redirect" (ticket #877).
Simon Leblanc [Tue, 11 Apr 2017 01:13:46 +0000 (03:13 +0200)]
Added support for the "308 Permanent Redirect" (ticket #877).

9 years agoMail: configurable socket buffer sizes.
Vladimir Homutov [Mon, 3 Apr 2017 14:30:34 +0000 (17:30 +0300)]
Mail: configurable socket buffer sizes.

The "rcvbuf" and "sndbuf" parameters are now supported by
the "listen" directive.

9 years agoStream: configurable socket buffer sizes.
Vladimir Homutov [Mon, 3 Apr 2017 14:29:19 +0000 (17:29 +0300)]
Stream: configurable socket buffer sizes.

The "rcvbuf" and "sndbuf" parameters are now supported by
the "listen" directive.

9 years agoCore: improved JSON escaping.
Valentin Bartenev [Wed, 12 Apr 2017 19:47:57 +0000 (22:47 +0300)]
Core: improved JSON escaping.

Two-character representations are now used for \b, \f, \n, \r, and \t.

9 years agoUse ngx_calloc_buf() where appropriate.
Ruslan Ermilov [Wed, 12 Apr 2017 19:21:04 +0000 (22:21 +0300)]
Use ngx_calloc_buf() where appropriate.

9 years agoVersion bump.
Ruslan Ermilov [Wed, 12 Apr 2017 19:14:24 +0000 (22:14 +0300)]
Version bump.

9 years agorelease-1.11.13 tag
Maxim Dounin [Tue, 4 Apr 2017 15:01:57 +0000 (18:01 +0300)]
release-1.11.13 tag

9 years agonginx-1.11.13-RELEASE release-1.11.13
Maxim Dounin [Tue, 4 Apr 2017 15:01:57 +0000 (18:01 +0300)]
nginx-1.11.13-RELEASE

9 years agoUpstream: allow recovery from "429 Too Many Requests" response.
Piotr Sikora [Fri, 24 Mar 2017 09:48:03 +0000 (02:48 -0700)]
Upstream: allow recovery from "429 Too Many Requests" response.

This change adds "http_429" parameter to "proxy_next_upstream" for
retrying rate-limited requests, and to "proxy_cache_use_stale" for
serving stale cached responses after being rate-limited.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
9 years agoAdded support for "429 Too Many Requests" response (RFC6585).
Piotr Sikora [Fri, 24 Mar 2017 09:48:03 +0000 (02:48 -0700)]
Added support for "429 Too Many Requests" response (RFC6585).

This change adds reason phrase in status line and pretty response body
when "429" status code is used in "return", "limit_conn_status" and/or
"limit_req_status" directives.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
9 years agoFixed type.
hucongcong [Mon, 3 Apr 2017 06:29:40 +0000 (14:29 +0800)]
Fixed type.

9 years agoSlice filter: prevented slice redirection (ticket #1219).
Roman Arutyunyan [Fri, 31 Mar 2017 18:47:56 +0000 (21:47 +0300)]
Slice filter: prevented slice redirection (ticket #1219).

When a slice subrequest was redirected to a new location, its context was lost.
After its completion, a new slice subrequest for the same slice was created.
This could lead to infinite loop.  Now the slice module makes sure each slice
subrequest starts output with the slice context available.

9 years agoSlice filter: allowed at most one subrequest at a time.
Roman Arutyunyan [Tue, 28 Mar 2017 11:03:57 +0000 (14:03 +0300)]
Slice filter: allowed at most one subrequest at a time.

Previously, if slice main request write handler was called while a slice
subrequest was running, a new subrequest for the same slice was started.

9 years agoMoved handling of wev->delayed to the connection event handler.
Maxim Dounin [Sun, 2 Apr 2017 11:32:29 +0000 (14:32 +0300)]
Moved handling of wev->delayed to the connection event handler.

With post_action or subrequests, it is possible that the timer set for
wev->delayed will expire while the active subrequest write event handler
is not ready to handle this.  This results in request hangs as observed
with limit_rate / sendfile_max_chunk and post_action (ticket #776) or
subrequests (ticket #1228).

Moving the handling to the connection event handler fixes the hangs observed,
and also slightly simplifies the code.

9 years agoPerl: fixed delaying subrequests.
Maxim Dounin [Sun, 2 Apr 2017 11:32:28 +0000 (14:32 +0300)]
Perl: fixed delaying subrequests.

Much like in limit_req, use the wev->delayed flag to ensure proper handling
and interoperability with limit_rate.

9 years agoLimit req: fixed delaying subrequests.
Maxim Dounin [Sun, 2 Apr 2017 11:32:26 +0000 (14:32 +0300)]
Limit req: fixed delaying subrequests.

Since limit_req uses connection's write event to delay request processing,
it can conflict with timers in other subrequests.  In particular, even
if applied to an active subrequest, it can break things if wev->delayed
is already set (due to limit_rate or sendfile_max_chunk), since after
limit_req finishes the wev->delayed flag will be set and no timer will be
active.

Fix is to use the wev->delayed flag in limit_req as well.  This ensures that
wev->delayed won't be set after limit_req finishes, and also ensures that
limit_req's timers will be properly handled by other subrequests if the one
delayed by limit_req is not active.

9 years agoHTTP/2: style and typos.
Piotr Sikora [Sun, 26 Mar 2017 08:25:01 +0000 (01:25 -0700)]
HTTP/2: style and typos.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
9 years agoHTTP/2: fixed connection finalization.
Valentin Bartenev [Wed, 29 Mar 2017 17:21:01 +0000 (20:21 +0300)]
HTTP/2: fixed connection finalization.

All streams in connection must be finalized before the connection
itself can be finalized and all related memory is freed.  That's
not always possible on the current event loop iteration.

Thus when the last stream is finalized, it sets the special read
event handler ngx_http_v2_handle_connection_handler() and posts
the event.

Previously, this handler didn't check the connection state and
could call the regular event handler on a connection that was
already in finalization stage.  In the worst case that could
lead to a segmentation fault, since some data structures aren't
supposed to be used during connection finalization.  Particularly,
the waiting queue can contain already freed streams, so the
WINDOW_UPDATE frame received by that moment could trigger
accessing to these freed streams.

Now, the connection error flag is explicitly checked in
ngx_http_v2_handle_connection_handler().

9 years agoHTTP/2: fixed stream finalization.
Valentin Bartenev [Wed, 29 Mar 2017 17:16:23 +0000 (20:16 +0300)]
HTTP/2: fixed stream finalization.

In order to finalize stream the error flag is set on fake connection and
either "write" or "read" event handler is called.  The read events of fake
connections are always ready, but it's not the case with the write events.

When the ready flag isn't set, the error flag can be not checked in some
cases and as a result stream isn't finalized.  Now the ready flag is
explicilty set on write events for proper finalization in all cases.

9 years agoHTTP/2: emit PROTOCOL_ERROR on padding errors.
Piotr Sikora [Sun, 26 Mar 2017 08:25:05 +0000 (01:25 -0700)]
HTTP/2: emit PROTOCOL_ERROR on padding errors.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
9 years agoHTTP/2: fix flow control with padded DATA frames.
Piotr Sikora [Sun, 26 Mar 2017 08:25:04 +0000 (01:25 -0700)]
HTTP/2: fix flow control with padded DATA frames.

Previously, flow control didn't account for padding in DATA frames,
which meant that its view of the world could drift from peer's view
by up to 256 bytes per received padded DATA frame, which could lead
to a deadlock.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
9 years agoHTTP/2: fix $body_bytes_sent variable.
Piotr Sikora [Sun, 26 Mar 2017 08:25:03 +0000 (01:25 -0700)]
HTTP/2: fix $body_bytes_sent variable.

Previously, its value included payloads and frame headers of HEADERS
and CONTINUATION frames.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
9 years agoHTTP/2: fix $bytes_sent variable.
Piotr Sikora [Sun, 26 Mar 2017 08:25:02 +0000 (01:25 -0700)]
HTTP/2: fix $bytes_sent variable.

Previously, its value accounted for payloads of HEADERS, CONTINUATION
and DATA frames, as well as frame headers of HEADERS and DATA frames,
but it didn't account for frame headers of CONTINUATION frames.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
9 years agoCopy filter: wake up subrequests after aio operations.
Maxim Dounin [Tue, 28 Mar 2017 15:15:42 +0000 (18:15 +0300)]
Copy filter: wake up subrequests after aio operations.

Previously, connection write handler was called, resulting in wake up
of the active subrequest.  This change makes it possible to read data
in non-active subrequests as well.  For example, this allows SSI to
process instructions in non-active subrequests earlier and start
additional subrequests if needed, reducing overall response time.

9 years agoThreads: fixed request hang with aio_write and subrequests.
Maxim Dounin [Tue, 28 Mar 2017 15:15:41 +0000 (18:15 +0300)]
Threads: fixed request hang with aio_write and subrequests.

If the subrequest is already finalized, the handler set with aio_write
may still be used by sendfile in threads when using range requests
(see also e4c1f5b32868, and the original note in 9fd738b85fad).  Calling
already finalized subrequest's r->write_event_handler in practice
results in request hang in some cases.

Fix is to trigger connection event handler if the subrequest was already
finalized.

9 years agoSimplified and improved sendfile() code on Linux.
Maxim Dounin [Tue, 28 Mar 2017 15:15:39 +0000 (18:15 +0300)]
Simplified and improved sendfile() code on Linux.

The ngx_linux_sendfile() function is now used for both normal sendfile()
and sendfile in threads.  The ngx_linux_sendfile_thread() function was
modified to use the same interface as ngx_linux_sendfile(), and is simply
called from ngx_linux_sendfile() when threads are enabled.

Special return code NGX_DONE is used to indicate that a thread task was
posted and no further actions are needed.

If number of bytes sent is less that what we were sending, we now always
retry sending.  This is needed for sendfile() in threads as the number
of bytes we are sending might have been changed since the thread task
was posted.  And this is also needed for Linux 4.3+, as sendfile() might
be interrupted at any time and provides no indication if it was interrupted
or not (ticket #1174).

9 years agoFixed ngx_open_cached_file() error handling.
Sergey Kandaurov [Tue, 28 Mar 2017 11:21:38 +0000 (14:21 +0300)]
Fixed ngx_open_cached_file() error handling.

If of.err is 0, it means that there was a memory allocation error
and no further logging and/or processing is needed.  The of.failed
string can be only accessed if of.err is not 0.

9 years agoCore: set nginx_shared_zone name via ngx_str_set().
Ruslan Ermilov [Tue, 28 Mar 2017 08:28:51 +0000 (11:28 +0300)]
Core: set nginx_shared_zone name via ngx_str_set().

9 years agoUse ngx_array_init() to initialize arrays.
Ruslan Ermilov [Tue, 28 Mar 2017 08:28:42 +0000 (11:28 +0300)]
Use ngx_array_init() to initialize arrays.

9 years agoVersion bump.
Ruslan Ermilov [Tue, 28 Mar 2017 08:28:36 +0000 (11:28 +0300)]
Version bump.

9 years agorelease-1.11.12 tag
Maxim Dounin [Fri, 24 Mar 2017 15:05:06 +0000 (18:05 +0300)]
release-1.11.12 tag

9 years agonginx-1.11.12-RELEASE release-1.11.12
Maxim Dounin [Fri, 24 Mar 2017 15:05:05 +0000 (18:05 +0300)]
nginx-1.11.12-RELEASE

9 years agoFixed CPU hog while freeing hc->busy after e662cbf1b932 (1.11.11).
Maxim Dounin [Fri, 24 Mar 2017 13:26:12 +0000 (16:26 +0300)]
Fixed CPU hog while freeing hc->busy after e662cbf1b932 (1.11.11).

Reported by Richard Stanway,
http://mailman.nginx.org/pipermail/nginx/2017-March/053296.html.

9 years agoSimplified code about duplicate root/alias directive.
Ruslan Ermilov [Wed, 22 Mar 2017 20:36:35 +0000 (23:36 +0300)]
Simplified code about duplicate root/alias directive.

9 years agoUnified error messages about duplicate directives.
Ruslan Ermilov [Wed, 22 Mar 2017 19:49:52 +0000 (22:49 +0300)]
Unified error messages about duplicate directives.

9 years agoVersion bump.
Ruslan Ermilov [Wed, 22 Mar 2017 19:49:42 +0000 (22:49 +0300)]
Version bump.

9 years agorelease-1.11.11 tag
Maxim Dounin [Tue, 21 Mar 2017 15:04:22 +0000 (18:04 +0300)]
release-1.11.11 tag

9 years agonginx-1.11.11-RELEASE release-1.11.11
Maxim Dounin [Tue, 21 Mar 2017 15:04:22 +0000 (18:04 +0300)]
nginx-1.11.11-RELEASE

9 years agoAdded HTTP/2 to win32 builds.
Maxim Dounin [Tue, 21 Mar 2017 14:28:15 +0000 (17:28 +0300)]
Added HTTP/2 to win32 builds.

9 years agoFixed a comment.
Ruslan Ermilov [Fri, 17 Mar 2017 09:09:31 +0000 (12:09 +0300)]
Fixed a comment.

9 years agoConfigure: fixed --without_http.
Ruslan Ermilov [Thu, 16 Mar 2017 17:38:31 +0000 (20:38 +0300)]
Configure: fixed --without_http.

Instead of turning off some randomly selected http modules
when --without-http is specified, just don't process the
whole http modules section.

9 years agoConfigure: fixed build with --with-stream.
Ruslan Ermilov [Thu, 16 Mar 2017 17:38:26 +0000 (20:38 +0300)]
Configure: fixed build with --with-stream.

Some combinations of options might cause the builds with the
--with-stream option to break due to invalid value of the
STREAM_INCS make variable, e.g.

auto/configure \
    --with-stream \
    --with-http_perl_module=dynamic \
    --without-http_memcached_module \
    --without-http_empty_gif_module \
    --without-http_browser_module \
    --without-http_upstream_hash_module \
    --without-http_upstream_ip_hash_module \
    --without-http_upstream_least_conn_module \
    --without-http_upstream_keepalive_module \
    --without-http_upstream_zone_module \

Explicit initialization of ngx_module_libs and ngx_module_link
matches what we already do when processing mail modules, and
is also required after the next change.

9 years agoAdded missing "static" specifier found by gcc -Wtraditional.
Ruslan Ermilov [Thu, 16 Mar 2017 16:01:05 +0000 (19:01 +0300)]
Added missing "static" specifier found by gcc -Wtraditional.

This has somehow escaped from fbdaad9b0e7b.

9 years agoStyle.
Maxim Dounin [Tue, 7 Mar 2017 15:51:17 +0000 (18:51 +0300)]
Style.

9 years agoIntroduced worker_shutdown_timeout.
Maxim Dounin [Tue, 7 Mar 2017 15:51:16 +0000 (18:51 +0300)]
Introduced worker_shutdown_timeout.

The directive configures a timeout to be used when gracefully shutting down
worker processes.  When the timer expires, nginx will try to close all
the connections currently open to facilitate shutdown.

9 years agoCancelable timers are now preserved if there are other timers.
Maxim Dounin [Tue, 7 Mar 2017 15:51:15 +0000 (18:51 +0300)]
Cancelable timers are now preserved if there are other timers.

There is no need to cancel timers early if there are other timers blocking
shutdown anyway.  Preserving such timers allows nginx to continue some
periodic work till the shutdown is actually possible.

With the new approach, timers with ev->cancelable are simply ignored when
checking if there are any timers left during shutdown.

9 years agoCore: introduced ngx_rbtree_next().
Maxim Dounin [Tue, 7 Mar 2017 15:51:13 +0000 (18:51 +0300)]
Core: introduced ngx_rbtree_next().

9 years agoAccess log: removed dead ev->timedout check in flush timer handler.
Maxim Dounin [Tue, 7 Mar 2017 15:51:12 +0000 (18:51 +0300)]
Access log: removed dead ev->timedout check in flush timer handler.

The ev->timedout flag is set on first timer expiration, and never reset
after it.  Due to this the code to stop the timer when the timer was
canceled never worked (except in a very specific time frame immediately
after start), and the timer was always armed again.  This essentially
resulted in a buffer flush at the end of an event loop iteration.

This behaviour actually seems to be better than just stopping the flush
timer for the whole shutdown, so it is preserved as is instead of fixing
the code to actually remove the timer.  It will be further improved by
upcoming changes to preserve cancelable timers if there are other timers
blocking shutdown.

9 years agoConverted hc->busy/hc->free to use chain links.
Maxim Dounin [Tue, 7 Mar 2017 15:49:31 +0000 (18:49 +0300)]
Converted hc->busy/hc->free to use chain links.

Most notably, this fixes possible buffer overflows if number of large
client header buffers in a virtual server is different from the one in
the default server.

Reported by Daniil Bondarev.

9 years agoRemoved casts not needed after 1f513d7f1b45.
Ruslan Ermilov [Tue, 7 Mar 2017 08:47:58 +0000 (11:47 +0300)]
Removed casts not needed after 1f513d7f1b45.

9 years agoMail: don't emit separator in capability lists for APOP.
Sergey Kandaurov [Mon, 6 Mar 2017 14:56:23 +0000 (17:56 +0300)]
Mail: don't emit separator in capability lists for APOP.

Notably, this fixes CAPA and AUTH output.

The bug had appeared in nginx 1.11.6 (73b451d304c0).

9 years agoAdded missing "static" specifiers found by gcc -Wtraditional.
Ruslan Ermilov [Mon, 6 Mar 2017 08:09:47 +0000 (11:09 +0300)]
Added missing "static" specifiers found by gcc -Wtraditional.

9 years agoAdded missing static specifiers.
Eran Kornblau [Thu, 2 Mar 2017 13:46:00 +0000 (08:46 -0500)]
Added missing static specifiers.

9 years agoContrib: vim syntax, update 3rd party module directives.
othree [Wed, 1 Mar 2017 15:41:39 +0000 (23:41 +0800)]
Contrib: vim syntax, update 3rd party module directives.

9 years agoFixed background update with "if".
Maxim Dounin [Mon, 27 Feb 2017 19:36:15 +0000 (22:36 +0300)]
Fixed background update with "if".

Cloned subrequests should inherit r->content_handler.  This way they will
be able to use the same location configuration as the original request
if there are "if" directives in the configuration.

Without r->content_handler inherited, the following configuration tries
to access a static file in the update request:

    location / {
        set $true 1;
        if ($true) {
            # nothing
        }

        proxy_pass http://backend;
        proxy_cache one;
        proxy_cache_use_stale updating;
        proxy_cache_background_update on;
    }

See http://mailman.nginx.org/pipermail/nginx/2017-February/053019.html for
initial report.