]> git.kaiwu.me - nginx.git/log
nginx.git
5 years agoMerged with the default branch.
Sergey Kandaurov [Fri, 16 Apr 2021 16:35:55 +0000 (19:35 +0300)]
Merged with the default branch.

5 years agoHTTP/3: removed h3scf->quic leftover after 0d2b2664b41c.
Sergey Kandaurov [Mon, 12 Apr 2021 09:30:30 +0000 (12:30 +0300)]
HTTP/3: removed h3scf->quic leftover after 0d2b2664b41c.

5 years agoQUIC: fixed memory leak in ngx_hkdf_extract()/ngx_hkdf_expand().
Sergey Kandaurov [Wed, 7 Apr 2021 12:14:41 +0000 (15:14 +0300)]
QUIC: fixed memory leak in ngx_hkdf_extract()/ngx_hkdf_expand().

This fixes leak on successful path when built with OpenSSL.

5 years agoGzip: updated handling of zlib variant from Intel.
Maxim Dounin [Mon, 5 Apr 2021 01:07:17 +0000 (04:07 +0300)]
Gzip: updated handling of zlib variant from Intel.

In current versions (all versions based on zlib 1.2.11, at least
since 2018) it no longer uses 64K hash and does not force window
bits to 13 if it is less than 13.  That is, it needs just 16 bytes
more memory than normal zlib, so these bytes are simply added to
the normal size calculation.

5 years agoGzip: support for zlib-ng.
Maxim Dounin [Mon, 5 Apr 2021 01:06:58 +0000 (04:06 +0300)]
Gzip: support for zlib-ng.

5 years agoVersion bump.
Maxim Dounin [Mon, 5 Apr 2021 01:03:10 +0000 (04:03 +0300)]
Version bump.

5 years agorelease-1.19.9 tag
Maxim Dounin [Tue, 30 Mar 2021 14:47:11 +0000 (17:47 +0300)]
release-1.19.9 tag

5 years agonginx-1.19.9-RELEASE release-1.19.9
Maxim Dounin [Tue, 30 Mar 2021 14:47:11 +0000 (17:47 +0300)]
nginx-1.19.9-RELEASE

5 years agoUpdated OpenSSL used for win32 builds.
Maxim Dounin [Tue, 30 Mar 2021 14:44:36 +0000 (17:44 +0300)]
Updated OpenSSL used for win32 builds.

5 years agoFixed handling of already closed connections.
Maxim Dounin [Sun, 28 Mar 2021 14:45:39 +0000 (17:45 +0300)]
Fixed handling of already closed connections.

In limit_req, auth_delay, and upstream code to check for broken
connections, tests for possible connection close by the client
did not work if the connection was already closed when relevant
event handler was set.  This happened because there were no additional
events in case of edge-triggered event methods, and read events
were disabled in case of level-triggered ones.

Fix is to explicitly post a read event if the c->read->ready flag
is set.

5 years agoUpstream: fixed broken connection check with eventport.
Maxim Dounin [Sun, 28 Mar 2021 14:45:37 +0000 (17:45 +0300)]
Upstream: fixed broken connection check with eventport.

For connection close to be reported with eventport on Solaris,
ngx_handle_read_event() needs to be called.

5 years agoUpstream: fixed non-buffered proxying with eventport.
Maxim Dounin [Sun, 28 Mar 2021 14:45:35 +0000 (17:45 +0300)]
Upstream: fixed non-buffered proxying with eventport.

For new data to be reported with eventport on Solaris,
ngx_handle_read_event() needs to be called after reading response
headers.  To do so, ngx_http_upstream_process_non_buffered_upstream()
now called unconditionally if there are no prepread data.  This
won't cause any read() syscalls as long as upstream connection
is not ready for reading (c->read->ready is not set), but will result
in proper handling of all events.

5 years agoResolver: added missing event handling after reading.
Maxim Dounin [Sun, 28 Mar 2021 14:45:31 +0000 (17:45 +0300)]
Resolver: added missing event handling after reading.

If we need to be notified about further events, ngx_handle_read_event()
needs to be called after a read event is processed.  Without this,
an event can be removed from the kernel and won't be reported again,
notably when using oneshot event methods, such as eventport on Solaris.

While here, error handling is also added, similar to one present in
ngx_resolver_tcp_read().  This is not expected to make a difference
and mostly added for consistency.

5 years agoEvents: fixed "port_dissociate() failed" alerts with eventport.
Maxim Dounin [Sun, 28 Mar 2021 14:45:29 +0000 (17:45 +0300)]
Events: fixed "port_dissociate() failed" alerts with eventport.

