]> git.kaiwu.me - nginx.git/log
nginx.git
9 years agoSub filter: eliminate unnecessary buffering.
Roman Arutyunyan [Sat, 2 Jul 2016 12:59:53 +0000 (15:59 +0300)]
Sub filter: eliminate unnecessary buffering.

Previously, when a buffer was processed by the sub filter, its final bytes
could be buffered by the filter even if they don't match any pattern.
This happened because the Boyer-Moore algorithm, employed by the sub filter
since b9447fc457b4 (1.9.4), matches the last characters of patterns prior to
checking other characters.  If the last character is out of scope, initial
bytes of a potential match are buffered until the last character is available.

Now, after receiving a flush or recycled buffer, the filter performs
additional checks to reduce the number of buffered bytes.  The potential match
is checked against the initial parts of all patterns.  Non-matching bytes are
not buffered.  This improves processing of a chunked response from upstream
by sending the entire chunks without buffering unless a partial match is found
at the end of a chunk.

9 years agoSub filter: introduced the ngx_http_sub_match() function.
Roman Arutyunyan [Sat, 2 Jul 2016 12:59:52 +0000 (15:59 +0300)]
Sub filter: introduced the ngx_http_sub_match() function.

No functional changes.

9 years agoInternal md5 and sha1 implementations are now always used.
Maxim Dounin [Thu, 30 Jun 2016 15:57:39 +0000 (18:57 +0300)]
Internal md5 and sha1 implementations are now always used.

This reduces the number of moving parts in ABI compatibility checks.
Additionally, it also allows to use OpenSSL in FIPS mode while still
using md5 for non-security tasks.

9 years agoRemoved unused flag accept_context_updated from ngx_event_t.
Ruslan Ermilov [Wed, 29 Jun 2016 11:30:00 +0000 (14:30 +0300)]
Removed unused flag accept_context_updated from ngx_event_t.

Also, removed practically unused flag accept_context_updated from
ngx_connection_t.

9 years agoStyle.
Roman Arutyunyan [Mon, 27 Jun 2016 15:42:29 +0000 (18:42 +0300)]
Style.

9 years agoHTTP/2: style.
Piotr Sikora [Wed, 22 Jun 2016 20:47:54 +0000 (13:47 -0700)]
HTTP/2: style.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
9 years agoStyle.
Roman Arutyunyan [Wed, 22 Jun 2016 08:50:02 +0000 (11:50 +0300)]
Style.

9 years agoStream: use ngx_pcalloc() in ngx_stream_proxy_bind().
Roman Arutyunyan [Wed, 22 Jun 2016 08:50:02 +0000 (11:50 +0300)]
Stream: use ngx_pcalloc() in ngx_stream_proxy_bind().

9 years agoFixed build on MSVC.
Roman Arutyunyan [Mon, 20 Jun 2016 12:11:50 +0000 (15:11 +0300)]
Fixed build on MSVC.

9 years agoStream: set SO_REUSEADDR for UDP upstream sockets.
Roman Arutyunyan [Mon, 20 Jun 2016 09:48:47 +0000 (12:48 +0300)]
Stream: set SO_REUSEADDR for UDP upstream sockets.

The option is only set if the socket is bound to a specific port to allow
several such sockets coexist at the same time.  This is required, for example,
when nginx acts as a transparent proxy and receives two datagrams from the same
client in a short time.

The feature is only implemented for Linux.

9 years agoStream: support for $remote_port in proxy_bind.
Roman Arutyunyan [Mon, 20 Jun 2016 08:50:44 +0000 (11:50 +0300)]
Stream: support for $remote_port in proxy_bind.

The following two types of bind addresses are supported in addition to
$remote_addr and address literals:

- $remote_addr:$remote_port
- [$remote_addr]:$remote_port

In both cases client remote address with port is used in upstream socket bind.

9 years agoUpstream: support for port in proxy_bind and friends.
Roman Arutyunyan [Mon, 20 Jun 2016 08:50:43 +0000 (11:50 +0300)]
Upstream: support for port in proxy_bind and friends.

9 years agoIntroduced ngx_inet_get_port() and ngx_inet_set_port() functions.
Roman Arutyunyan [Mon, 20 Jun 2016 08:50:39 +0000 (11:50 +0300)]
Introduced ngx_inet_get_port() and ngx_inet_set_port() functions.

9 years agoSet IP_BIND_ADDRESS_NO_PORT socket option for upstream sockets.
Andrei Belov [Mon, 20 Jun 2016 07:41:17 +0000 (10:41 +0300)]
Set IP_BIND_ADDRESS_NO_PORT socket option for upstream sockets.

