]> git.kaiwu.me - nginx.git/log
nginx.git
9 years agoProxy: support variables for proxy_method directive.
Dmitry Lazurkin [Sun, 16 Oct 2016 15:24:01 +0000 (18:24 +0300)]
Proxy: support variables for proxy_method directive.

9 years agoSSL: RFC2253 compliant $ssl_client_s_dn and $ssl_client_i_dn.
Dmitry Volyntsev [Fri, 21 Oct 2016 13:28:39 +0000 (16:28 +0300)]
SSL: RFC2253 compliant $ssl_client_s_dn and $ssl_client_i_dn.

Originally, the variables kept a result of X509_NAME_oneline(),
which is, according to the official documentation, a legacy
function.  It produces a non standard output form and has
various quirks and inconsistencies.

The RFC2253 compliant behavior is introduced for these variables.
The original variables are available through $ssl_client_s_dn_legacy
and $ssl_client_i_dn_legacy.

9 years agoImage filter: support for WebP.
Valentin Bartenev [Fri, 21 Oct 2016 12:18:44 +0000 (15:18 +0300)]
Image filter: support for WebP.

In collaboration with Ivan Poluyanov.

9 years agoHTTP/2: graceful shutdown of active connections (closes #1106).
Valentin Bartenev [Thu, 20 Oct 2016 13:15:03 +0000 (16:15 +0300)]
HTTP/2: graceful shutdown of active connections (closes #1106).

Previously, while shutting down gracefully, the HTTP/2 connections were
closed in transition to idle state after all active streams have been
processed.  That might never happen if the client continued opening new
streams.

Now, nginx sends GOAWAY to all HTTP/2 connections and ignores further
attempts to open new streams.  A worker process will quit as soon as
processing of already opened streams is finished.

9 years agoSSL: compatibility with BoringSSL.
Maxim Dounin [Wed, 19 Oct 2016 15:36:50 +0000 (18:36 +0300)]
SSL: compatibility with BoringSSL.

BoringSSL changed SSL_set_tlsext_host_name() to be a real function
with a (const char *) argument, so it now triggers a warning due to
conversion from (u_char *).  Added an explicit cast to silence the
warning.

Prodded by Piotr Sikora, Alessandro Ghedini.

9 years agoCore: show file contents only once while dumping configuration.
Vladimir Homutov [Tue, 18 Oct 2016 13:33:38 +0000 (16:33 +0300)]
Core: show file contents only once while dumping configuration.

Files are considered the same if the path used by nginx during parsing matches.

9 years agoSSL: overcame possible buffer over-read in ngx_ssl_error().
Valentin Bartenev [Tue, 18 Oct 2016 17:46:06 +0000 (20:46 +0300)]
SSL: overcame possible buffer over-read in ngx_ssl_error().

It appeared that ERR_error_string_n() cannot handle zero buffer size well enough
and causes over-read.

The problem has also been fixed in OpenSSL:
https://git.openssl.org/?p=openssl.git;h=e5c1361580d8de79682958b04a5f0d262e680f8b

9 years agoMail: support SASL EXTERNAL (RFC 4422).
Rob N ★ [Sat, 8 Oct 2016 07:05:00 +0000 (18:05 +1100)]
Mail: support SASL EXTERNAL (RFC 4422).

This is needed to allow TLS client certificate auth to work. With
ssl_verify_client configured, the auth daemon can choose to allow the
connection to proceed based on the certificate data.

This has been tested with Thunderbird for IMAP only. I've not yet found a
client that will do client certificate auth for POP3 or SMTP, and the method is
not really documented anywhere that I can find. That said, its simple enough
that the way I've done is probably right.

9 years agoMail: extensible auth methods in pop3 module.
Maxim Dounin [Tue, 18 Oct 2016 16:38:46 +0000 (19:38 +0300)]
Mail: extensible auth methods in pop3 module.

9 years agoUpstream: handling of proxy_set_header at http level.
Maxim Dounin [Fri, 14 Oct 2016 16:48:26 +0000 (19:48 +0300)]
Upstream: handling of proxy_set_header at http level.

When headers are set at the "http" level and not redefined in
a server block, we now preserve conf->headers into the "http"
section configuration to inherit it to all servers.

The same applies to conf->headers_cache, though it may not be effective
if no servers use cache at the "server" level as conf->headers_cache
is only initialized if cache is enabled on a given level.

Similar changes made in fastcgi/scgi/uwsgi to preserve conf->params
and conf->params_cache.

9 years agoProxy: do not create conf->headers_source when not needed.
Maxim Dounin [Fri, 14 Oct 2016 16:48:26 +0000 (19:48 +0300)]
Proxy: do not create conf->headers_source when not needed.

9 years agoUpstream: hide_headers_hash handling at http level.
Maxim Dounin [Fri, 14 Oct 2016 16:48:26 +0000 (19:48 +0300)]
Upstream: hide_headers_hash handling at http level.

When headers to hide are set at the "http" level and not redefined in
a server block, we now preserve compiled headers hash into the "http"
section configuration to inherit this hash to all servers.

9 years agoUpstream: hide_headers_hash inherited regardless of cache settings.
Maxim Dounin [Fri, 14 Oct 2016 16:48:26 +0000 (19:48 +0300)]
Upstream: hide_headers_hash inherited regardless of cache settings.

Dependency on cache settings existed prior to 2728c4e4a9ae (0.8.44)
as Set-Cookie header was automatically hidden from responses when
using cache.  This is no longer the case, and hide_headers_hash can
be safely inherited regardless of cache settings.

9 years agoStyle.
Maxim Dounin [Fri, 14 Oct 2016 16:48:26 +0000 (19:48 +0300)]
Style.

9 years agoCache: cache manager debugging.
Ruslan Ermilov [Thu, 13 Oct 2016 12:50:36 +0000 (15:50 +0300)]
Cache: cache manager debugging.

9 years agoVersion bump.
Ruslan Ermilov [Thu, 13 Oct 2016 12:35:48 +0000 (15:35 +0300)]
Version bump.

9 years agorelease-1.11.5 tag
Maxim Dounin [Tue, 11 Oct 2016 15:03:01 +0000 (18:03 +0300)]
release-1.11.5 tag

9 years agonginx-1.11.5-RELEASE release-1.11.5
Maxim Dounin [Tue, 11 Oct 2016 15:03:00 +0000 (18:03 +0300)]
nginx-1.11.5-RELEASE

9 years agoUpdated OpenSSL used for win32 builds.
Maxim Dounin [Tue, 11 Oct 2016 13:52:48 +0000 (16:52 +0300)]
Updated OpenSSL used for win32 builds.

9 years agoModules compatibility: removed dependencies on NGX_MAIL_SSL.
Maxim Dounin [Mon, 10 Oct 2016 15:44:17 +0000 (18:44 +0300)]
Modules compatibility: removed dependencies on NGX_MAIL_SSL.

External structures are now identical regardless of mail SSL module
compiled in or not.

9 years agoModules compatibility: removed dependencies on NGX_STREAM_SSL.
Maxim Dounin [Mon, 10 Oct 2016 15:44:17 +0000 (18:44 +0300)]
Modules compatibility: removed dependencies on NGX_STREAM_SSL.

External structures are now identical regardless of stream SSL module
compiled in or not.

9 years agoModules compatibility: compatibility with NGX_HTTP_SSL.
Maxim Dounin [Mon, 10 Oct 2016 15:44:17 +0000 (18:44 +0300)]
Modules compatibility: compatibility with NGX_HTTP_SSL.

With this change it is now possible to load modules compiled without
the "--with-http_ssl_module" configure option into nginx binary compiled
with it, and vice versa (if a module doesn't use ssl-specific functions),
assuming both use the "--with-compat" option.

9 years agoModules compatibility: compatibility with NGX_HAVE_FILE_AIO.
Maxim Dounin [Mon, 10 Oct 2016 15:44:17 +0000 (18:44 +0300)]
Modules compatibility: compatibility with NGX_HAVE_FILE_AIO.

With this change it is now possible to load modules compiled without
the "--with-file-aio" configure option into nginx binary compiled with it,
and vice versa, assuming both use the "--with-compat" option.

9 years agoModules compatibility: compatibility with NGX_THREADS.
Maxim Dounin [Mon, 10 Oct 2016 15:44:17 +0000 (18:44 +0300)]
Modules compatibility: compatibility with NGX_THREADS.

With this change it is now possible to load modules compiled without
the "--with-threads" configure option into nginx binary compiled with it,
and vice versa (if a module does not use thread-specific functions),
assuming both use the "--with-compat" option.

9 years agoAllowed '-' in method names.
Maxim Dounin [Mon, 10 Oct 2016 13:24:50 +0000 (16:24 +0300)]
Allowed '-' in method names.

It is used at least by SOAP (M-POST method, defined by RFC 2774) and
by WebDAV versioning (VERSION-CONTROL and BASELINE-CONTROL methods,
defined by RFC 3253).

9 years agoCore: sockaddr lengths now respected by ngx_cmp_sockaddr().
Maxim Dounin [Mon, 10 Oct 2016 13:15:41 +0000 (16:15 +0300)]
Core: sockaddr lengths now respected by ngx_cmp_sockaddr().

Linux can return AF_UNIX sockaddrs with partially filled sun_path,
resulting in spurious comparison failures and failed binary upgrades.
Added proper checking of the lengths provided.

Reported by Jan Seda,
http://mailman.nginx.org/pipermail/nginx-devel/2016-September/008832.html.

9 years agoCore: ngx_conf_set_access_slot() user access (ticket #1096).
Maxim Dounin [Fri, 7 Oct 2016 13:59:14 +0000 (16:59 +0300)]
Core: ngx_conf_set_access_slot() user access (ticket #1096).

Previously, user access bits were always set to "rw" unconditionally,
even with "user:r" explicitly specified.  With this change we only add
default user access bits (0600) if they weren't set explicitly.

9 years agoRealip: fixed duplicate processing on redirects (ticket #1098).
Maxim Dounin [Thu, 6 Oct 2016 20:16:05 +0000 (23:16 +0300)]
Realip: fixed duplicate processing on redirects (ticket #1098).

Duplicate processing was possible if the address set by realip was
listed in set_realip_from, and there was an internal redirect so module
context was cleared.  This resulted in exactly the same address being set,
so this wasn't a problem before the $realip_remote_addr variable was
introduced, though now results in incorrect $realip_remote_addr being
picked.

Fix is to use ngx_http_realip_get_module_ctx() to look up module context
even if it was cleared.  Additionally, the order of checks was switched to
check the configuration first as it looks more effective.

9 years agoStream ssl_preread: fixed $ssl_preread_server_name variable.
Sergey Kandaurov [Wed, 5 Oct 2016 15:11:39 +0000 (18:11 +0300)]
Stream ssl_preread: fixed $ssl_preread_server_name variable.

Made sure to set the variable length only after successful SNI parsing.

9 years agoCache: cache manager limits.
Dmitry Volyntsev [Wed, 5 Oct 2016 11:22:30 +0000 (14:22 +0300)]
Cache: cache manager limits.

The new parameters "manager_files", "manager_sleep"
and "manager_threshold" were added to proxy_cache_path
and friends.

Note that ngx_path_manager_pt was changed to return ngx_msec_t
instead of time_t (API change).

9 years agoCore: use c->log while closing connection.
Ruslan Ermilov [Wed, 5 Oct 2016 10:57:43 +0000 (13:57 +0300)]
Core: use c->log while closing connection.

c->pool is not destroyed here since c52408583801.

9 years agoSSL: use X509_check_host() with LibreSSL.
Maxim Dounin [Tue, 4 Oct 2016 14:26:45 +0000 (17:26 +0300)]
SSL: use X509_check_host() with LibreSSL.

Explicit checks for OPENSSL_VERSION_NUMBER replaced with checks
for X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT, thus allowing X509_check_host()
to be used with other libraries.  In particular, X509_check_host() was
introduced in LibreSSL 2.5.0.

9 years agoConfigure: removed the --with-ipv6 option.
Maxim Dounin [Tue, 4 Oct 2016 13:38:14 +0000 (16:38 +0300)]
Configure: removed the --with-ipv6 option.

IPv6 now compiled-in automatically if support is found.  If there is a need
to disable it for some reason, --with-cc-opt="-DNGX_HAVE_INET6=0" can be used
for this.

9 years agoAddition filter: set last_in_chain flag when clearing last_buf.
Roman Arutyunyan [Mon, 3 Oct 2016 18:03:27 +0000 (21:03 +0300)]
Addition filter: set last_in_chain flag when clearing last_buf.

When the last_buf flag is cleared for add_after_body to append more data from a
subrequest, other filters may still have buffered data, which should be flushed
at this point.  For example, the sub_filter may have a partial match buffered,
which will only be flushed after the subrequest is done, ending up with
interleaved data in output.

Setting last_in_chain instead of last_buf flushes the data and fixes the order
of output buffers.

9 years agoDo not set last_buf flag in subrequests.
Roman Arutyunyan [Mon, 3 Oct 2016 17:48:51 +0000 (20:48 +0300)]
Do not set last_buf flag in subrequests.

The last_buf flag should only be set in the last buffer of the main request.
Otherwise, several last_buf flags can appear in output.  This can, for example,
break the chunked filter, which will include several final chunks in output.

9 years agoModules compatibility: removed two NGX_HAVE_DEFERRED_ACCEPT checks.
Ruslan Ermilov [Mon, 3 Oct 2016 12:58:30 +0000 (15:58 +0300)]
Modules compatibility: removed two NGX_HAVE_DEFERRED_ACCEPT checks.

Removed (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
from the signature accordingly.

9 years agoModules compatibility: removed unneeded NGX_HAVE_REUSEPORT checks.
Maxim Dounin [Mon, 3 Oct 2016 12:58:29 +0000 (15:58 +0300)]
Modules compatibility: removed unneeded NGX_HAVE_REUSEPORT checks.

Removed NGX_HAVE_REUSEPORT from the signature accordingly.

9 years agoModules compatibility: removed unneeded IPV6_V6ONLY checks.
Maxim Dounin [Mon, 3 Oct 2016 12:58:25 +0000 (15:58 +0300)]
Modules compatibility: removed unneeded IPV6_V6ONLY checks.

The IPV6_V6ONLY macro is now checked only while parsing appropriate flag
and when using the macro.

The ipv6only field in listen structures is always initialized to 1,
even if not supported on a given platform.  This is expected to prevent
a module compiled without IPV6_V6ONLY from accidentally creating dual
sockets if loaded into main binary with proper IPV6_V6ONLY support.

9 years agoModules compatibility: http2.
Maxim Dounin [Mon, 3 Oct 2016 12:58:22 +0000 (15:58 +0300)]
Modules compatibility: http2.

HTTP/2-specific fields in structures are now available unconditionally.
Removed NGX_HTTP_V2 from the signature accordingly.

9 years agoModules compatibility: degradation fields now always present.
Maxim Dounin [Mon, 3 Oct 2016 12:58:19 +0000 (15:58 +0300)]
Modules compatibility: degradation fields now always present.

There is no need to save these two bits as they are wasted anyway.
Removed NGX_HTTP_DEGRADATION from the signature accordingly.

9 years agoModules compatibility: --with-compat configure option.
Maxim Dounin [Mon, 3 Oct 2016 12:58:16 +0000 (15:58 +0300)]
Modules compatibility: --with-compat configure option.

9 years agoIntroduced the NGX_COMPAT macro.
Ruslan Ermilov [Thu, 29 Sep 2016 12:28:24 +0000 (15:28 +0300)]
Introduced the NGX_COMPAT macro.

When enabled, some structures are padded to be size compatible
with their NGINX Plus versions.

9 years agoResolver: introduced state field in ngx_resolver_srv_name_t.
Dmitry Volyntsev [Thu, 29 Sep 2016 16:40:47 +0000 (19:40 +0300)]
Resolver: introduced state field in ngx_resolver_srv_name_t.

It keeps the actual state value of a DNS SRV subrequest
and can be used to report a more detailed log for
failed SRV records.

9 years agoModules compatibility: down flag promoted to a bitmask.
Maxim Dounin [Thu, 29 Sep 2016 15:06:05 +0000 (18:06 +0300)]
Modules compatibility: down flag promoted to a bitmask.

It is to be used as a bitmask with various bits set/reset when appropriate.
Any bit set means that the peer should not be used, that is, exactly what
current checks do, no additional changes required.

9 years agoModules compatibility: upstream config field.
Maxim Dounin [Thu, 29 Sep 2016 15:06:04 +0000 (18:06 +0300)]
Modules compatibility: upstream config field.

It is to be used to track version of an upstream configuration used for
request processing.

9 years agoModules compatibility: status fields.
Maxim Dounin [Thu, 29 Sep 2016 15:06:03 +0000 (18:06 +0300)]
Modules compatibility: status fields.

9 years agoModules compatibility: health check fields.
Maxim Dounin [Thu, 29 Sep 2016 15:06:02 +0000 (18:06 +0300)]
Modules compatibility: health check fields.

9 years agoModules compatibility: cache purge fields.
Maxim Dounin [Thu, 29 Sep 2016 15:06:01 +0000 (18:06 +0300)]
Modules compatibility: cache purge fields.

9 years agoModules compatibility: slow start fields.
Maxim Dounin [Thu, 29 Sep 2016 15:06:00 +0000 (18:06 +0300)]
Modules compatibility: slow start fields.

9 years agoModules compatibility: peer.notify.
Maxim Dounin [Thu, 29 Sep 2016 15:05:59 +0000 (18:05 +0300)]
Modules compatibility: peer.notify.

This callback can be used to notify balancer about various events.
For now, it is only used in nginx-plus.

9 years agoStream: style.
Ruslan Ermilov [Thu, 29 Sep 2016 09:59:13 +0000 (12:59 +0300)]
Stream: style.

Explicitly initialized peer's max_conns for upstreams created with
variables similar to how it's done in http.

9 years agoUpstream: max_conns.
Ruslan Ermilov [Thu, 22 Sep 2016 16:32:47 +0000 (19:32 +0300)]
Upstream: max_conns.

9 years agoUpstream: removed the quick recovery mechanism.
Ruslan Ermilov [Thu, 22 Sep 2016 16:32:45 +0000 (19:32 +0300)]
Upstream: removed the quick recovery mechanism.

Its usefulness it questionable, and it interacts badly with max_conns.

9 years agoUpstream: introduced u->upstream.
Maxim Dounin [Thu, 22 Sep 2016 16:32:26 +0000 (19:32 +0300)]
Upstream: introduced u->upstream.

It holds upstream{} block configuration, including ones selected via
run-time lookup using variables.

9 years agoUpstream: style.
Maxim Dounin [Thu, 22 Sep 2016 16:31:08 +0000 (19:31 +0300)]
Upstream: style.

9 years agoUpstream: style, ngx_http_upstream_rr_peer_t.next moved.
Maxim Dounin [Mon, 25 Jul 2016 13:23:35 +0000 (16:23 +0300)]
Upstream: style, ngx_http_upstream_rr_peer_t.next moved.

9 years agoPerl: pass additional linker options to perl module.
Konstantin Pavlov [Tue, 20 Sep 2016 19:11:23 +0000 (22:11 +0300)]
Perl: pass additional linker options to perl module.

Previously flags passed by --with-ld-opt were not used when building perl
module, which meant hardening flags provided by package build systems were not
applied.

9 years agoFixed log levels of configuration parsing errors.
Valentin Bartenev [Tue, 20 Sep 2016 12:07:16 +0000 (15:07 +0300)]
Fixed log levels of configuration parsing errors.

All the errors that prevent loading configuration must be printed on the "emerg"
log level.  Previously, nginx might silently fail to load configuration in some
cases as the default log level is "error".

9 years agoRemoved influence of some options on structures.
Ruslan Ermilov [Tue, 20 Sep 2016 09:30:52 +0000 (12:30 +0300)]
Removed influence of some options on structures.

9 years agoUpstream hash: fixed missing upstream name initialization.
Vladimir Homutov [Fri, 16 Sep 2016 12:13:24 +0000 (15:13 +0300)]
Upstream hash: fixed missing upstream name initialization.

9 years agoStream ssl_preread: removed internal macro.
Vladimir Homutov [Thu, 15 Sep 2016 12:36:02 +0000 (15:36 +0300)]
Stream ssl_preread: removed internal macro.

The ngx_log_debug() macro is internal and should not be used.

9 years agoStream: ssl_preread module.
Vladimir Homutov [Thu, 15 Sep 2016 11:56:51 +0000 (14:56 +0300)]
Stream: ssl_preread module.

The ssl_preread module extracts information from the SSL Client Hello message
without terminating SSL.  Currently, only $ssl_preread_server_name variable
is supported, which contains server name from the SNI extension.

9 years agoStream: preread phase.
Vladimir Homutov [Thu, 15 Sep 2016 11:56:02 +0000 (14:56 +0300)]
Stream: preread phase.

In this phase, head of a stream is read and analysed before proceeding to the
content phase.  Amount of data read is controlled by the module implementing
the phase, but not more than defined by the "preread_buffer_size" directive.
The time spent on processing preread is controlled by the "preread_timeout"
directive.

The typical preread phase module will parse the beginning of a stream and set
variable that may be used by the content phase, for example to make routing
decision.

9 years agoStream: phases.
Roman Arutyunyan [Thu, 15 Sep 2016 11:55:54 +0000 (14:55 +0300)]
Stream: phases.

9 years agoStream: filters.
Roman Arutyunyan [Thu, 15 Sep 2016 11:55:46 +0000 (14:55 +0300)]
Stream: filters.

9 years agoVersion bump.
Vladimir Homutov [Thu, 15 Sep 2016 11:56:26 +0000 (14:56 +0300)]
Version bump.

9 years agorelease-1.11.4 tag
Maxim Dounin [Tue, 13 Sep 2016 15:39:24 +0000 (18:39 +0300)]
release-1.11.4 tag

9 years agonginx-1.11.4-RELEASE release-1.11.4
Maxim Dounin [Tue, 13 Sep 2016 15:39:23 +0000 (18:39 +0300)]
nginx-1.11.4-RELEASE

9 years agoOCSP stapling: fixed using wrong responder with multiple certs.
Maxim Dounin [Mon, 12 Sep 2016 17:11:06 +0000 (20:11 +0300)]
OCSP stapling: fixed using wrong responder with multiple certs.

9 years agoSSL: improved session ticket callback error handling.
Sergey Kandaurov [Mon, 12 Sep 2016 15:57:42 +0000 (18:57 +0300)]
SSL: improved session ticket callback error handling.

Prodded by Guido Vranken.

9 years agoSSL: factored out digest and cipher in session ticket callback.
Sergey Kandaurov [Mon, 12 Sep 2016 15:57:42 +0000 (18:57 +0300)]
SSL: factored out digest and cipher in session ticket callback.

No functional changes.

9 years agoStream: increase default value for proxy_protocol_timeout to 30s.
Dmitry Volyntsev [Thu, 8 Sep 2016 12:51:36 +0000 (15:51 +0300)]
Stream: increase default value for proxy_protocol_timeout to 30s.

9 years agoStream: realip module.
Dmitry Volyntsev [Thu, 1 Sep 2016 11:45:33 +0000 (14:45 +0300)]
Stream: realip module.

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