aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
...
* Fixed invalid access to location defined as an empty string.Ruslan Ermilov2018-07-17
|
* SSL: save sessions for upstream peers using a callback function.Sergey Kandaurov2018-07-17
| | | | | | | | | | | | | In TLSv1.3, NewSessionTicket messages arrive after the handshake and can come at any time. Therefore we use a callback to save the session when we know about it. This approach works for < TLSv1.3 as well. The callback function is set once per location on merge phase. Since SSL_get_session() in BoringSSL returns an unresumable session for TLSv1.3, peer save_session() methods have been updated as well to use a session supplied within the callback. To preserve API, the session is cached in c->ssl->session. It is preferably accessed in save_session() methods by ngx_ssl_get_session() and ngx_ssl_get0_session() wrappers.
* SSL: use of the SSL_OP_NO_RENEGOTIATION option (ticket #1376).Maxim Dounin2018-07-16
| | | | | The SSL_OP_NO_RENEGOTIATION option is available in OpenSSL 1.1.0h+ and can save some CPU cycles on renegotiation attempts.
* SSL: fixed SSL_clear_options() usage with OpenSSL 1.1.0+.Maxim Dounin2018-07-16
| | | | | | | | | | | In OpenSSL 1.1.0 the SSL_CTRL_CLEAR_OPTIONS macro was removed, so conditional compilation test on it results in SSL_clear_options() and SSL_CTX_clear_options() not being used. Notably, this caused "ssl_prefer_server_ciphers off" to not work in SNI-based virtual servers if server preference was switched on in the default server. It looks like the only possible fix is to test OPENSSL_VERSION_NUMBER explicitly.
* SSL: logging levels of "unsupported protocol", "version too low".Maxim Dounin2018-07-16
| | | | | | | | | | | | | | Starting with OpenSSL 1.1.0, SSL_R_UNSUPPORTED_PROTOCOL instead of SSL_R_UNKNOWN_PROTOCOL is reported when a protocol is disabled via an SSL_OP_NO_* option. Additionally, SSL_R_VERSION_TOO_LOW is reported when using MinProtocol or when seclevel checks (as set by @SECLEVEL=n in the cipher string) rejects a protocol, and this is what happens with SSLv3 and @SECLEVEL=1, which is the default. There is also the SSL_R_VERSION_TOO_HIGH error code, but it looks like it is not possible to trigger it.
* Events: added configuration check on the number of connections.Maxim Dounin2018-07-12
| | | | | | There should be at least one worker connection for each listening socket, plus an additional connection for channel between worker and master, or starting worker processes will fail.
* Events: moved sockets cloning to ngx_event_init_conf().Maxim Dounin2018-07-12
| | | | | | | | | Previously, listenings sockets were not cloned if the worker_processes directive was specified after "listen ... reuseport". This also simplifies upcoming configuration check on the number of worker connections, as it needs to know the number of listening sockets before cloning.
* Stream ssl_preread: $ssl_preread_protocol variable.Roman Arutyunyan2018-07-11
| | | | | | | | | The variable keeps the latest SSL protocol version supported by the client. The variable has the same format as $ssl_protocol. The version is read from the client_version field of ClientHello. If the supported_versions extension is present in the ClientHello, then the version is set to TLSv1.3.
* Allow resetting connections closed by "return 444" (ticket #905).Ruslan Ermilov2018-07-12
| | | | | If reset_timedout_connection is on, TCP connections closed by "return 444" will be reset instead of a normal close.
* Resolver: retry sending queries on errors (ticket #1511).Maxim Dounin2018-07-05
| | | | | | | | | | Errors when sending UDP datagrams can happen, e.g., when local IP address changes (see fa0e093b64d7), or an unavailable DNS server on the LAN can cause send() to fail with EHOSTDOWN on BSD systems. If this happens during initial query, retry sending immediately, to a different DNS server when possible. If this is not enough, allow normal resend to happen by ignoring the return code of the second ngx_resolver_send_query() call, much like we do in ngx_resolver_resend().
* SSL: logging level of "https proxy request" errors.Maxim Dounin2018-07-05
| | | | | | The "http request" and "https proxy request" errors cannot happen with HTTP due to pre-handshake checks in ngx_http_ssl_handshake(), but can happen when SSL is used in stream and mail modules.
* Version bump.Maxim Dounin2018-07-05
|
* Upstream: fixed tcp_nopush with gRPC.Maxim Dounin2018-07-02
| | | | | | | | | | | | | | With gRPC it is possible that a request sending is blocked due to flow control. Moreover, further sending might be only allowed once the backend sees all the data we've already sent. With such a backend it is required to clear the TCP_NOPUSH socket option to make sure all the data we've sent are actually delivered to the backend. As such, we now clear TCP_NOPUSH in ngx_http_upstream_send_request() also on NGX_AGAIN if c->write->ready is set. This fixes a test (which waits for all the 64k bytes as per initial window before allowing more bytes) with sendfile enabled when the body was written to a file in a different context.
* Upstream: fixed unexpected tcp_nopush usage on peer connections.Maxim Dounin2018-07-02
| | | | | | | Now tcp_nopush on peer connections is disabled if it is disabled on the client connection, similar to how we handle c->sendfile. Previously, tcp_nopush was always used on upstream connections, regardless of the "tcp_nopush" directive.
* gRPC: clearing buffers in ngx_http_grpc_get_buf().Maxim Dounin2018-07-02
| | | | | | | | | | | | We copy input buffers to our buffers, so various flags might be unexpectedly set in buffers returned by ngx_chain_get_free_buf(). In particular, the b->in_file flag might be set when the body was written to a file in a different context. With sendfile enabled this in turn might result in protocol corruption if such a buffer was reused for a control frame. Make sure to clear buffers and set only fields we really need to be set.
* Added FreeBSD support for "listen ... reuseport".Ruslan Ermilov2018-07-02
|
* Upstream: ngx_http_upstream_random module.Vladimir Homutov2018-06-15
| | | | | | | | | | | | | | | | | The module implements random load-balancing algorithm with optional second choice. In the latter case, the best of two servers is chosen, accounting number of connections and server weight. Example: upstream u { random [two [least_conn]]; server 127.0.0.1:8080; server 127.0.0.1:8081; server 127.0.0.1:8082; server 127.0.0.1:8083; }
* Upstream: improved peer selection concurrency for hash and ip_hash.Ruslan Ermilov2018-06-14
|
* Resolver: require name servers.Ruslan Ermilov2018-06-13
|
* Resolver: allocate resolver from configuration pool.Ruslan Ermilov2018-06-13
| | | | | | | | Before 4a8c9139e579, ngx_resolver_create() didn't use configuration pool, and allocations were done using malloc(). In 016352c19049, when resolver gained support of several servers, new allocations were done from the pool.
* Upstream: disable body cleanup with preserve_output (ticket #1565).Maxim Dounin2018-06-13
| | | | | | | | With u->conf->preserve_output set the request body file might be used after the response header is sent, so avoid cleaning it. (Normally this is not a problem as u->conf->preserve_output is only set with r->request_body_no_buffering, but the request body might be already written to a file in a different context.)
* HTTP/2: use scheme from original request for pushes (closes #1549).Ruslan Ermilov2018-06-07
| | | | | | Instead of the connection scheme, use scheme from the original request. This fixes pushes when SSL is terminated by a proxy server in front of nginx.
* Added r->schema.Ruslan Ermilov2018-06-07
| | | | | For HTTP/1, it keeps scheme from the absolute form of URI. For HTTP/2, the :scheme request pseudo-header field value.
* Removed extraneous check while processing request line.Ruslan Ermilov2018-06-07
|
* HTTP/2: validate client request scheme.Ruslan Ermilov2018-06-07
| | | | The scheme is validated as per RFC 3986, Section 3.1.
* Allowed digits, '+', '-', and '.' in scheme names as per RFC 3986.Ruslan Ermilov2018-05-24
|
* SSL: removed extra prototype.Sergey Kandaurov2018-06-06
|
* Added missing space after ngx_close_socket_n.Maxim Dounin2018-06-05
|
* Version bump.Maxim Dounin2018-06-05
|
* Stream: udp streams.Roman Arutyunyan2018-06-04
| | | | | | | | | | | | | | | | | Previously, only one client packet could be processed in a udp stream session even though multiple response packets were supported. Now multiple packets coming from the same client address and port are delivered to the same stream session. If it's required to maintain a single stream of data, nginx should be configured in a way that all packets from a client are delivered to the same worker. On Linux and DragonFly BSD the "reuseport" parameter should be specified for this. Other systems do not currently provide appropriate mechanisms. For these systems a single stream of udp packets is only guaranteed in single-worker configurations. The proxy_response directive now specifies how many packets are expected in response to a single client packet.
* Events: moved ngx_recvmsg() to new file src/event/ngx_event_udp.c.Roman Arutyunyan2018-06-01
|
* Events: get remote addresses before creating udp connection.Roman Arutyunyan2018-06-01
| | | | | | Previously, ngx_event_recvmsg() got remote socket addresses after creating the connection object. In preparation to handling multiple UDP packets in a single session, this code was moved up.
* Events: fixed handling zero-length client address.Roman Arutyunyan2018-06-01
| | | | | | | | | | On Linux recvmsg() syscall may return a zero-length client address when receiving a datagram from an unbound unix datagram socket. It is usually assumed that socket address has at least the sa_family member. Zero-length socket address caused buffer over-read in functions which receive socket address, for example ngx_sock_ntop(). Typically the over-read resulted in unexpected socket family followed by session close. Now a fake socket address is allocated instead of a zero-length client address.
* Leave chain in ngx_chain_add_copy() in consistent state on errors.Sergey Kandaurov2018-06-04
|
* Limit req: improved handling of negative times.Maxim Dounin2018-05-30
| | | | | | | | | | | | | | | | | | | | | | | | | Negative times can appear since workers only update time on an event loop iteration start. If a worker was blocked for a long time during an event loop iteration, it is possible that another worker already updated the time stored in the node. As such, time since last update of the node (ms) will be negative. Previous code used ngx_abs(ms) in the calculations. That is, negative times were effectively treated as positive ones. As a result, it was not possible to maintain high request rates, where the same node can be updated multiple times from during an event loop iteration. In particular, this affected setups with many SSL handshakes, see http://mailman.nginx.org/pipermail/nginx/2018-May/056291.html. Fix is to only update the last update time stored in the node if the new time is larger than previously stored one. If a future time is stored in the node, we preserve this time as is. To prevent breaking things on platforms without monotonic time available if system time is updated backwards, a safety limit of 60 seconds is used. If the time stored in the node is more than 60 seconds in the future, we assume that the time was changed backwards and update lr->last to the current time.
* Core: fixed comment about ngx_current_msec after 81fae70d6cb8.Ruslan Ermilov2018-05-29
| | | | | The value is no longer guaranteed to be based on milliseconds elapsed since Epoch.
* Win32: fixed comment in ngx_gettimeofday() calculations.Ruslan Ermilov2018-05-29
|
* Removed glibc crypt_r() bug workaround (ticket #1469).Maxim Dounin2018-05-23
| | | | | | | | | The bug in question was fixed in glibc 2.3.2 and is no longer expected to manifest itself on real servers. On the other hand, the workaround causes compilation problems on various systems. Previously, we've already fixed the code to compile with musl libc (fd6fd02f6a4d), and now it is broken on Fedora 28 where glibc's crypt library was replaced by libxcrypt. So the workaround was removed.
* Syslog: install cleanup handler only once.Vladimir Homutov2018-05-14
| | | | | If a socket was re-opened due to an error (02c2352d5b01 and fa0e093b64d7), additional cleanup handler was installed each time.
* Resolver: close UDP socket on error or incomplete send.Ruslan Ermilov2018-05-23
|
* Resolver: style.Ruslan Ermilov2018-05-23
|
* Core: silenced getsockopt(TCP_FASTOPEN) messages on FreeBSD.Maxim Dounin2018-05-21
| | | | | | | FreeBSD returns EINVAL when getsockopt(TCP_FASTOPEN) is called on a unix domain socket, resulting in "getsockopt(TCP_FASTOPEN) ... failed" messages during binary upgrade when unix domain listen sockets are present in the configuration. Added EINVAL to the list of ignored error codes.
* Syslog: re-open syslog udp socket on send error (ticket #1477).Vladimir Homutov2018-05-08
| | | | | | Previously, only unix domain sockets were reopened to tolerate cases when local syslog server was restarted. It makes sense to treat other cases (for example, local IP address changes) similarly.
* Silenced -Wcast-function-type warnings (closes #1546).Sergey Kandaurov2018-05-07
| | | | | | | Cast to intermediate "void *" to lose compiler knowledge about the original type and pass the warning. This is not a real fix but rather a workaround. Found by gcc8.
* SSL: deprecated the "ssl" directive.Ruslan Ermilov2018-04-25
|
* SSL: detect "listen ... ssl" without certificates (ticket #178).Maxim Dounin2018-04-24
| | | | | | | | | In mail and stream modules, no certificate provided is a fatal condition, much like with the "ssl" and "starttls" directives. In http, "listen ... ssl" can be used in a non-default server without certificates as long as there is a certificate in the default one, so missing certificate is only fatal for default servers.
* Mail: fixed error message about missing ssl_certificate_key.Maxim Dounin2018-04-24
| | | | | | | In 51e1f047d15d, the "ssl" directive name was incorrectly hardcoded in the error message shown when there are some SSL keys defined, but not for all certificates. Right approach is to use the "mode" variable, which can be either "ssl" or "starttls".
* Cache: fixed cache valid slot to reject incorrect statuses.Maxim Dounin2018-04-18
| | | | | | | | | Previously, result of ngx_atoi() was assigned to an ngx_uint_t variable, and errors reported by ngx_atoi() became positive, so the following check in "status < 100" failed to catch them. This resulted in the configurations like "proxy_cache_valid 2xx 30s" being accepted as correct, while they in fact do nothing. Changing type to ngx_int_t fixes this, and such configurations are now properly rejected.
* Version bump.Maxim Dounin2018-04-18
|
* Upstream: fixed u->conf->preserve_output (ticket #1519).Maxim Dounin2018-04-05
| | | | | | | | | Previously, ngx_http_upstream_process_header() might be called after we've finished reading response headers and switched to a different read event handler, leading to errors with gRPC proxying. Additionally, the u->conf->read_timeout timer might be re-armed during reading response headers (while this is expected to be a single timeout on reading the whole response header).