summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)AuthorFilesLines
2016-05-24nginx-1.11.0-RELEASErelease-1.11.0Maxim Dounin1-0/+156
2016-05-24Updated OpenSSL used for win32 builds.Maxim Dounin1-1/+1
2016-05-24Fixed build on MSVC.Maxim Dounin1-2/+2
2016-05-24HTTP/2: implemented preread buffer for request body (closes #959).Valentin Bartenev4-43/+146
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.
2016-05-23Realip: detect duplicate real_ip_header directive.Ruslan Ermilov1-0/+4
2016-05-23Realip: port support in X-Real-IP and X-Forwarded-For.Dmitry Volyntsev3-1/+84
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.
2016-05-23Realip: take client port from PROXY protocol header.Dmitry Volyntsev1-0/+22
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.
2016-05-23Added the $realip_remote_port variable.Dmitry Volyntsev1-4/+71
2016-05-23Added the $proxy_protocol_port variable.Dmitry Volyntsev3-4/+69
2016-05-23Renamed "u" to "sockaddr" in listen options types.Maxim Dounin9-46/+48
2016-05-23Introduced the ngx_sockaddr_t type.Ruslan Ermilov12-88/+60
It's properly aligned and can hold any supported sockaddr.
2016-05-23Stream: fixed duplicate listen address detection.Ruslan Ermilov1-17/+20
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.
2016-05-20Use ngx_cmp_sockaddr() where appropriate.Ruslan Ermilov6-136/+16
2016-05-20HTTP/2: the "421 Misdirected Request" response (closes #848).Valentin Bartenev4-9/+23
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.
2016-05-20Belatedly changed the ngx_create_listening() prototype.Ruslan Ermilov2-2/+3
The function is called only with "struct sockaddr *" since 0.7.58.
2016-05-19SSL: removed default DH parameters.Maxim Dounin1-45/+0
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).
2016-05-19SSL: support for multiple curves (ticket #885).Maxim Dounin4-8/+51
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.
2016-05-19SSL: style.Maxim Dounin1-4/+4
2016-05-19SSL: error messages style.Maxim Dounin1-2/+2
2016-05-19SSL: support for multiple certificates (ticket #814).Maxim Dounin8-49/+112
2016-05-19SSL: support for per-certificate chains.Maxim Dounin2-2/+33
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.
2016-05-19SSL: made it possible to iterate though all certificates.Maxim Dounin3-24/+66
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.
2016-05-19OCSP stapling: additional function to configure stapling on a cert.Maxim Dounin1-11/+26
2016-05-19OCSP stapling: staple now extracted via SSL_get_certificate().Maxim Dounin1-2/+8
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.
2016-05-19OCSP stapling: staple now stored in certificate, not SSL context.Maxim Dounin2-13/+13
2016-05-19OCSP stapling: staple provided in arguments.Maxim Dounin1-26/+22
2016-05-18Added overflow checks for version numbers (ticket #762).Maxim Dounin1-0/+16
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.
2016-05-18Events: close descriptors on errors in ngx_epoll_test_rdhup().Maxim Dounin1-5/+18
2016-05-18Events: changed ngx_epoll_test_rdhup() to use existing epollfd.Maxim Dounin1-12/+3
2016-05-18Fixed work with --test-build-epoll after f7849bfb6d21.Maxim Dounin1-66/+70
2016-05-16Cache: fixed updating bypassed cached errors (ticket #827).Maxim Dounin1-0/+1
2016-05-16Dav: return 501 on PUT with ranges (ticket #948).Maxim Dounin3-0/+11
2016-05-16Fixed an error log message about epoll_wait() timeout.Valentin Bartenev1-2/+2
The errno value is unset in case of epoll_wait() timeout.
2016-05-13Improved EPOLLRDHUP handling.Valentin Bartenev6-3/+153
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.
2016-05-12Map: support of complex values in resulting strings.Dmitry Volyntsev1-59/+67
2016-05-11Removed a surplus condition from ngx_parse_inet6_url().Ruslan Ermilov1-33/+30
No functional changes, since the condition was always true.
2016-05-11Core: fixed port handling in ngx_parse_inet6_url().Valentin Bartenev1-1/+6
This fixes buffer over-read when no port is specified in cases similar to 5df5d7d771f6, and catches missing port separator.
2016-04-28Removed unused flag unexpected_eof from ngx_connection_t.Ruslan Ermilov4-7/+0
2016-04-26Variable $request_id.Vladimir Homutov1-0/+47
The variable contains text representation based on random data, usable as a unique request identifier.
2015-12-18Upstream: the "transparent" parameter of proxy_bind and friends.Roman Arutyunyan11-23/+259
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;
2016-04-13Stream: prepared proxy_bind to accept parameters.Roman Arutyunyan1-9/+48
2016-04-13Upstream: prepared proxy_bind to accept parameters.Roman Arutyunyan1-38/+44
In addition, errors occurred while setting bind address are no longer ignored.
2016-04-26Removed some bitrot.Ruslan Ermilov2-2/+0
Removed NGX_CONF_MULTI unused since 1.3.4. Removed ngx_url_t.one_addr unused since 1.3.10.
2016-04-26Version bump.Ruslan Ermilov1-2/+2
2016-04-19release-1.9.15 tagMaxim Dounin1-0/+1
2016-04-19nginx-1.9.15-RELEASErelease-1.9.15Maxim Dounin1-0/+55
2016-04-19HTTP/2: send the output queue after emitting WINDOW_UPDATE.Valentin Bartenev1-0/+10
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.
2016-04-19HTTP/2: skip data frames in case of internal errors.Valentin Bartenev1-0/+2
This prevents possible processing of such frames and triggering rb->post_handler if an error occurred during r->request_body initialization.
2016-04-19HTTP/2: don't send WINDOW_UPDATE for an empty request body.Valentin Bartenev1-12/+13
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.
2016-04-19Thread pools: memory barriers in task completion notifications.Maxim Dounin1-0/+4
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.