]> git.kaiwu.me - nginx.git/log
nginx.git
9 years agoCore: introduced ngx_cidr_match() function.
Dmitry Volyntsev [Wed, 7 Sep 2016 10:56:53 +0000 (13:56 +0300)]
Core: introduced ngx_cidr_match() function.

9 years agoStream: allow using the session context inside handlers.
Dmitry Volyntsev [Tue, 6 Sep 2016 18:28:17 +0000 (21:28 +0300)]
Stream: allow using the session context inside handlers.

Previously, it was not possible to use the stream context
inside ngx_stream_init_connection() handlers.  Now, limit_conn,
access handlers, as well as those added later, can create
their own contexts.

9 years agoStream: $proxy_protocol_addr and $proxy_protocol_port.
Dmitry Volyntsev [Tue, 6 Sep 2016 18:28:16 +0000 (21:28 +0300)]
Stream: $proxy_protocol_addr and $proxy_protocol_port.

9 years agoStream: the "proxy_protocol" parameter of the "listen" directive.
Dmitry Volyntsev [Tue, 6 Sep 2016 18:28:16 +0000 (21:28 +0300)]
Stream: the "proxy_protocol" parameter of the "listen" directive.

9 years agoStream: postpone session initialization under accept mutex.
Dmitry Volyntsev [Tue, 6 Sep 2016 18:28:13 +0000 (21:28 +0300)]
Stream: postpone session initialization under accept mutex.

Previously, it was possible that some system calls could be
invoked while holding the accept mutex.  This is clearly
wrong as it prevents incoming connections from being accepted
as quickly as possible.

9 years agoStream: log module.
Vladimir Homutov [Mon, 5 Sep 2016 14:50:16 +0000 (17:50 +0300)]
Stream: log module.

9 years agoStream: upstream response time variables.
Vladimir Homutov [Fri, 2 Sep 2016 15:27:12 +0000 (18:27 +0300)]
Stream: upstream response time variables.

The $upstream_connect_time, $upstream_first_byte_time and
$upstream_session_time variables keep corresponding times.

9 years agoStream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov [Fri, 2 Sep 2016 15:27:08 +0000 (18:27 +0300)]
Stream: $upstream_bytes_sent and $upstream_bytes_received.

9 years agoStream: the $upstream_addr variable.
Vladimir Homutov [Fri, 2 Sep 2016 15:27:05 +0000 (18:27 +0300)]
Stream: the $upstream_addr variable.

Keeps the full address of the upstream server.  If several servers were
contacted during proxying, their addresses are separated by commas,
e.g. "192.168.1.1:80, 192.168.1.2:80".

9 years agoStream: the $status variable.
Roman Arutyunyan [Thu, 11 Aug 2016 17:22:23 +0000 (20:22 +0300)]
Stream: the $status variable.

The stream session status is one of the following:

200 - normal completion
403 - access forbidden
500 - internal server error
502 - bad gateway
503 - limit conn

9 years agoEvent pipe: do not set file's thread_handler if not needed.
Maxim Dounin [Thu, 1 Sep 2016 17:05:23 +0000 (20:05 +0300)]
Event pipe: do not set file's thread_handler if not needed.

This fixes a problem with aio threads and sendfile with aio_write switched
off, as observed with range requests after fc72784b1f52 (1.9.13).  Potential
problems with sendfile in threads were previously described in 9fd738b85fad,
and this seems to be one of them.

The problem occurred as file's thread_handler was set to NULL by event pipe
code after a sendfile thread task was scheduled.  As a result, no sendfile
completion code was executed, and the same buffer was additionally sent
using non-threaded sendfile.  Fix is to avoid modifying file's thread_handler
if aio_write is switched off.

Note that with "aio_write on" it is still possible that sendfile will use
thread_handler as set by event pipe.  This is believed to be safe though,
as handlers used are compatible.

9 years agoEvent pipe: process data after recv_chain() errors.
Maxim Dounin [Thu, 1 Sep 2016 15:29:55 +0000 (18:29 +0300)]
Event pipe: process data after recv_chain() errors.