If an attempt is made to delete an event which was already reported,
port_dissociate() returns an error.  Fix is avoid doing anything if
ev->active is not set.

Possible alternative approach would be to avoid calling ngx_del_event()
at all if ev->active is not set.  This approach, however, will require
something else to re-add the other event of the connection, since both
read and write events are dissociated if an event is reported on a file
descriptor.  Currently ngx_eventport_del_event() re-associates write
event if called to delete read event, and vice versa.

5 years agoEvents: fixed expiration of timers in the past.
Maxim Dounin [Thu, 25 Mar 2021 22:44:59 +0000 (01:44 +0300)]
Events: fixed expiration of timers in the past.

If, at the start of an event loop iteration, there are any timers
in the past (including timers expiring now), the ngx_process_events()
function is called with zero timeout, and returns immediately even
if there are no events.  But the following code only calls
ngx_event_expire_timers() if time actually changed, so this results
in nginx spinning in the event loop till current time changes.

While such timers are not expected to appear under normal conditions,
as all such timers should be removed on previous event loop iterations,
they still can appear due to bugs, zero timeouts set in the configuration
(if this is not explicitly handled by the code), or due to external
time changes on systems without clock_gettime(CLOCK_MONOTONIC).

Fix is to call ngx_event_expire_timers() unconditionally.  Calling
it on each event loop iteration is not expected to be significant from
performance point of view, especially compared to a syscall in
ngx_process_events().

5 years agoHTTP/2: improved handling of "keepalive_timeout 0".
Maxim Dounin [Thu, 25 Mar 2021 22:44:57 +0000 (01:44 +0300)]
HTTP/2: improved handling of "keepalive_timeout 0".

Without explicit handling, a zero timer was actually added, leading to
multiple unneeded syscalls.  Further, sending GOAWAY frame early might
be beneficial for clients.

Reported by Sergey Kandaurov.