9 years agoSSL: ngx_ssl_ciphers() to set list of ciphers.
Tim Taubert [Wed, 15 Jun 2016 20:05:30 +0000 (21:05 +0100)]
SSL: ngx_ssl_ciphers() to set list of ciphers.

This patch moves various OpenSSL-specific function calls into the
OpenSSL module and introduces ngx_ssl_ciphers() to make nginx more
crypto-library-agnostic.

9 years agoHTTP/2: fixed the "http request count is zero" alert.
Valentin Bartenev [Thu, 16 Jun 2016 17:55:11 +0000 (20:55 +0300)]
HTTP/2: fixed the "http request count is zero" alert.

When the stream is terminated the HEADERS frame can still wait in the output
queue.  This frame can't be removed and must be sent to the client anyway,
since HTTP/2 uses stateful compression for headers.  So in order to postpone
closing and freeing memory of such stream the special close stream handler
is set to the write event.  After the HEADERS frame is sent the write event
is called and the stream will be finally closed.

Some events like receiving a RST_STREAM can trigger the read handler of such
stream in closing state and cause unexpected processing that can result in
another attempt to finalize the request.  To prevent it the read handler is
now set to ngx_http_empty_handler.

Thanks to Amazon.

9 years agoHTTP/2: avoid adding Content-Length for requests without body.
Valentin Bartenev [Thu, 16 Jun 2016 17:55:11 +0000 (20:55 +0300)]
HTTP/2: avoid adding Content-Length for requests without body.

There is no reason to add the "Content-Length: 0" header to a proxied request
without body if the header isn't presented in the original request.

Thanks to Amazon.

9 years agoHTTP/2: prevented double termination of a stream.
Valentin Bartenev [Thu, 16 Jun 2016 17:55:11 +0000 (20:55 +0300)]
HTTP/2: prevented double termination of a stream.

According to RFC 7540, an endpoint should not send more than one RST_STREAM
frame for any stream.

Also, now all the data frames will be skipped while termination.

9 years agoHTTP/2: fixed a segfault while processing unbuffered upload.
Valentin Bartenev [Thu, 16 Jun 2016 17:55:11 +0000 (20:55 +0300)]
HTTP/2: fixed a segfault while processing unbuffered upload.

The ngx_http_v2_finalize_connection() closes current stream, but that is an
invalid operation while processing unbuffered upload.  This results in access
to already freed memory, since the upstream module sets a cleanup handler that
also finalizes the request.

9 years agoAn internal SHA1 implementation.
Maxim Dounin [Thu, 9 Jun 2016 13:55:38 +0000 (16:55 +0300)]
An internal SHA1 implementation.

9 years agoFixed spelling.
Otto Kekäläinen [Wed, 8 Jun 2016 05:27:41 +0000 (08:27 +0300)]
Fixed spelling.

9 years agoFixed an error log message.
Valentin Bartenev [Tue, 7 Jun 2016 14:44:20 +0000 (17:44 +0300)]
Fixed an error log message.

9 years agoConfigure: revised GCC version processing.
Sergey Kandaurov [Tue, 7 Jun 2016 09:15:56 +0000 (12:15 +0300)]
Configure: revised GCC version processing.

Now GCC 6 and onwards will use -Wno-unused-parameter.

9 years agoVersion bump.
Sergey Kandaurov [Tue, 7 Jun 2016 09:26:34 +0000 (12:26 +0300)]
Version bump.

9 years agorelease-1.11.1 tag
Maxim Dounin [Tue, 31 May 2016 13:43:49 +0000 (16:43 +0300)]
release-1.11.1 tag

9 years agonginx-1.11.1-RELEASE release-1.11.1
Maxim Dounin [Tue, 31 May 2016 13:43:49 +0000 (16:43 +0300)]
nginx-1.11.1-RELEASE