When c->recv_chain() returns an error, it is possible that we already
have some data previously read, e.g., in preread buffer.  And in some
cases it may be even a complete response.  Changed c->recv_chain() error
handling to process the data, much like it is already done if kevent
reports about an error.

This change, in particular, fixes processing of small responses
when an upstream fails to properly close a connection with lingering and
therefore the connection is reset, but the response is already fully
obtained by nginx (see ticket #1037).

9 years agoRealip: fixed uninitialized memory access.
Roman Arutyunyan [Thu, 1 Sep 2016 11:33:51 +0000 (14:33 +0300)]
Realip: fixed uninitialized memory access.

Previously, the realip module could be left with uninitialized context after an
error in the ngx_http_realip_set_addr() function.  That context could be later
accessed by $realip_remote_addr and $realip_remote_port variable handlers.

9 years agoStream: the $protocol variable.
Vladimir Homutov [Fri, 26 Aug 2016 12:33:07 +0000 (15:33 +0300)]
Stream: the $protocol variable.

The variable keeps protocol used by the client, "TCP" or "UDP".

9 years agoStream: the $session_time variable.
Vladimir Homutov [Fri, 26 Aug 2016 12:33:04 +0000 (15:33 +0300)]
Stream: the $session_time variable.

The variable keeps time spent on processing the stream session.

9 years agoStream: the $bytes_received variable.
Vladimir Homutov [Fri, 26 Aug 2016 12:33:02 +0000 (15:33 +0300)]
Stream: the $bytes_received variable.

The variable keeps the number of bytes received from the client.

9 years agoThread pools: create threads in detached state.
Piotr Sikora [Mon, 15 Aug 2016 12:52:04 +0000 (05:52 -0700)]
Thread pools: create threads in detached state.

This prevents theoretical resource leak, since those threads are never joined.

Found with ThreadSanitizer.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
9 years agoGeo: fixed indentation.
Sergey Kandaurov [Thu, 25 Aug 2016 09:59:39 +0000 (12:59 +0300)]
Geo: fixed indentation.

9 years agoContrib: unicode2nginx compatibility with recent Perl versions.
Maxim Dounin [Wed, 24 Aug 2016 12:53:17 +0000 (15:53 +0300)]
Contrib: unicode2nginx compatibility with recent Perl versions.

In recent Perl versions unpack("C*") unpacks wide characters by default,
likely since perl 5.10 (seen at least in perl 5.20).  Replaced with
unpack("U0C*") instead to unpack bytes.

While here, improved style and updated my email.

9 years agoGeo: fixed warnings when removing nonexistent ranges.
Ruslan Ermilov [Tue, 23 Aug 2016 12:59:42 +0000 (15:59 +0300)]
Geo: fixed warnings when removing nonexistent ranges.

geo $geo {
    ranges;

    10.0.0.0-10.0.0.255 test;

    delete 10.0.1.0-10.0.1.255;     # should warn

    delete 10.0.0.0-10.0.0.255;
    delete 10.0.0.0-10.0.0.255;     # should warn
}

9 years agoGeo: fixed insertion of ranges specified in descending order.
Ruslan Ermilov [Tue, 23 Aug 2016 12:59:14 +0000 (15:59 +0300)]
Geo: fixed insertion of ranges specified in descending order.

9 years agoGeo: fixed removing a range in certain cases.
Ruslan Ermilov [Tue, 23 Aug 2016 12:59:06 +0000 (15:59 +0300)]
Geo: fixed removing a range in certain cases.

If the range includes two or more /16 networks and does
not start at the /16 boundary, the last subrange was not
removed (see 91cff7f97a50 for details).

9 years agoGeo: fixed overflow when iterating over ranges.
Ruslan Ermilov [Tue, 23 Aug 2016 12:57:29 +0000 (15:57 +0300)]
Geo: fixed overflow when iterating over ranges.

9 years agoSSL: adopted session ticket handling for OpenSSL 1.1.0.
Sergey Kandaurov [Mon, 22 Aug 2016 15:53:21 +0000 (18:53 +0300)]
SSL: adopted session ticket handling for OpenSSL 1.1.0.

Return 1 in the SSL_CTX_set_tlsext_ticket_key_cb() callback function
to indicate that a new session ticket is created, as per documentation.
Until 1.1.0, OpenSSL didn't make a distinction between non-negative
return values.

See https://git.openssl.org/?p=openssl.git;a=commitdiff;h=5c753de for details.

9 years agoSSL: remove no longer needed workaround for BoringSSL.
Piotr Sikora [Thu, 18 Aug 2016 21:49:48 +0000 (14:49 -0700)]
SSL: remove no longer needed workaround for BoringSSL.

BoringSSL added a no-op stub for OPENSSL_config() on 2016-01-26.

Requested by David Benjamin.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
9 years agoEvents: fixed setting of IP_BIND_ADDRESS_NO_PORT/SO_REUSEADDR.
Ruslan Ermilov [Mon, 22 Aug 2016 08:40:10 +0000 (11:40 +0300)]
Events: fixed setting of IP_BIND_ADDRESS_NO_PORT/SO_REUSEADDR.

The IP_BIND_ADDRESS_NO_PORT option is set on upstream sockets
if proxy_bind does not specify a port.  The SO_REUSEADDR option
is set on UDP upstream sockets if proxy_bind specifies a port.

Due to checking of the wrong port, IP_BIND_ADDRESS_NO_PORT was
never set, and SO_REUSEPORT was always set.

9 years agoEnsure "listen" exists in a mail or stream server (ticket #1049).
Roman Arutyunyan [Wed, 17 Aug 2016 08:26:51 +0000 (11:26 +0300)]
Ensure "listen" exists in a mail or stream server (ticket #1049).

9 years agoFixed wrong type of the "line" field.
Roman Arutyunyan [Thu, 18 Aug 2016 14:13:07 +0000 (17:13 +0300)]
Fixed wrong type of the "line" field.

The new type ngx_uint_t was supposed when formatting the line number.

9 years agoGeo: fixed access to already freed memory.
Valentin Bartenev [Thu, 18 Aug 2016 14:11:03 +0000 (17:11 +0300)]
Geo: fixed access to already freed memory.

Previously, in "ranges" mode when all added ranges were deleted,
the ctx.high.low[i] was left pointing to a temporary array.

9 years agoUpstream: the $upstream_bytes_received variable.
Vladimir Homutov [Wed, 10 Aug 2016 13:46:39 +0000 (16:46 +0300)]
Upstream: the $upstream_bytes_received variable.

Unlike $upstream_response_length that only counts the body size,
the new variable also counts the size of response header and data
received after switching protocols when proxying WebSockets.

9 years agoSimplified extraction of current time.
Ruslan Ermilov [Mon, 8 Aug 2016 14:11:29 +0000 (17:11 +0300)]
Simplified extraction of current time.

9 years agoSSL: guarded SSL_R_NO_CIPHERS_PASSED not present in OpenSSL 1.1.0.
Sergey Kandaurov [Mon, 8 Aug 2016 10:44:49 +0000 (13:44 +0300)]
SSL: guarded SSL_R_NO_CIPHERS_PASSED not present in OpenSSL 1.1.0.

It was removed in OpenSSL 1.1.0 Beta 3 (pre-release 6).  It was
not used since OpenSSL 1.0.1n and 1.0.2b.

9 years agoAlways seed PRNG with PID, seconds, and milliseconds.
Ruslan Ermilov [Thu, 4 Aug 2016 20:43:10 +0000 (23:43 +0300)]
Always seed PRNG with PID, seconds, and milliseconds.

9 years agoFixed undefined behavior when left shifting signed integer.
Ruslan Ermilov [Thu, 4 Aug 2016 20:42:00 +0000 (23:42 +0300)]
Fixed undefined behavior when left shifting signed integer.

9 years agoWin32: added per-thread random seeding.
Ruslan Ermilov [Wed, 3 Aug 2016 22:15:41 +0000 (01:15 +0300)]
Win32: added per-thread random seeding.

The change in b91bcba29351 was not enough to fix random() seeding.
On Windows, the srand() seeds the PRNG only in the current thread,
and worse, is not inherited from the calling thread.  Due to this,
worker threads were not properly seeded.

Reported by Marc Bevand.

9 years agoStream: fixed build without stream_ssl_module (ticket #1032).
Vladimir Homutov [Tue, 26 Jul 2016 16:34:12 +0000 (19:34 +0300)]
Stream: fixed build without stream_ssl_module (ticket #1032).

9 years agoVersion bump.
Vladimir Homutov [Tue, 26 Jul 2016 16:07:18 +0000 (19:07 +0300)]
Version bump.

9 years agorelease-1.11.3 tag
Maxim Dounin [Tue, 26 Jul 2016 13:58:58 +0000 (16:58 +0300)]
release-1.11.3 tag

9 years agonginx-1.11.3-RELEASE release-1.11.3
Maxim Dounin [Tue, 26 Jul 2016 13:58:58 +0000 (16:58 +0300)]
nginx-1.11.3-RELEASE

9 years agoFixed regex captures handling without PCRE.
Vladimir Homutov [Wed, 6 Jul 2016 11:33:40 +0000 (14:33 +0300)]
Fixed regex captures handling without PCRE.

If PCRE is disabled, captures were treated as normal variables in
ngx_http_script_compile(), while code calculating flushes array length in
ngx_http_compile_complex_value() did not account captures as variables.
This could lead to write outside of the array boundary when setting
last element to -1.

Found with AddressSanitizer.

9 years agoStream: variables in proxy_pass and proxy_ssl_name.
Vladimir Homutov [Tue, 14 Jun 2016 15:29:46 +0000 (18:29 +0300)]
Stream: variables in proxy_pass and proxy_ssl_name.

9 years agoHTTP/2: flushing of the SSL buffer in transition to the idle state.
Valentin Bartenev [Tue, 19 Jul 2016 17:34:17 +0000 (20:34 +0300)]
HTTP/2: flushing of the SSL buffer in transition to the idle state.

It fixes potential connection leak if some unsent data was left in the SSL
buffer.  Particularly, that could happen when a client canceled the stream
after the HEADERS frame has already been created.  In this case no other
frames might be produced and the HEADERS frame alone didn't flush the buffer.

9 years agoHTTP/2: refactored ngx_http_v2_send_output_queue().
Valentin Bartenev [Tue, 19 Jul 2016 17:34:02 +0000 (20:34 +0300)]
HTTP/2: refactored ngx_http_v2_send_output_queue().

Now it returns NGX_AGAIN if there's still data to be sent.

9 years agoHTTP/2: fixed send timer handling.
Valentin Bartenev [Tue, 19 Jul 2016 17:31:09 +0000 (20:31 +0300)]
HTTP/2: fixed send timer handling.

Checking for return value of c->send_chain() isn't sufficient since there
are data can be left in the SSL buffer.  Now the wew->ready flag is used
instead.

In particular, this fixed a connection leak in cases when all streams were
closed, but there's still some data to be sent in the SSL buffer and the
client forgot about the connection.

9 years agoHTTP/2: avoid sending output queue if there's nothing to send.
Valentin Bartenev [Tue, 19 Jul 2016 17:30:21 +0000 (20:30 +0300)]
HTTP/2: avoid sending output queue if there's nothing to send.

Particularly this fixes alerts on OS X and NetBSD systems when HTTP/2 is
configured over plain TCP sockets.

On these systems calling writev() with no data leads to EINVAL errors
being logged as "writev() failed (22: Invalid argument) while processing
HTTP/2 connection".

9 years agoHTTP/2: always handle streams in error state.
Valentin Bartenev [Tue, 19 Jul 2016 17:22:44 +0000 (20:22 +0300)]
HTTP/2: always handle streams in error state.

Previously, a stream could be closed by timeout if it was canceled
while its send window was exhausted.

9 years agoHTTP/2: prevented output of the HEADERS frame for canceled streams.
Valentin Bartenev [Tue, 19 Jul 2016 17:22:44 +0000 (20:22 +0300)]
HTTP/2: prevented output of the HEADERS frame for canceled streams.

It's useless to generate HEADERS if the stream has been canceled already.

9 years agoHTTP/2: always send GOAWAY while worker is shutting down.
Valentin Bartenev [Tue, 19 Jul 2016 17:22:44 +0000 (20:22 +0300)]
HTTP/2: always send GOAWAY while worker is shutting down.

Previously, if the worker process exited, GOAWAY was sent to connections in
idle state, but connections with active streams were closed without GOAWAY.

9 years agoEvents: support for EPOLLEXCLUSIVE.
Valentin Bartenev [Fri, 15 Jul 2016 12:18:57 +0000 (15:18 +0300)]
Events: support for EPOLLEXCLUSIVE.

This flag appeared in Linux 4.5 and is useful for avoiding thundering herd
problem.

The current Linux kernel implementation walks the list of exclusive waiters,
and queues an event to each epfd, until it finds the first waiter that has
threads blocked on it via epoll_wait().

9 years agoStyle: sorted epoll flags.
Valentin Bartenev [Fri, 15 Jul 2016 12:18:57 +0000 (15:18 +0300)]
Style: sorted epoll flags.

9 years agoEvents: the "accept_mutex" directive is turned off by default.
Valentin Bartenev [Fri, 15 Jul 2016 12:18:57 +0000 (15:18 +0300)]
Events: the "accept_mutex" directive is turned off by default.

Now it is believed that the accept mutex brings more harm than benefits.
Especially in various benchmarks it often results in situation where only
one worker grabs all connections.

9 years agoStream: split_clients module.
Vladimir Homutov [Tue, 12 Jul 2016 14:34:52 +0000 (17:34 +0300)]
Stream: split_clients module.

9 years agoStream: geo module.
Vladimir Homutov [Thu, 30 Jun 2016 13:12:50 +0000 (16:12 +0300)]
Stream: geo module.

9 years agoStream: geoip module.
Vladimir Homutov [Tue, 12 Jul 2016 14:34:43 +0000 (17:34 +0300)]
Stream: geoip module.

9 years agoStream: style.
Vladimir Homutov [Tue, 12 Jul 2016 14:34:40 +0000 (17:34 +0300)]
Stream: style.

9 years agoStream: individual build options for modules.
Vladimir Homutov [Tue, 12 Jul 2016 09:38:01 +0000 (12:38 +0300)]
Stream: individual build options for modules.

9 years agoHTTP/2: avoid left-shifting signed integer into the sign bit.
Sergey Kandaurov [Thu, 7 Jul 2016 18:03:21 +0000 (21:03 +0300)]
HTTP/2: avoid left-shifting signed integer into the sign bit.

On non-aligned platforms, properly cast argument before left-shifting it in
ngx_http_v2_parse_uint32 that is used with u_char.  Otherwise it propagates
to int to hold the value and can step over the sign bit.  Usually, on known
compilers, this results in negation.  Furthermore, a subsequent store into a
wider type, that is ngx_uint_t on 64-bit platforms, results in sign-extension.

In practice, this can be observed in debug log as a very large exclusive bit
value, when client sent PRIORITY frame with exclusive bit set:

: *14 http2 PRIORITY frame sid:5 on 1 excl:8589934591 weight:17

Found with UndefinedBehaviorSanitizer.

9 years agoAvoid left-shifting integers into the sign bit, which is undefined.
Sergey Kandaurov [Thu, 7 Jul 2016 18:02:28 +0000 (21:02 +0300)]
Avoid left-shifting integers into the sign bit, which is undefined.

Found with UndefinedBehaviorSanitizer.

9 years agoConfigure: stop polluting NGX_ namespace.
Piotr Sikora [Mon, 27 Jun 2016 22:00:06 +0000 (15:00 -0700)]
Configure: stop polluting NGX_ namespace.

While there, fix the only test that used alternative variable name.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
9 years agoConfigure: fix build with -Werror=old-style-definition.
Piotr Sikora [Mon, 27 Jun 2016 22:00:05 +0000 (15:00 -0700)]
Configure: fix build with -Werror=old-style-definition.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
9 years agoConfigure: fix build with -Werror=nonnull.
Piotr Sikora [Mon, 27 Jun 2016 22:00:04 +0000 (15:00 -0700)]
Configure: fix build with -Werror=nonnull.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
9 years agoConfigure: fix build with -Werror=unused-but-set-variable.
Piotr Sikora [Mon, 27 Jun 2016 22:00:03 +0000 (15:00 -0700)]
Configure: fix build with -Werror=unused-but-set-variable.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
9 years agoConfigure: fix build with -Werror=unused-value.
Piotr Sikora [Mon, 27 Jun 2016 22:00:02 +0000 (15:00 -0700)]
Configure: fix build with -Werror=unused-value.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
9 years agoConfigure: style.
Piotr Sikora [Mon, 27 Jun 2016 22:00:01 +0000 (15:00 -0700)]
Configure: style.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
10 years agoConfigure: remove auto/lib/test, unused since nginx-0.1.2.
Piotr Sikora [Sat, 24 Oct 2015 01:21:33 +0000 (18:21 -0700)]
Configure: remove auto/lib/test, unused since nginx-0.1.2.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
9 years agoStream: resolver.
Vladimir Homutov [Thu, 7 Jul 2016 10:15:31 +0000 (13:15 +0300)]
Stream: resolver.

9 years agoUse NGX_MAX_PATH_LEVEL where appropriate.
Ruslan Ermilov [Wed, 6 Jul 2016 10:22:29 +0000 (13:22 +0300)]
Use NGX_MAX_PATH_LEVEL where appropriate.

The macro was unused since 0.7.44.

9 years agoVersion bump.
Ruslan Ermilov [Wed, 6 Jul 2016 10:10:06 +0000 (13:10 +0300)]
Version bump.

9 years agorelease-1.11.2 tag
Maxim Dounin [Tue, 5 Jul 2016 15:56:14 +0000 (18:56 +0300)]
release-1.11.2 tag

9 years agonginx-1.11.2-RELEASE release-1.11.2
Maxim Dounin [Tue, 5 Jul 2016 15:56:14 +0000 (18:56 +0300)]
nginx-1.11.2-RELEASE

9 years agoUpdated PCRE used for win32 builds.
Maxim Dounin [Tue, 5 Jul 2016 15:30:56 +0000 (18:30 +0300)]
Updated PCRE used for win32 builds.

9 years agoStream: return module.
Roman Arutyunyan [Wed, 18 May 2016 19:08:49 +0000 (22:08 +0300)]
Stream: return module.

9 years agoStream: SSL-related variables.
Vladimir Homutov [Wed, 29 Jun 2016 09:52:52 +0000 (12:52 +0300)]
Stream: SSL-related variables.

9 years agoStream: got rid of pseudo variables.
Vladimir Homutov [Wed, 29 Jun 2016 09:46:12 +0000 (12:46 +0300)]
Stream: got rid of pseudo variables.

Stream limit_conn, upstream_hash and proxy modules now use complex values.

9 years agoStream: map module.
Vladimir Homutov [Wed, 29 Jun 2016 09:46:12 +0000 (12:46 +0300)]
Stream: map module.

9 years agoStream: core module variables.
Vladimir Homutov [Tue, 14 Jun 2016 15:28:14 +0000 (18:28 +0300)]
Stream: core module variables.

9 years agoStream: variables and script.
Vladimir Homutov [Mon, 4 Jul 2016 13:37:36 +0000 (16:37 +0300)]
Stream: variables and script.

This is a port of corresponding http code with unrelated features excluded.

9 years agoStream: added preconfiguration step.
Vladimir Homutov [Wed, 15 Jun 2016 12:10:24 +0000 (15:10 +0300)]
Stream: added preconfiguration step.

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.