5 years agoCancel keepalive and lingering close on EOF better (ticket #2145).
Sergey Kandaurov [Wed, 24 Mar 2021 11:03:33 +0000 (14:03 +0300)]
Cancel keepalive and lingering close on EOF better (ticket #2145).

Unlike in 75e908236701, which added the logic to ngx_http_finalize_request(),
this change moves it to a more generic routine ngx_http_finalize_connection()
to cover cases when a request is finalized with NGX_DONE.

In particular, this fixes unwanted connection transition into the keepalive
state after receiving EOF while discarding request body.  With edge-triggered
event methods that means the connection will last for extra seconds as set in
the keepalive_timeout directive.

5 years agogRPC: fixed handling of padding on DATA frames.
Maxim Dounin [Tue, 23 Mar 2021 13:52:23 +0000 (16:52 +0300)]
gRPC: fixed handling of padding on DATA frames.

The response size check introduced in 39501ce97e29 did not take into
account possible padding on DATA frames, resulting in incorrect
"upstream sent response body larger than indicated content length" errors
if upstream server used padding in responses with known length.

Fix is to check the actual size of response buffers produced by the code,
similarly to how it is done in other protocols, instead of checking
the size of DATA frames.

Reported at:
http://mailman.nginx.org/pipermail/nginx-devel/2021-March/013907.html

5 years agoQUIC: PATH_CHALLENGE frame creation.
Vladimir Homutov [Tue, 23 Mar 2021 08:58:43 +0000 (11:58 +0300)]
QUIC: PATH_CHALLENGE frame creation.

5 years agoQUIC: distinct files for connection migration.
Vladimir Homutov [Wed, 31 Mar 2021 11:57:15 +0000 (14:57 +0300)]
QUIC: distinct files for connection migration.

The connection migration-related code from quic.c with dependencies is moved
into separate file.

5 years agoQUIC: separate header for ngx_quic_connection_t.
Vladimir Homutov [Wed, 31 Mar 2021 11:56:16 +0000 (14:56 +0300)]
QUIC: separate header for ngx_quic_connection_t.

5 years agoQUIC: simplified quic connection dispatching.
Vladimir Homutov [Fri, 2 Apr 2021 08:31:37 +0000 (11:31 +0300)]
QUIC: simplified quic connection dispatching.

Currently listener contains rbtree with multiple nodes for single QUIC
connection: each corresponding to specific server id.  Each udp node points
to same ngx_connection_t, which points to QUIC connection via c->udp field.

Thus when an event handler is called, it only gets ngx_connection_t with
c->udp pointing to QUIC connection.  This makes it hard to obtain actual
node which was used to dispatch packet (it requires to repeat DCID lookup).

Additionally, ngx_quic_connection_t->udp field is only needed to keep a
pointer in c->udp. The node is not added into the tree and does not carry
useful information.

5 years agoUDP: extended datagram context.
Vladimir Homutov [Fri, 2 Apr 2021 15:58:19 +0000 (18:58 +0300)]
UDP: extended datagram context.

Sometimes it is required to process datagram properties at higher level (i.e.
QUIC is interested in source address which may change and IP options).  The
patch adds ngx_udp_dgram_t structure used to pass packet-related information
in c->udp.

5 years agoQUIC: fixed udp buffer initialization.
Vladimir Homutov [Tue, 30 Mar 2021 11:33:43 +0000 (14:33 +0300)]
QUIC: fixed udp buffer initialization.

The start field is used to check if the QUIC packet is first in the datagram.
This fixes stateless reset detection.

5 years agoQUIC: do not handle empty dcid.
Roman Arutyunyan [Tue, 30 Mar 2021 11:33:47 +0000 (14:33 +0300)]
QUIC: do not handle empty dcid.

When a QUIC datagram arrives, its DCID is never empty.  Previously, the case
of empty DCID was handled.  Now this code is simplified.

5 years agoQUIC: do not reallocate c->sockaddr.
Roman Arutyunyan [Thu, 11 Mar 2021 12:22:18 +0000 (15:22 +0300)]
QUIC: do not reallocate c->sockaddr.

When a connection is created, enough memory is allocated to accomodate
any future address change.

5 years agoQUIC: do not copy input data.
Roman Arutyunyan [Thu, 11 Mar 2021 12:25:11 +0000 (15:25 +0300)]
QUIC: do not copy input data.

Previously, when a new datagram arrived, data were copied from the UDP layer
to the QUIC layer via c->recv() interface.  Now UDP buffer is accessed
directly.

5 years agoQUIC: HKDF API compatibility with OpenSSL master branch.
Sergey Kandaurov [Wed, 31 Mar 2021 18:43:17 +0000 (21:43 +0300)]
QUIC: HKDF API compatibility with OpenSSL master branch.

OpenSSL 3.0 started to require HKDF-Extract output PRK length pointer
used to represent the amount of data written to contain the length of
the key buffer before the call.  EVP_PKEY_derive() documents this.

See HKDF_Extract() internal implementation update in this change:
https://github.com/openssl/openssl/commit/5a285ad

5 years agoMerged with the default branch.
Sergey Kandaurov [Tue, 30 Mar 2021 20:34:51 +0000 (23:34 +0300)]
Merged with the default branch.

5 years agoHTTP/3: fixed $connection_requests.
Roman Arutyunyan [Mon, 15 Mar 2021 13:25:54 +0000 (16:25 +0300)]
HTTP/3: fixed $connection_requests.

Previously, the value was always "1".

5 years agoHTTP/3: set initial_max_streams_uni default value to 3.
Roman Arutyunyan [Mon, 22 Mar 2021 12:51:14 +0000 (15:51 +0300)]
HTTP/3: set initial_max_streams_uni default value to 3.

The maximum number of HTTP/3 unidirectional client streams we can handle is 3:
control, decode and encode.  These streams are never closed.

5 years agoHTTP/3: keepalive timeout.
Roman Arutyunyan [Tue, 30 Mar 2021 13:48:38 +0000 (16:48 +0300)]
HTTP/3: keepalive timeout.

This timeout limits the time when no client request streams exist.

5 years agoQUIC: connection shutdown.
Roman Arutyunyan [Mon, 15 Mar 2021 13:39:33 +0000 (16:39 +0300)]
QUIC: connection shutdown.

The function ngx_quic_shutdown_connection() waits until all non-cancelable
streams are closed, and then closes the connection.  In HTTP/3 cancelable
streams are all unidirectional streams except push streams.

The function is called from HTTP/3 when client reaches keepalive_requests.

5 years agoHTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan [Mon, 15 Mar 2021 16:26:04 +0000 (19:26 +0300)]
HTTP/3: send GOAWAY when last request is accepted.

The last request in connection is determined according to the keepalive_requests
directive.  Requests beyond keepalive_requests are rejected.

5 years agoCore: fixed build with BPF on non-64bit platforms (ticket #2152).
Vladimir Homutov [Tue, 23 Mar 2021 07:58:18 +0000 (10:58 +0300)]
Core: fixed build with BPF on non-64bit platforms (ticket #2152).

5 years agoQUIC: bpf code regenerated.
Vladimir Homutov [Tue, 16 Mar 2021 15:17:25 +0000 (18:17 +0300)]
QUIC: bpf code regenerated.

5 years agoQUIC: fixed key extraction in bpf.
Vladimir Homutov [Mon, 15 Mar 2021 16:05:38 +0000 (19:05 +0300)]
QUIC: fixed key extraction in bpf.

In case of long header packets, dcid length was not read correctly.

While there, macros to parse uint64 was fixed as well as format specifiers
to print it in debug mode.

Thanks to Gao Yan <gaoyan09@baidu.com>.

5 years agoHTTP/3: do not push until a MAX_PUSH_ID frame is received.
Sergey Kandaurov [Tue, 16 Mar 2021 10:48:29 +0000 (13:48 +0300)]
HTTP/3: do not push until a MAX_PUSH_ID frame is received.

Fixes interop with quic-go that doesn't send MAX_PUSH_ID.

5 years agoQUIC: fixed hq ALPN id for the final draft.
Sergey Kandaurov [Tue, 16 Mar 2021 10:48:28 +0000 (13:48 +0300)]
QUIC: fixed hq ALPN id for the final draft.

It was an agreement to use "hq-interop"[1] for interoperability testing.

[1] https://github.com/quicwg/base-drafts/wiki/ALPN-IDs-used-with-QUIC

5 years agoQUIC: fixed expected TLS codepoint with final draft and BoringSSL.
Sergey Kandaurov [Tue, 16 Mar 2021 10:48:28 +0000 (13:48 +0300)]
QUIC: fixed expected TLS codepoint with final draft and BoringSSL.

A reasonable codepoint is always set[1] explicitly so that it doesn't
depend on the default library value that may change[2] in the future.

[1] https://boringssl.googlesource.com/boringssl/+/3d8b8c3d
[2] https://boringssl.googlesource.com/boringssl/+/c47bfce0

5 years agoQUIC: added error handling to ngx_hkdf_extract()/ngx_hkdf_expand().
Vladimir Homutov [Thu, 11 Mar 2021 11:43:01 +0000 (14:43 +0300)]
QUIC: added error handling to ngx_hkdf_extract()/ngx_hkdf_expand().

The OpenSSL variant of functions lacked proper error processing.

5 years agoRemoved "ch" argument from ngx_pass_open_channel().
Ruslan Ermilov [Thu, 11 Mar 2021 06:58:45 +0000 (09:58 +0300)]
Removed "ch" argument from ngx_pass_open_channel().

5 years agoMail: fixed build without SSL.
Maxim Dounin [Thu, 11 Mar 2021 01:46:26 +0000 (04:46 +0300)]
Mail: fixed build without SSL.

Broken by d84f13618277 and 12ea1de7d87c (1.19.8).

Reported by Sergey Osokin.

5 years agoVersion bump.
Maxim Dounin [Thu, 11 Mar 2021 01:46:22 +0000 (04:46 +0300)]
Version bump.

5 years agoHTTP/3: fixed server push.
Sergey Kandaurov [Wed, 10 Mar 2021 14:56:34 +0000 (17:56 +0300)]
HTTP/3: fixed server push.

5 years agoMerged with the default branch.
Sergey Kandaurov [Wed, 10 Mar 2021 12:39:01 +0000 (15:39 +0300)]
Merged with the default branch.

5 years agorelease-1.19.8 tag
Maxim Dounin [Tue, 9 Mar 2021 15:27:51 +0000 (18:27 +0300)]
release-1.19.8 tag

5 years agonginx-1.19.8-RELEASE release-1.19.8
Maxim Dounin [Tue, 9 Mar 2021 15:27:50 +0000 (18:27 +0300)]
nginx-1.19.8-RELEASE

5 years agoUpdated OpenSSL used for win32 builds.
Maxim Dounin [Tue, 9 Mar 2021 13:38:55 +0000 (16:38 +0300)]
Updated OpenSSL used for win32 builds.

5 years agoREADME: http3_max_field_size was removed in ae2e68f206f9.
Sergey Kandaurov [Sat, 6 Mar 2021 21:23:25 +0000 (00:23 +0300)]
README: http3_max_field_size was removed in ae2e68f206f9.

5 years agoREADME: bump browsers' version after 81bb3a690c10 (old drafts rip).
Sergey Kandaurov [Sat, 6 Mar 2021 21:23:23 +0000 (00:23 +0300)]
README: bump browsers' version after 81bb3a690c10 (old drafts rip).

5 years agoMail: sending of the PROXY protocol to backends.
Maxim Dounin [Fri, 5 Mar 2021 14:16:32 +0000 (17:16 +0300)]
Mail: sending of the PROXY protocol to backends.

Activated with the "proxy_protocol" directive.  Can be combined with
"listen ... proxy_protocol;" and "set_real_ip_from ...;" to pass
client address provided to nginx in the PROXY protocol header.

5 years agoMail: realip module.
Maxim Dounin [Fri, 5 Mar 2021 14:16:29 +0000 (17:16 +0300)]
Mail: realip module.

When configured with the "set_real_ip_from", it can set client's IP
address as visible in logs to the one obtained via the PROXY protocol.

5 years agoMail: parsing of the PROXY protocol from clients.
Maxim Dounin [Fri, 5 Mar 2021 14:16:24 +0000 (17:16 +0300)]
Mail: parsing of the PROXY protocol from clients.

Activated with the "proxy_protocol" parameter of the "listen" directive.
Obtained information is passed to the auth_http script in Proxy-Protocol-Addr,
Proxy-Protocol-Port, Proxy-Protocol-Server-Addr, and Proxy-Protocol-Server-Port
headers.

5 years agoMail: made auth http creating request easier to extend.
Maxim Dounin [Fri, 5 Mar 2021 14:16:23 +0000 (17:16 +0300)]
Mail: made auth http creating request easier to extend.

5 years agoMail: fixed log action after SSL handshake.
Maxim Dounin [Fri, 5 Mar 2021 14:16:20 +0000 (17:16 +0300)]
Mail: fixed log action after SSL handshake.

5 years agoMail: postponed session initialization under accept mutex.
Maxim Dounin [Fri, 5 Mar 2021 14:16:19 +0000 (17:16 +0300)]
Mail: postponed session initialization under accept mutex.

Similarly to 40e8ce405859 in the stream module, this reduces the time
accept mutex is held.  This also simplifies following changes to
introduce PROXY protocol support.

5 years agoMail: added missing event handling after reading data.
Maxim Dounin [Fri, 5 Mar 2021 14:16:17 +0000 (17:16 +0300)]
Mail: added missing event handling after reading data.

If we need to be notified about further events, ngx_handle_read_event()
needs to be called after a read event is processed.  Without this,
an event can be removed from the kernel and won't be reported again,
notably when using oneshot event methods, such as eventport on Solaris.

For consistency, existing ngx_handle_read_event() call removed from
ngx_mail_read_command(), as this call only covers one of the code paths
where ngx_mail_read_command() returns NGX_AGAIN.  Instead, appropriate
processing added to the callers, covering all code paths where NGX_AGAIN
is returned.

5 years agoMail: added missing event handling after blocking events.
Maxim Dounin [Fri, 5 Mar 2021 14:16:16 +0000 (17:16 +0300)]
Mail: added missing event handling after blocking events.

As long as a read event is blocked (ignored), ngx_handle_read_event()
needs to be called to make sure no further notifications will be
triggered when using level-triggered event methods, such as select() or
poll().

5 years agoEvents: fixed eventport handling in ngx_handle_read_event().
Maxim Dounin [Fri, 5 Mar 2021 14:16:15 +0000 (17:16 +0300)]
Events: fixed eventport handling in ngx_handle_read_event().

The "!rev->ready" test seems to be a typo, introduced in the original
commit (719:f30b1a75fd3b).  The ngx_handle_write_event() code properly
tests for "rev->ready" instead.

Due to this typo, read events might be unexpectedly removed during
proxying after an event on the other part of the proxied connection.
Catched by mail proxying tests.

5 years agoSSL: fixed build by Sun C with old OpenSSL versions.
Maxim Dounin [Fri, 5 Mar 2021 14:16:13 +0000 (17:16 +0300)]
SSL: fixed build by Sun C with old OpenSSL versions.

Sun C complains about "statement not reached" if a "return" is followed
by additional statements.

5 years agoProxy: variables support in "proxy_cookie_flags" flags.
Ruslan Ermilov [Mon, 1 Mar 2021 21:58:24 +0000 (00:58 +0300)]
Proxy: variables support in "proxy_cookie_flags" flags.

5 years agoIntroduced strerrordesc_np() support.
Maxim Dounin [Mon, 1 Mar 2021 17:00:45 +0000 (20:00 +0300)]
Introduced strerrordesc_np() support.

The strerrordesc_np() function, introduced in glibc 2.32, provides an
async-signal-safe way to obtain error messages.  This makes it possible
to avoid copying error messages.

5 years agoImproved maximum errno detection.
Maxim Dounin [Mon, 1 Mar 2021 17:00:43 +0000 (20:00 +0300)]
Improved maximum errno detection.

Previously, systems without sys_nerr (or _sys_nerr) were handled with an
assumption that errors start at 0 and continuous.  This is, however, not
something POSIX requires, and not true on some platforms.

Notably, on Linux, where sys_nerr is no longer available for newly linked
binaries starting with glibc 2.32, there are gaps in error list, which
used to stop us from properly detecting maximum errno.  Further, on
GNU/Hurd errors start at 0x40000001.

With this change, maximum errno detection is moved to the runtime code,
now able to ignore gaps, and also detects the first error if needed.
This fixes observed "Unknown error" messages as seen on Linux with
glibc 2.32 and on GNU/Hurd.

5 years agoHTTP/2: client_header_timeout before first request (ticket #2142).
Maxim Dounin [Mon, 1 Mar 2021 14:31:28 +0000 (17:31 +0300)]
HTTP/2: client_header_timeout before first request (ticket #2142).

With this change, behaviour of HTTP/2 becomes even closer to HTTP/1.x,
and client_header_timeout instead of keepalive_timeout is used before
the first request is received.

This fixes HTTP/2 connections being closed even before the first request
if "keepalive_timeout 0;" was used in the configuration; the problem
appeared in f790816a0e87 (1.19.7).

5 years agoContrib: vim syntax, default highlighting (ticket #2141).
Maxim Dounin [Thu, 25 Feb 2021 20:42:25 +0000 (23:42 +0300)]
Contrib: vim syntax, default highlighting (ticket #2141).

Using default highlighting makes it possible to easily overrule
highlighting specified in the syntax file, see ":highlight-default"
in vim help for details.

5 years agoSSL: added check for debugging.
Maxim Dounin [Sat, 20 Feb 2021 15:03:04 +0000 (18:03 +0300)]
SSL: added check for debugging.

If debugging is not enabled, there is no need to do extra work in
ngx_ssl_verify_callback() and ngx_ssl_handshake_log().

5 years agoSSL: added missed error reporting during variables evaluation.
Maxim Dounin [Sat, 20 Feb 2021 15:02:54 +0000 (18:02 +0300)]
SSL: added missed error reporting during variables evaluation.

5 years agoSSL: X509_NAME_oneline() error handling.
Maxim Dounin [Sat, 20 Feb 2021 15:02:49 +0000 (18:02 +0300)]
SSL: X509_NAME_oneline() error handling.

5 years agoConfigure: marked top-level make targets as phony.
Ruslan Ermilov [Sat, 20 Feb 2021 09:44:26 +0000 (12:44 +0300)]
Configure: marked top-level make targets as phony.

Reported by Thibault NĂ©lis.

5 years agoVersion bump.
Ruslan Ermilov [Sat, 20 Feb 2021 09:44:07 +0000 (12:44 +0300)]
Version bump.

5 years agoUpdated the list of supported drafts.
Sergey Kandaurov [Fri, 19 Feb 2021 14:27:41 +0000 (17:27 +0300)]
Updated the list of supported drafts.

5 years agoQUIC: multiple versions support.
Sergey Kandaurov [Fri, 19 Feb 2021 14:27:19 +0000 (17:27 +0300)]
QUIC: multiple versions support.

Draft-29 and beyond are now supported simultaneously, no need to recompile.

5 years agoQUIC: removed support prior to draft-29.
Sergey Kandaurov [Thu, 18 Feb 2021 16:21:09 +0000 (19:21 +0300)]
QUIC: removed support prior to draft-29.

5 years agoQUIC: set idle timer when sending an ack-eliciting packet.
Roman Arutyunyan [Thu, 18 Feb 2021 09:22:28 +0000 (12:22 +0300)]
QUIC: set idle timer when sending an ack-eliciting packet.

As per quic-transport-34:

   An endpoint also restarts its idle timer when sending an ack-eliciting
   packet if no other ack-eliciting packets have been sent since last receiving
   and processing a packet.

Previously, the timer was set for any packet.

5 years agoHTTP/3: limited client header size.
Roman Arutyunyan [Wed, 17 Feb 2021 08:58:32 +0000 (11:58 +0300)]
HTTP/3: limited client header size.

The limit is the size of all large client header buffers.  Client header size
is the total size of all client header names and values.

5 years agoHTTP/3: introduced ngx_http_v3_parse_t structure.
Roman Arutyunyan [Wed, 17 Feb 2021 12:56:34 +0000 (15:56 +0300)]
HTTP/3: introduced ngx_http_v3_parse_t structure.

The structure is used to parse an HTTP/3 request.  An object of this type is
added to ngx_http_request_t instead of h3_parse generic pointer.

Also, the new field is located outside of the request ephemeral zone to keep it
safe after request headers are parsed.

5 years agorelease-1.19.7 tag
Maxim Dounin [Tue, 16 Feb 2021 15:57:18 +0000 (18:57 +0300)]
release-1.19.7 tag

5 years agonginx-1.19.7-RELEASE release-1.19.7
Maxim Dounin [Tue, 16 Feb 2021 15:57:18 +0000 (18:57 +0300)]
nginx-1.19.7-RELEASE

5 years agoHTTP/3: removed http3_max_field_size.
Roman Arutyunyan [Tue, 16 Feb 2021 15:50:01 +0000 (18:50 +0300)]
HTTP/3: removed http3_max_field_size.

Instead, size of one large_client_header_buffers buffer is used.

5 years agoMerged with the default branch.
Sergey Kandaurov [Wed, 17 Feb 2021 11:48:35 +0000 (14:48 +0300)]
Merged with the default branch.

5 years agoQUIC: added ability to reset a stream.
Sergey Kandaurov [Wed, 17 Feb 2021 11:25:07 +0000 (14:25 +0300)]
QUIC: added ability to reset a stream.

5 years agoQUIC: fixed indentation.
Sergey Kandaurov [Mon, 15 Feb 2021 11:54:28 +0000 (14:54 +0300)]
QUIC: fixed indentation.

5 years agoQUIC: added check of client transport parameters.
Vladimir Homutov [Mon, 15 Feb 2021 11:05:46 +0000 (14:05 +0300)]
QUIC: added check of client transport parameters.

Parameters sent by client are verified and defaults are set for parameters
omitted by client.

5 years agoHTTP/2: removed http2_max_field_size and http2_max_header_size.
Maxim Dounin [Thu, 11 Feb 2021 18:52:26 +0000 (21:52 +0300)]
HTTP/2: removed http2_max_field_size and http2_max_header_size.

Instead, size of one large_client_header_buffers buffer and all large
client header buffers are used.

5 years agoHTTP/2: keepalive_timeout now armed once between requests.
Maxim Dounin [Thu, 11 Feb 2021 18:52:24 +0000 (21:52 +0300)]
HTTP/2: keepalive_timeout now armed once between requests.

Previously, PINGs and other frames extended possible keepalive time,
making it possible to keep an open HTTP/2 connection for a long time.
Now the connection is always closed as long as keepalive_timeout expires,
similarly to how it happens in HTTP/1.x.

Note that as a part of this change, incomplete frames are no longer
trigger a separate timeout, so http2_recv_timeout (replaced by
client_header_timeout in previous patches) is essentially cancelled.
The client_header_timeout is, however, used for SSL handshake and
while reading HEADERS frames.

5 years agoHTTP/2: removed http2_idle_timeout and http2_max_requests.
Maxim Dounin [Thu, 11 Feb 2021 18:52:23 +0000 (21:52 +0300)]
HTTP/2: removed http2_idle_timeout and http2_max_requests.

Instead, keepalive_timeout and keepalive_requests are now used.  This
is expected to simplify HTTP/2 code and usage.  This also matches
directives used by upstream module for all protocols.

In case of default settings, this effectively changes maximum number
of requests per connection from 1000 to 100.  This looks acceptable,
especially given that HTTP/2 code now properly supports lingering close.

Further, this changes default keepalive timeout in HTTP/2 from 300 seconds
to 75 seconds.  This also looks acceptable, and larger than PING interval
used by Firefox (network.http.spdy.ping-threshold defaults to 58s),
the only browser to use PINGs.

5 years agoHTTP/2: removed http2_recv_timeout.
Maxim Dounin [Thu, 11 Feb 2021 18:52:20 +0000 (21:52 +0300)]
HTTP/2: removed http2_recv_timeout.

Instead, the client_header_timeout is now used for HTTP/2 reading.
Further, the timeout is changed to be set once till no further data
left to read, similarly to how client_header_timeout is used in other
places.

5 years agoHTTP/2: removed SPDY directives handling.
Maxim Dounin [Thu, 11 Feb 2021 18:52:19 +0000 (21:52 +0300)]
HTTP/2: removed SPDY directives handling.

The spdy_* directives are not available since introduction of HTTP/2 module
in nginx 1.9.5 more than five years ago.

5 years agoHTTP/2: fixed reusing connections with active requests.
Maxim Dounin [Thu, 11 Feb 2021 18:52:17 +0000 (21:52 +0300)]
HTTP/2: fixed reusing connections with active requests.

New connections are marked reusable by ngx_http_init_connection() if there
are no data available for reading.  As a result, if SSL is not used,
ngx_http_v2_init() might be called when the connection is marked reusable.
If a HEADERS frame is immediately available for reading, this resulted
in connection being preserved in reusable state with an active request,
and possibly closed later as if during worker shutdown (that is, after
all active requests were finalized).

Fix is to explicitly mark connections non-reusable in ngx_http_v2_init()
instead of (incorrectly) assuming they are already non-reusable.

Found by Sergey Kandaurov.

5 years agoHTTP/2: reuse of connections with incomplete frames.
Maxim Dounin [Thu, 11 Feb 2021 18:52:12 +0000 (21:52 +0300)]
HTTP/2: reuse of connections with incomplete frames.

Prodded by Taewoo Kim.

5 years agoAdditional connections reuse.
Maxim Dounin [Thu, 11 Feb 2021 18:52:11 +0000 (21:52 +0300)]
Additional connections reuse.

If ngx_drain_connections() fails to immediately reuse any connections
and there are no free connections, it now additionally tries to reuse
a connection again.  This helps to provide at least one free connection
in case of HTTP/2 with lingering close, where merely trying to reuse
a connection once does not free it, but makes it reusable again,
waiting for lingering close.

5 years agoReuse of connections in lingering close.
Maxim Dounin [Thu, 11 Feb 2021 18:52:09 +0000 (21:52 +0300)]
Reuse of connections in lingering close.

This is particularly important in HTTP/2, where keepalive connections
are closed with lingering.  Before the patch, reusing a keepalive HTTP/2
connection resulted in the connection waiting for lingering close to
remain in the reusable connections queue, preventing ngx_drain_connections()
from closing additional connections.

The patch fixes it by marking the connection reusable again, and so
moving it in the reusable connections queue.  Further, it makes actually
possible to reuse such connections if needed.

5 years agoQUIC: updated list of transport parameters to be sent.
Vladimir Homutov [Mon, 8 Feb 2021 17:48:25 +0000 (20:48 +0300)]
QUIC: updated list of transport parameters to be sent.

The "max_ack_delay", "ack_delay_exponent", and "max_udp_payload_size"
transport parameters were not communicated to client.

The "disable_active_migration" and "active_connection_id_limit"
parameters were not saved into zero-rtt context.

5 years agoQUIC: distinguish reserved transport parameters in logging.
Vladimir Homutov [Wed, 10 Feb 2021 11:10:14 +0000 (14:10 +0300)]
QUIC: distinguish reserved transport parameters in logging.

  18.1.  Reserved Transport Parameters

     Transport parameters with an identifier of the form "31 * N + 27" for
     integer values of N are reserved to exercise the requirement that
     unknown transport parameters be ignored.  These transport parameters
     have no semantics, and can carry arbitrary values.

5 years agoQUIC: send PING frames on PTO expiration.
Roman Arutyunyan [Fri, 12 Feb 2021 11:51:53 +0000 (14:51 +0300)]
QUIC: send PING frames on PTO expiration.

Two PING frames are sent per level that generate two UDP datagrams.

5 years agoQUIC: improved setting the lost timer.
Roman Arutyunyan [Fri, 12 Feb 2021 11:40:33 +0000 (14:40 +0300)]
QUIC: improved setting the lost timer.

Setting the timer is brought into compliance with quic-recovery-34.  Now it's
set from a single function ngx_quic_set_lost_timer() that takes into account
both loss detection and PTO.  The following issues are fixed with this change:

- when in loss detection mode, discarding a context could turn off the
  timer forever after switching to the PTO mode
- when in loss detection mode, sending a packet resulted in rescheduling the
  timer as if it's always in the PTO mode

5 years agoQUIC: disabled non-immediate ACKs for Initial and Handshake.
Roman Arutyunyan [Thu, 4 Feb 2021 17:39:47 +0000 (20:39 +0300)]
QUIC: disabled non-immediate ACKs for Initial and Handshake.

As per quic-transport-33:

   An endpoint MUST acknowledge all ack-eliciting Initial and Handshake
   packets immediately

If a packet carrying Initial or Handshake ACK was lost, a non-immediate ACK
should not be sent later.  Instead, client is expected to send a new packet
to acknowledge.

Sending non-immediate ACKs for Initial packets can cause the client to
generate an inflated RTT sample.

5 years agoQUIC: fixed logging ACK frames.
Roman Arutyunyan [Tue, 9 Feb 2021 11:31:36 +0000 (14:31 +0300)]
QUIC: fixed logging ACK frames.

Previously, the wrong end pointer was used, which could lead to errors
"quic failed to parse ack frame gap".

5 years agoQUIC: the "quic_host_key" directive.
Vladimir Homutov [Mon, 8 Feb 2021 13:49:33 +0000 (16:49 +0300)]
QUIC: the "quic_host_key" directive.

The token generation in QUIC is reworked. Single host key is used to generate
all required keys of needed sizes using HKDF.

The "quic_stateless_reset_token_key" directive is removed.  Instead, the
"quic_host_key" directive is used, which reads key from file, or sets it
to random bytes if not specified.