summaryrefslogtreecommitdiffhomepage
path: root/src/stream (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-05-29Style: changed checks of ngx_ssl_create_connection() to != NGX_OK.Maxim Dounin1-1/+1
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.
2017-05-29SSL: set TCP_NODELAY on SSL connections before handshake.Maxim Dounin1-3/+10
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.
2017-05-26Introduced ngx_tcp_nodelay().Ruslan Ermilov2-32/+6
2017-05-15Realip: allow hostnames in set_real_ip_from (ticket #1180).Ruslan Ermilov1-15/+68
2017-05-15Access: simplified rule parser code.Ruslan Ermilov1-13/+7
2017-04-18SSL: added support for TLSv1.3 in ssl_protocols directive.Sergey Kandaurov2-0/+2
Support for the TLSv1.3 protocol will be introduced in OpenSSL 1.1.1.
2017-04-03Stream: configurable socket buffer sizes.Vladimir Homutov3-1/+39
The "rcvbuf" and "sndbuf" parameters are now supported by the "listen" directive.
2017-03-28Fixed ngx_open_cached_file() error handling.Sergey Kandaurov1-0/+5
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.
2017-03-22Unified error messages about duplicate directives.Ruslan Ermilov1-1/+1
2017-03-07Access log: removed dead ev->timedout check in flush timer handler.Maxim Dounin1-14/+1
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.
2017-01-31Variables: generic prefix variables.Dmitry Volyntsev3-22/+129
2017-01-19Stream: client SSL certificates were not checked in some cases.Vladimir Homutov1-1/+6
If ngx_stream_ssl_init_connection() succeeded immediately, the check was not done. The bug had appeared in 1.11.8 (41cb1b64561d).
2017-01-19Stream: fixed handling of non-ssl sessions.Vladimir Homutov1-1/+5
A missing check could cause ngx_stream_ssl_handler() to be applied to a non-ssl session, which resulted in a null pointer dereference if ssl_verify_client is enabled. The bug had appeared in 1.11.8 (41cb1b64561d).
2017-01-11Stream: avoid infinite loop in case of socket read error.Vladimir Homutov1-2/+3
2016-12-26Stream: speed up TCP peer recovery.Roman Arutyunyan3-0/+37
Previously, an unavailable peer was considered recovered after a successful proxy session to this peer. Until then, only a single client connection per fail_timeout was allowed to be proxied to the peer. Since stream sessions can be long, it may take indefinite time for a peer to recover, limiting the ability of the peer to receive new connections. Now, a peer is considered recovered after a successful TCP connection is established to it. Balancers are notified of this event via the notify() callback.
2016-12-21Limited recursion when evaluating variables.Ruslan Ermilov1-7/+31
Unlimited recursion might cause stack exhaustion in some misconfigurations.
2016-12-20Stream: client SSL certificates verification support.Vladimir Homutov2-0/+157
New directives: "ssl_verify_client", "ssl_verify_depth", "ssl_client_certificate", "ssl_trusted_certificate", and "ssl_crl". New variables: $ssl_client_cert, $ssl_client_raw_cert, $ssl_client_s_dn, $ssl_client_i_dn, $ssl_client_serial, $ssl_client_fingerprint, $ssl_client_verify, $ssl_client_v_start, $ssl_client_v_end, and $ssl_client_v_remain.
2016-12-19Stream ssl_preread: relaxed SSL version check.Roman Arutyunyan1-1/+1
SSL version 3.0 can be specified by the client at the record level for compatibility reasons. Previously, ssl_preread module rejected such connections, presuming they don't have SNI. Now SSL 3.0 is allowed at the record level.
2016-12-15Access log: support for json escaping.Valentin Bartenev1-6/+77
2016-12-08Map: the "volatile" parameter.Ruslan Ermilov1-1/+14
By default, "map" creates cacheable variables [1]. With this parameter it creates a non-cacheable variable. An original idea was to deduce the cacheability of the "map" variable by checking the cacheability of variables specified in source and resulting values, but it turned to be too hard. For example, a cacheable variable can be overridden with the "set" directive or with the SSI "set" command. Also, keeping "map" variables cacheable by default is good for performance reasons. This required adding a new parameter. [1] Before db699978a33f (1.11.0), the cacheability of the "map" variable could vary depending on the cacheability of variables specified in resulting values (ticket #1090). This is believed to be a bug rather than a feature.
2016-12-08Map: simplified "map" block parser.Ruslan Ermilov1-1/+2
No functional changes.
2016-12-05SSL: $ssl_curves (ticket #1088).Maxim Dounin1-0/+3
The variable contains a list of curves as supported by the client. Known curves are listed by their names, unknown ones are shown in hex, e.g., "0x001d:prime256v1:secp521r1:secp384r1". Note that OpenSSL uses session data for SSL_get1_curves(), and it doesn't store full list of curves supported by the client when serializing a session. As a result $ssl_curves is only available for new sessions (and will be empty for reused ones). The variable is only meaningful when using OpenSSL 1.0.2 and above. With older versions the variable is empty.
2016-12-05SSL: $ssl_ciphers (ticket #870).Maxim Dounin1-0/+3
The variable contains list of ciphers as supported by the client. Known ciphers are listed by their names, unknown ones are shown in hex, e.g., ""AES128-SHA:AES256-SHA:0x00ff". The variable is fully supported only when using OpenSSL 1.0.2 and above. With older version there is an attempt to provide some information using SSL_get_shared_ciphers(). It only lists known ciphers though. Moreover, as OpenSSL uses session data for SSL_get_shared_ciphers(), and it doesn't store relevant data when serializing a session. As a result $ssl_ciphers is only available for new sessions (and not available for reused ones) when using OpenSSL older than 1.0.2.
2016-10-31Upstream: do not unnecessarily create per-request upstreams.Ruslan Ermilov1-17/+17
If proxy_pass (and friends) with variables evaluates an upstream specified with literal address, nginx always created a per-request upstream. Now, if there's a matching upstream specified in the configuration (either implicit or explicit), it will be used instead.
2016-10-31Upstream: added the ngx_http_upstream_resolved_t.name field.Ruslan Ermilov3-5/+4
This fixes inconsistency in what is stored in the "host" field. Normally it would contain the "host" part of the parsed URL (e.g., proxy_pass with variables), but for the case of an implicit upstream specified with literal address it contained the text representation of the socket address (that is, host including port for IP). Now the "host" field always contains the "host" part of the URL, while the text representation of the socket address is stored in the newly added "name" field. The ngx_http_upstream_create_round_robin_peer() function was modified accordingly in a way to be compatible with the code that does not know about the new "name" field. The "stream" code was similarly modified except for not adding compatibility in ngx_stream_upstream_create_round_robin_peer(). This change is also a prerequisite for the next change.
2016-10-31Upstream: removed unnecessary condition in proxy_eval() and friends.Ruslan Ermilov1-1/+1
The first condition added in d3454e719bbb should have just replaced the second one.
2016-10-19SSL: compatibility with BoringSSL.Maxim Dounin1-1/+2
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.
2016-10-10Modules compatibility: removed dependencies on NGX_STREAM_SSL.Maxim Dounin4-14/+0
External structures are now identical regardless of stream SSL module compiled in or not.
2016-10-05Stream ssl_preread: fixed $ssl_preread_server_name variable.Sergey Kandaurov1-1/+2
Made sure to set the variable length only after successful SNI parsing.
2016-10-03Modules compatibility: removed unneeded NGX_HAVE_REUSEPORT checks.Maxim Dounin1-2/+0
Removed NGX_HAVE_REUSEPORT from the signature accordingly.
2016-10-03Modules compatibility: removed unneeded IPV6_V6ONLY checks.Maxim Dounin3-3/+3
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.
2016-09-29Introduced the NGX_COMPAT macro.Ruslan Ermilov2-0/+6
When enabled, some structures are padded to be size compatible with their NGINX Plus versions.
2016-09-29Modules compatibility: down flag promoted to a bitmask.Maxim Dounin1-1/+1
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.
2016-09-29Modules compatibility: upstream config field.Maxim Dounin2-0/+3
It is to be used to track version of an upstream configuration used for request processing.
2016-09-29Modules compatibility: status fields.Maxim Dounin1-0/+2
2016-09-29Modules compatibility: health check fields.Maxim Dounin1-1/+3
2016-09-29Modules compatibility: slow start fields.Maxim Dounin2-0/+3
2016-09-29Stream: style.Ruslan Ermilov1-0/+2
Explicitly initialized peer's max_conns for upstreams created with variables similar to how it's done in http.
2016-09-22Upstream: max_conns.Ruslan Ermilov6-1/+51
2016-09-22Upstream: removed the quick recovery mechanism.Ruslan Ermilov2-12/+0
Its usefulness it questionable, and it interacts badly with max_conns.
2016-09-22Upstream: introduced u->upstream.Maxim Dounin2-0/+3
It holds upstream{} block configuration, including ones selected via run-time lookup using variables.
2016-09-22Upstream: style.Maxim Dounin3-3/+0
2016-07-25Upstream: style, ngx_http_upstream_rr_peer_t.next moved.Maxim Dounin1-2/+2
2016-09-20Fixed log levels of configuration parsing errors.Valentin Bartenev1-2/+2
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".
2016-09-16Upstream hash: fixed missing upstream name initialization.Vladimir Homutov1-0/+1
2016-09-15Stream ssl_preread: removed internal macro.Vladimir Homutov1-6/+6
The ngx_log_debug() macro is internal and should not be used.
2016-09-15Stream: ssl_preread module.Vladimir Homutov1-0/+448
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.
2016-09-15Stream: preread phase.Vladimir Homutov3-1/+145
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.
2016-09-15Stream: phases.Roman Arutyunyan9-183/+425
2016-09-15Stream: filters.Roman Arutyunyan7-100/+471