9 years agoCore: skip special buffers on writing (ticket #981).
Maxim Dounin [Tue, 31 May 2016 02:13:30 +0000 (05:13 +0300)]
Core: skip special buffers on writing (ticket #981).

A special last buffer with cl->buf->pos set to NULL can be present in
a chain when writing request body if chunked encoding was used.  This
resulted in a NULL pointer dereference if it happened to be the only
buffer left after a do...while loop iteration in ngx_write_chain_to_file().

The problem originally appeared in nginx 1.3.9 with chunked encoding
support.  Additionally, rev. 3832b608dc8d (nginx 1.9.13) changed the
minimum number of buffers to trigger this from IOV_MAX (typically 1024)
to NGX_IOVS_PREALLOCATE (typically 64).

Fix is to skip such buffers in ngx_chain_to_iovec(), much like it is
done in other places.

9 years agoTrailing spaces removed.
Maxim Dounin [Mon, 30 May 2016 15:09:41 +0000 (18:09 +0300)]
Trailing spaces removed.

9 years agoHTTP/2: unbreak build on MSVC.
Valentin Bartenev [Tue, 24 May 2016 18:54:32 +0000 (21:54 +0300)]
HTTP/2: unbreak build on MSVC.

9 years agoVersion bump.
Valentin Bartenev [Tue, 24 May 2016 18:54:32 +0000 (21:54 +0300)]
Version bump.

9 years agorelease-1.11.0 tag
Maxim Dounin [Tue, 24 May 2016 15:54:42 +0000 (18:54 +0300)]
release-1.11.0 tag

9 years agonginx-1.11.0-RELEASE release-1.11.0
Maxim Dounin [Tue, 24 May 2016 15:54:41 +0000 (18:54 +0300)]
nginx-1.11.0-RELEASE

9 years agoUpdated OpenSSL used for win32 builds.
Maxim Dounin [Tue, 24 May 2016 14:44:01 +0000 (17:44 +0300)]
Updated OpenSSL used for win32 builds.

9 years agoFixed build on MSVC.
Maxim Dounin [Tue, 24 May 2016 14:43:58 +0000 (17:43 +0300)]
Fixed build on MSVC.

9 years agoHTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev [Tue, 24 May 2016 14:37:52 +0000 (17:37 +0300)]
HTTP/2: implemented preread buffer for request body (closes #959).

Previously, the stream's window was kept zero in order to prevent a client
from sending the request body before it was requested (see 887cca40ba6a for
details).  Until such initial window was acknowledged all requests with
data were rejected (see 0aa07850922f for details).

That approach revealed a number of problems:

 1. Some clients (notably MS IE/Edge, Safari, iOS applications) show an error
    or even crash if a stream is rejected;

 2. This requires at least one RTT for every request with body before the
    client receives window update and able to send data.

To overcome these problems the new directive "http2_body_preread_size" is
introduced.  It sets the initial window and configures a special per stream
preread buffer that is used to save all incoming data before the body is
requested and processed.

If the directive's value is lower than the default initial window (65535),
as previously, all streams with data will be rejected until the new window
is acknowledged.  Otherwise, no special processing is used and all requests
with data are welcome right from the connection start.

The default value is chosen to be 64k, which is bigger than the default
initial window.  Setting it to zero is fully complaint to the previous
behavior.

9 years agoRealip: detect duplicate real_ip_header directive.
Ruslan Ermilov [Mon, 23 May 2016 16:17:24 +0000 (19:17 +0300)]
Realip: detect duplicate real_ip_header directive.

9 years agoRealip: port support in X-Real-IP and X-Forwarded-For.
Dmitry Volyntsev [Mon, 23 May 2016 15:44:23 +0000 (18:44 +0300)]
Realip: port support in X-Real-IP and X-Forwarded-For.

Now, the module extracts optional port which may accompany an
IP address.  This custom extension is introduced, among other
things, in order to facilitate logging of original client ports.
Addresses with ports are expected to be in the RFC 3986 format,
that is, with IPv6 addresses in square brackets.  E.g.,
"X-Real-IP: [2001:0db8::1]:12345" sets client port ($remote_port)
to 12345.

9 years agoRealip: take client port from PROXY protocol header.
Dmitry Volyntsev [Mon, 23 May 2016 15:44:22 +0000 (18:44 +0300)]
Realip: take client port from PROXY protocol header.

Previously, when the client address was changed to the one from
the PROXY protocol header, the client port ($remote_port) was
reset to zero.  Now the client port is also changed to the one
from the PROXY protocol header.

9 years agoAdded the $realip_remote_port variable.
Dmitry Volyntsev [Mon, 23 May 2016 15:44:22 +0000 (18:44 +0300)]
Added the $realip_remote_port variable.

9 years agoAdded the $proxy_protocol_port variable.
Dmitry Volyntsev [Mon, 23 May 2016 15:44:21 +0000 (18:44 +0300)]
Added the $proxy_protocol_port variable.

9 years agoRenamed "u" to "sockaddr" in listen options types.
Maxim Dounin [Mon, 23 May 2016 13:37:28 +0000 (16:37 +0300)]
Renamed "u" to "sockaddr" in listen options types.

9 years agoIntroduced the ngx_sockaddr_t type.
Ruslan Ermilov [Mon, 23 May 2016 13:37:20 +0000 (16:37 +0300)]
Introduced the ngx_sockaddr_t type.

It's properly aligned and can hold any supported sockaddr.

9 years agoStream: fixed duplicate listen address detection.
Ruslan Ermilov [Mon, 23 May 2016 09:50:59 +0000 (12:50 +0300)]
Stream: fixed duplicate listen address detection.

The 6f8254ae61b8 change inadvertently fixed the duplicate port
detection similar to how it was fixed for mail in b2920b517490.
It also revealed another issue: the socket type (tcp vs. udp)
wasn't taken into account.

9 years agoUse ngx_cmp_sockaddr() where appropriate.
Ruslan Ermilov [Fri, 20 May 2016 16:10:42 +0000 (19:10 +0300)]
Use ngx_cmp_sockaddr() where appropriate.

9 years agoHTTP/2: the "421 Misdirected Request" response (closes #848).
Valentin Bartenev [Fri, 20 May 2016 15:41:17 +0000 (18:41 +0300)]
HTTP/2: the "421 Misdirected Request" response (closes #848).

Since 4fbef397c753 nginx rejects with the 400 error any attempts of
requesting different host over the same connection, if the relevant
virtual server requires verification of a client certificate.

While requesting hosts other than negotiated isn't something legal
in HTTP/1.x, the HTTP/2 specification explicitly permits such requests
for connection reuse and has introduced a special response code 421.

According to RFC 7540 Section 9.1.2 this code can be sent by a server
that is not configured to produce responses for the combination of
scheme and authority that are included in the request URI.  And the
client may retry the request over a different connection.

Now this code is used for requests that aren't authorized in current
connection.  After receiving the 421 response a client will be able
to open a new connection, provide the required certificate and retry
the request.

Unfortunately, not all clients currently are able to handle it well.
Notably Chrome just shows an error, while at least the latest version
of Firefox retries the request over a new connection.

9 years agoBelatedly changed the ngx_create_listening() prototype.
Ruslan Ermilov [Fri, 20 May 2016 14:02:04 +0000 (17:02 +0300)]
Belatedly changed the ngx_create_listening() prototype.

The function is called only with "struct sockaddr *" since 0.7.58.

9 years agoSSL: removed default DH parameters.
Maxim Dounin [Thu, 19 May 2016 11:46:32 +0000 (14:46 +0300)]
SSL: removed default DH parameters.

Using the same DH parameters on multiple servers is believed to be subject
to precomputation attacks, see http://weakdh.org/.  Additionally, 1024 bits
are not enough in the modern world as well.  Let users provide their own
DH parameters with the ssl_dhparam directive if they want to use EDH ciphers.

Note that SSL_CTX_set_dh_auto() as provided by OpenSSL 1.1.0 uses fixed
DH parameters from RFC 5114 and RFC 3526, and therefore subject to the same
precomputation attacks.  We avoid using it as well.

This change also fixes compilation with OpenSSL 1.1.0-pre5 (aka Beta 2),
as OpenSSL developers changed their policy after releasing Beta 1 and
broke API once again by making the DH struct opaque (see ticket #860).

9 years agoSSL: support for multiple curves (ticket #885).
Maxim Dounin [Thu, 19 May 2016 11:46:32 +0000 (14:46 +0300)]
SSL: support for multiple curves (ticket #885).

OpenSSL 1.0.2+ allows configuring a curve list instead of a single curve
previously supported.  This allows use of different curves depending on
what client supports (as available via the elliptic_curves extension),
and also allows use of different curves in an ECDHE key exchange and
in the ECDSA certificate.

The special value "auto" was introduced (now the default for ssl_ecdh_curve),
which means "use an internal list of curves as available in the OpenSSL
library used".  For versions prior to OpenSSL 1.0.2 it maps to "prime256v1"
as previously used.  The default in 1.0.2b+ prefers prime256v1 as well
(and X25519 in OpenSSL 1.1.0+).

As client vs. server preference of curves is controlled by the
same option as used for ciphers (SSL_OP_CIPHER_SERVER_PREFERENCE),
the ssl_prefer_server_ciphers directive now controls both.

9 years agoSSL: style.
Maxim Dounin [Thu, 19 May 2016 11:46:32 +0000 (14:46 +0300)]
SSL: style.

9 years agoSSL: error messages style.
Maxim Dounin [Thu, 19 May 2016 11:46:32 +0000 (14:46 +0300)]
SSL: error messages style.

9 years agoSSL: support for multiple certificates (ticket #814).
Maxim Dounin [Thu, 19 May 2016 11:46:32 +0000 (14:46 +0300)]
SSL: support for multiple certificates (ticket #814).

9 years agoSSL: support for per-certificate chains.
Maxim Dounin [Thu, 19 May 2016 11:46:32 +0000 (14:46 +0300)]
SSL: support for per-certificate chains.

The SSL_CTX_add0_chain_cert() function as introduced in OpenSSL 1.0.2 now
used instead of SSL_CTX_add_extra_chain_cert().

SSL_CTX_add_extra_chain_cert() adds extra certs for all certificates
in the context, while SSL_CTX_add0_chain_cert() only to a particular
certificate.  There is no difference unless multiple certificates are used,
though it is important when using multiple certificates.

Additionally, SSL_CTX_select_current_cert() is now called before using
a chain to make sure correct chain will be returned.

9 years agoSSL: made it possible to iterate though all certificates.
Maxim Dounin [Thu, 19 May 2016 11:46:32 +0000 (14:46 +0300)]
SSL: made it possible to iterate though all certificates.

A pointer to a previously configured certificate now stored in a certificate.
This makes it possible to iterate though all certificates configured in
the SSL context.  This is now used to configure OCSP stapling for all
certificates, and in ngx_ssl_session_id_context().

As SSL_CTX_use_certificate() frees previously loaded certificate of the same
type, and we have no way to find out if it's the case, X509_free() calls
are now posponed till ngx_ssl_cleanup_ctx().

Note that in OpenSSL 1.0.2+ this can be done without storing things in exdata
using the SSL_CTX_set_current_cert() and SSL_CTX_get0_certificate() functions.
These are not yet available in all supported versions though, so it's easier
to continue to use exdata for now.

9 years agoOCSP stapling: additional function to configure stapling on a cert.
Maxim Dounin [Thu, 19 May 2016 11:46:32 +0000 (14:46 +0300)]
OCSP stapling: additional function to configure stapling on a cert.

9 years agoOCSP stapling: staple now extracted via SSL_get_certificate().
Maxim Dounin [Thu, 19 May 2016 11:46:32 +0000 (14:46 +0300)]
OCSP stapling: staple now extracted via SSL_get_certificate().

This makes it possible to properly return OCSP staple with multiple
certificates configured.

Note that it only works properly in OpenSSL 1.0.1d+, 1.0.0k, 0.9.8y+.
In older versions SSL_get_certificate() fails to return correct certificate
when the certificate status callback is called.

9 years agoOCSP stapling: staple now stored in certificate, not SSL context.
Maxim Dounin [Thu, 19 May 2016 11:46:32 +0000 (14:46 +0300)]
OCSP stapling: staple now stored in certificate, not SSL context.

9 years agoOCSP stapling: staple provided in arguments.
Maxim Dounin [Thu, 19 May 2016 11:46:32 +0000 (14:46 +0300)]
OCSP stapling: staple provided in arguments.

9 years agoAdded overflow checks for version numbers (ticket #762).
Maxim Dounin [Wed, 18 May 2016 13:21:32 +0000 (16:21 +0300)]
Added overflow checks for version numbers (ticket #762).

Both minor and major versions are now limited to 999 maximum.  In case of
r->http_minor, this limit is already implied by the code.  Major version,
r->http_major, in theory can be up to 65535 with current code, but such
values are very unlikely to become real (and, additionally, such values
are not allowed by RFC 7230), so the same test was used for r->http_major.

9 years agoEvents: close descriptors on errors in ngx_epoll_test_rdhup().
Maxim Dounin [Wed, 18 May 2016 12:57:30 +0000 (15:57 +0300)]
Events: close descriptors on errors in ngx_epoll_test_rdhup().

9 years agoEvents: changed ngx_epoll_test_rdhup() to use existing epollfd.
Maxim Dounin [Wed, 18 May 2016 12:57:29 +0000 (15:57 +0300)]
Events: changed ngx_epoll_test_rdhup() to use existing epollfd.

9 years agoFixed work with --test-build-epoll after f7849bfb6d21.
Maxim Dounin [Wed, 18 May 2016 12:57:28 +0000 (15:57 +0300)]
Fixed work with --test-build-epoll after f7849bfb6d21.

9 years agoCache: fixed updating bypassed cached errors (ticket #827).
Maxim Dounin [Mon, 16 May 2016 17:37:38 +0000 (20:37 +0300)]
Cache: fixed updating bypassed cached errors (ticket #827).

9 years agoDav: return 501 on PUT with ranges (ticket #948).
Maxim Dounin [Mon, 16 May 2016 17:37:23 +0000 (20:37 +0300)]
Dav: return 501 on PUT with ranges (ticket #948).

9 years agoFixed an error log message about epoll_wait() timeout.
Valentin Bartenev [Mon, 16 May 2016 13:22:34 +0000 (16:22 +0300)]
Fixed an error log message about epoll_wait() timeout.

The errno value is unset in case of epoll_wait() timeout.

10 years agoImproved EPOLLRDHUP handling.
Valentin Bartenev [Fri, 13 May 2016 14:19:23 +0000 (17:19 +0300)]
Improved EPOLLRDHUP handling.

When it's known that the kernel supports EPOLLRDHUP, there is no need in
additional recv() call to get EOF or error when the flag is absent in the
event generated by the kernel.  A special runtime test is done at startup
to detect if EPOLLRDHUP is actually supported by the kernel because
epoll_ctl() silently ignores unknown flags.

With this knowledge it's now possible to drop the "ready" flag for partial
read.  Previously, the "ready" flag was kept until the recv() returned EOF
or error.  In particular, this change allows the lingering close heuristics
(which relies on the "ready" flag state) to actually work on Linux, and not
wait for more data in most cases.

The "available" flag is now used in the read event with the semantics similar
to the corresponding counter in kqueue.

10 years agoMap: support of complex values in resulting strings.
Dmitry Volyntsev [Thu, 12 May 2016 13:43:19 +0000 (16:43 +0300)]
Map: support of complex values in resulting strings.

10 years agoRemoved a surplus condition from ngx_parse_inet6_url().
Ruslan Ermilov [Wed, 11 May 2016 14:55:30 +0000 (17:55 +0300)]
Removed a surplus condition from ngx_parse_inet6_url().

No functional changes, since the condition was always true.

10 years agoCore: fixed port handling in ngx_parse_inet6_url().
Valentin Bartenev [Wed, 11 May 2016 14:55:20 +0000 (17:55 +0300)]
Core: fixed port handling in ngx_parse_inet6_url().

This fixes buffer over-read when no port is specified in cases
similar to 5df5d7d771f6, and catches missing port separator.

10 years agoRemoved unused flag unexpected_eof from ngx_connection_t.
Ruslan Ermilov [Thu, 28 Apr 2016 13:30:19 +0000 (16:30 +0300)]
Removed unused flag unexpected_eof from ngx_connection_t.

10 years agoVariable $request_id.
Vladimir Homutov [Tue, 26 Apr 2016 16:31:46 +0000 (19:31 +0300)]
Variable $request_id.

The variable contains text representation based on random data, usable as
a unique request identifier.

10 years agoUpstream: the "transparent" parameter of proxy_bind and friends.
Roman Arutyunyan [Fri, 18 Dec 2015 16:05:27 +0000 (19:05 +0300)]
Upstream: the "transparent" parameter of proxy_bind and friends.

This parameter lets binding the proxy connection to a non-local address.
Upstream will see the connection as coming from that address.
When used with $remote_addr, upstream will accept the connection from real
client address.

Example:

    proxy_bind $remote_addr transparent;

10 years agoStream: prepared proxy_bind to accept parameters.
Roman Arutyunyan [Wed, 13 Apr 2016 12:42:47 +0000 (15:42 +0300)]
Stream: prepared proxy_bind to accept parameters.

10 years agoUpstream: prepared proxy_bind to accept parameters.
Roman Arutyunyan [Wed, 13 Apr 2016 12:42:46 +0000 (15:42 +0300)]
Upstream: prepared proxy_bind to accept parameters.

In addition, errors occurred while setting bind address are no longer ignored.

10 years agoRemoved some bitrot.
Ruslan Ermilov [Tue, 26 Apr 2016 15:26:43 +0000 (18:26 +0300)]
Removed some bitrot.

Removed NGX_CONF_MULTI unused since 1.3.4.
Removed ngx_url_t.one_addr unused since 1.3.10.

10 years agoVersion bump.
Ruslan Ermilov [Tue, 26 Apr 2016 15:26:18 +0000 (18:26 +0300)]
Version bump.

10 years agorelease-1.9.15 tag
Maxim Dounin [Tue, 19 Apr 2016 16:02:37 +0000 (19:02 +0300)]
release-1.9.15 tag

10 years agonginx-1.9.15-RELEASE release-1.9.15
Maxim Dounin [Tue, 19 Apr 2016 16:02:37 +0000 (19:02 +0300)]
nginx-1.9.15-RELEASE

10 years agoHTTP/2: send the output queue after emitting WINDOW_UPDATE.
Valentin Bartenev [Tue, 19 Apr 2016 14:38:49 +0000 (17:38 +0300)]
HTTP/2: send the output queue after emitting WINDOW_UPDATE.

The WINDOW_UPDATE frame could be left in the output queue for an indefinite
period of time resulting in the request timeout.

This might happen if reading of the body was triggered by an event unrelated
to client connection, e.g. by the limit_req timer.

10 years agoHTTP/2: skip data frames in case of internal errors.
Valentin Bartenev [Tue, 19 Apr 2016 14:38:49 +0000 (17:38 +0300)]
HTTP/2: skip data frames in case of internal errors.

This prevents possible processing of such frames and triggering
rb->post_handler if an error occurred during r->request_body
initialization.

10 years agoHTTP/2: don't send WINDOW_UPDATE for an empty request body.
Valentin Bartenev [Tue, 19 Apr 2016 14:38:49 +0000 (17:38 +0300)]
HTTP/2: don't send WINDOW_UPDATE for an empty request body.

Particularly this prevents sending WINDOW_UPDATE with zero delta
which can result in PROTOCOL_ERROR.

Also removed surplus setting of no_flow_control to 0.

10 years agoThread pools: memory barriers in task completion notifications.
Maxim Dounin [Tue, 19 Apr 2016 14:18:28 +0000 (17:18 +0300)]
Thread pools: memory barriers in task completion notifications.

The ngx_thread_pool_done object isn't volatile, and at least some
compilers assume that it is permitted to reorder modifications of
volatile and non-volatile objects.  Added appropriate ngx_memory_barrier()
calls to make sure all modifications will happen before the lock is released.

Reported by Mindaugas Rasiukevicius,
http://mailman.nginx.org/pipermail/nginx-devel/2016-April/008160.html.

10 years agoHTTP/2: write logs when refusing streams with data.
Maxim Dounin [Mon, 18 Apr 2016 18:18:24 +0000 (21:18 +0300)]
HTTP/2: write logs when refusing streams with data.

Refusing streams is known to be incorrectly handled at least by IE, Edge
and Safari.  Make sure to provide appropriate logging to simplify fixing
this in the affected browsers.

10 years agoHTTP/2: send WINDOW_UPDATE instead of RST_STREAM with NO_ERROR.
Valentin Bartenev [Thu, 14 Apr 2016 12:14:15 +0000 (15:14 +0300)]
HTTP/2: send WINDOW_UPDATE instead of RST_STREAM with NO_ERROR.

After the 92464ebace8e change, it has been discovered that not all
clients follow the RFC and handle RST_STREAM with NO_ERROR properly.

Notably, Chrome currently interprets it as INTERNAL_ERROR and discards
the response.

As a workaround, instead of RST_STREAM the maximum stream window update
will be sent, which will let client to send up to 2 GB of a request body
data before getting stuck on flow control.  All the received data will
be silently discarded.

See for details:
http://mailman.nginx.org/pipermail/nginx-devel/2016-April/008143.html
https://bugs.chromium.org/p/chromium/issues/detail?id=603182

10 years agoHTTP/2: refuse streams with data until SETTINGS is acknowledged.
Valentin Bartenev [Thu, 14 Apr 2016 12:14:15 +0000 (15:14 +0300)]
HTTP/2: refuse streams with data until SETTINGS is acknowledged.

A client is allowed to send requests before receiving and acknowledging
the SETTINGS frame.  Such a client having a wrong idea about the stream's
could send the request body that nginx isn't ready to process.

The previous behavior was to send RST_STREAM with FLOW_CONTROL_ERROR in
such case, but it didn't allow retrying requests that have been rejected.

10 years agoHTTP/2: deduplicated some code in ngx_http_v2_state_headers().
Valentin Bartenev [Thu, 14 Apr 2016 12:14:15 +0000 (15:14 +0300)]
HTTP/2: deduplicated some code in ngx_http_v2_state_headers().

No functional changes.

10 years agoFastCGI: skip special bufs in buffered request body chain.
Valentin Bartenev [Mon, 11 Apr 2016 15:42:34 +0000 (18:42 +0300)]
FastCGI: skip special bufs in buffered request body chain.

This prevents forming empty records out of such buffers.  Particularly it fixes
double end-of-stream records with chunked transfer encoding, or when HTTP/2 is
used and the END_STREAM flag has been sent without data.  In both cases there
is an empty buffer at the end of the request body chain with the "last_buf"
flag set.

The canonical libfcgi, as well as php implementation, tolerates such records,
while the HHVM parser is more strict and drops the connection (ticket #950).

10 years agoFixed NGX_CONF_TAKE1/NGX_CONF_FLAG misuse (as in e444e8f6538b).
Ruslan Ermilov [Tue, 12 Apr 2016 16:01:56 +0000 (19:01 +0300)]
Fixed NGX_CONF_TAKE1/NGX_CONF_FLAG misuse (as in e444e8f6538b).

10 years agoFixed typos.
Alessandro Ghedini [Mon, 11 Apr 2016 15:47:11 +0000 (16:47 +0100)]
Fixed typos.

10 years agoRemoved redundant "u" format specifier.
Ruslan Ermilov [Fri, 8 Apr 2016 12:03:38 +0000 (15:03 +0300)]
Removed redundant "u" format specifier.

It is implied for "x" and "X".

10 years agoSimplified ngx_unix_recv() and ngx_readv_chain().
Ruslan Ermilov [Fri, 8 Apr 2016 13:49:35 +0000 (16:49 +0300)]
Simplified ngx_unix_recv() and ngx_readv_chain().

This makes ngx_unix_recv() and ngx_udp_unix_recv() differ minimally.

10 years agoMerged implementations of ngx_unix_recv().
Valentin Bartenev [Fri, 8 Apr 2016 13:41:45 +0000 (16:41 +0300)]
Merged implementations of ngx_unix_recv().

There's no real need in two separate implementations,
with and without kqueue support.

10 years agoFixed small inconsistency in handling EOF among receive functions.
Valentin Bartenev [Fri, 8 Apr 2016 13:39:49 +0000 (16:39 +0300)]
Fixed small inconsistency in handling EOF among receive functions.

Now all functions always drop the ready flag in this case.

10 years agoMerged implementations of ngx_udp_unix_recv().
Valentin Bartenev [Fri, 8 Apr 2016 13:38:42 +0000 (16:38 +0300)]
Merged implementations of ngx_udp_unix_recv().

There's no real need in two separate implementations,
with and without kqueue support.

10 years agoFixed spelling.
Josh Soref [Thu, 7 Apr 2016 08:50:13 +0000 (11:50 +0300)]
Fixed spelling.

10 years agoVersion bump.
Ruslan Ermilov [Thu, 7 Apr 2016 16:09:42 +0000 (19:09 +0300)]
Version bump.

10 years agorelease-1.9.14 tag
Maxim Dounin [Tue, 5 Apr 2016 14:57:08 +0000 (17:57 +0300)]
release-1.9.14 tag

10 years agonginx-1.9.14-RELEASE release-1.9.14
Maxim Dounin [Tue, 5 Apr 2016 14:57:08 +0000 (17:57 +0300)]
nginx-1.9.14-RELEASE

10 years agoCompatibility with FreeBSD 2.2.9.
Maxim Dounin [Fri, 1 Apr 2016 13:38:31 +0000 (16:38 +0300)]
Compatibility with FreeBSD 2.2.9.

Added (RTLD_NOW | RTLD_GLOBAL) to dlopen() test.  There is no RTLD_GLOBAL
on FreeBSD 2.2.9.

Added uint32_t test, with fallback to u_int32_t, similar to uint64_t one.
Added fallback to u_int32_t in in_addr_t test.

With these changes it is now possible to compile nginx on FreeBSD 2.2.9
with only few minor warnings (assuming -Wno-error).

10 years agoConfigure: improved multiple types handling in auto/types/typedef.
Maxim Dounin [Fri, 1 Apr 2016 13:38:30 +0000 (16:38 +0300)]
Configure: improved multiple types handling in auto/types/typedef.

10 years agoConfigure: fixed autotest source code logging.
Maxim Dounin [Fri, 1 Apr 2016 13:38:28 +0000 (16:38 +0300)]
Configure: fixed autotest source code logging.

Fixed a regression introduced in rev. 434548349838 that prevented
auto/types/sizeof and auto/types/typedef properly reporting autotest
source code to autoconf.err in case of test failure.