]> git.kaiwu.me - nginx.git/log
nginx.git
5 years agoHTTP/3: fixed server push after 9ec3e71f8a61.
Roman Arutyunyan [Tue, 18 May 2021 15:17:25 +0000 (18:17 +0300)]
HTTP/3: fixed server push after 9ec3e71f8a61.

When using server push, a segfault occured because
ngx_http_v3_create_push_request() accessed ngx_http_v3_session_t object the old
way.  Prior to 9ec3e71f8a61, HTTP/3 session was stored directly in c->data.
Now it's referenced by the v3_session field of ngx_http_connection_t.

5 years agoQUIC: generic buffering for stream input.
Roman Arutyunyan [Wed, 5 May 2021 14:15:20 +0000 (17:15 +0300)]
QUIC: generic buffering for stream input.

Previously each stream had an input buffer.  Now memory is allocated as
bytes arrive.  Generic buffering mechanism is used for this.

5 years agoQUIC: simplified sending 1-RTT only frames.
Sergey Kandaurov [Wed, 5 May 2021 16:32:49 +0000 (19:32 +0300)]
QUIC: simplified sending 1-RTT only frames.

5 years agoQUIC: relaxed client id requirements.
Vladimir Homutov [Wed, 5 May 2021 15:11:55 +0000 (18:11 +0300)]
QUIC: relaxed client id requirements.

Client IDs cannot be reused on different paths.  This change allows to reuse
client id previosly seen on the same path (but with different dcid) in case
when no unused client IDs are available.

5 years agoQUIC: consider NEW_CONNECTION_ID a probing frame.
Vladimir Homutov [Thu, 6 May 2021 09:36:14 +0000 (12:36 +0300)]
QUIC: consider NEW_CONNECTION_ID a probing frame.

According to quic-transport, 9.1:

   PATH_CHALLENGE, PATH_RESPONSE, NEW_CONNECTION_ID, and PADDING frames
   are "probing frames", and all other frames are "non-probing frames".

5 years agoHTTP/3: clean up table from session cleanup handler.
Roman Arutyunyan [Wed, 28 Apr 2021 08:30:27 +0000 (11:30 +0300)]
HTTP/3: clean up table from session cleanup handler.

Previously table had a separate cleanup handler.

5 years agoHTTP/3: moved session initialization to a separate file.
Roman Arutyunyan [Wed, 5 May 2021 12:15:48 +0000 (15:15 +0300)]
HTTP/3: moved session initialization to a separate file.

Previously it was in ngx_http_v3_streams.c, but it's unrelated to streams.

5 years agoHTTP/3: separate header files for existing source files.
Roman Arutyunyan [Wed, 5 May 2021 12:09:23 +0000 (15:09 +0300)]
HTTP/3: separate header files for existing source files.

5 years agoHTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan [Wed, 5 May 2021 12:00:17 +0000 (15:00 +0300)]
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.

Previously it was parsed in ngx_http_v3_streams.c, while the streams were
parsed in ngx_http_v3_parse.c.  Now all parsing is done in one file.  This
simplifies parsing API and cleans up ngx_http_v3_streams.c.

5 years agoHTTP/3: renamed ngx_http_v3_client_XXX() functions.
Roman Arutyunyan [Tue, 27 Apr 2021 18:32:50 +0000 (21:32 +0300)]
HTTP/3: renamed ngx_http_v3_client_XXX() functions.

The functions are renamed to ngx_http_v3_send_XXX() similar to
ngx_http_v3_send_settings() and ngx_http_v3_send_goaway().

5 years agoHTTP/3: renamed ngx_http_v3_connection_t to ngx_http_v3_session_t.
Roman Arutyunyan [Wed, 5 May 2021 09:54:10 +0000 (12:54 +0300)]
HTTP/3: renamed ngx_http_v3_connection_t to ngx_http_v3_session_t.

5 years agoHTTP/3: reference h3c directly from ngx_http_connection_t.
Roman Arutyunyan [Wed, 5 May 2021 11:53:36 +0000 (14:53 +0300)]
HTTP/3: reference h3c directly from ngx_http_connection_t.

Previously, an ngx_http_v3_connection_t object was created for HTTP/3 and
then assinged to c->data instead of the generic ngx_http_connection_t object.
Now a direct reference is added to ngx_http_connection_t, which is less
confusing and does not require a flag for http3.

5 years agoHTTP/3: ngx_http_v3_get_session() macro.
Roman Arutyunyan [Fri, 30 Apr 2021 16:10:11 +0000 (19:10 +0300)]
HTTP/3: ngx_http_v3_get_session() macro.

It's used instead of accessing c->quic->parent->data directly.  Apart from being
simpler, it allows to change the way session is stored in the future by changing
the macro.

5 years agoHTTP/3: moved Stream Cancellation stub to ngx_http_v3_streams.c.
Roman Arutyunyan [Wed, 5 May 2021 12:15:17 +0000 (15:15 +0300)]
HTTP/3: moved Stream Cancellation stub to ngx_http_v3_streams.c.

5 years agoHTTP/3: fixed decoder stream stubs.
Roman Arutyunyan [Tue, 4 May 2021 10:38:59 +0000 (13:38 +0300)]
HTTP/3: fixed decoder stream stubs.

Now ngx_http_v3_ack_header() and ngx_http_v3_inc_insert_count() always generate
decoder error.  Our implementation does not use dynamic tables and does not
expect client to send Section Acknowledgement or Insert Count Increment.

Stream Cancellation, on the other hand, is allowed to be sent anyway.  This is
why ngx_http_v3_cancel_stream() does not return an error.

5 years agoHTTP/3: reject empty DATA and HEADERS frames on control stream.
Roman Arutyunyan [Wed, 5 May 2021 10:28:05 +0000 (13:28 +0300)]
HTTP/3: reject empty DATA and HEADERS frames on control stream.

Previously only non-empty frames were rejected.

5 years agoQUIC: fixed build with NGX_QUIC_DEBUG_ALLOC enabled.
Vladimir Homutov [Wed, 28 Apr 2021 10:37:18 +0000 (13:37 +0300)]
QUIC: fixed build with NGX_QUIC_DEBUG_ALLOC enabled.

5 years agoQUIC: connection migration.
Vladimir Homutov [Thu, 29 Apr 2021 12:35:02 +0000 (15:35 +0300)]
QUIC: connection migration.

The patch adds proper transitions between multiple networking addresses that
can be used by a single quic connection. New networking paths are validated
using PATH_CHALLENGE/PATH_RESPONSE frames.

5 years agoHTTP/3: adjusted control stream parsing.
Vladimir Homutov [Thu, 22 Apr 2021 10:49:18 +0000 (13:49 +0300)]
HTTP/3: adjusted control stream parsing.

7.2.1:
   If a DATA frame is received on a control stream, the recipient MUST
   respond with a connection error of type H3_FRAME_UNEXPECTED;

7.2.2:
   If a HEADERS frame is received on a control stream, the recipient MUST
   respond with a connection error (Section 8) of type H3_FRAME_UNEXPECTED.

5 years agoQUIC: renamed stream variables from sn to qs.
Roman Arutyunyan [Mon, 19 Apr 2021 14:25:56 +0000 (17:25 +0300)]
QUIC: renamed stream variables from sn to qs.

Currently both names are used which is confusing.  Historically these were
different objects, but now it's the same one.  The name qs (quic stream) makes
more sense than sn (stream node).

5 years agoQUIC: renamed stream field from c to connection.
Roman Arutyunyan [Mon, 19 Apr 2021 14:21:07 +0000 (17:21 +0300)]
QUIC: renamed stream field from c to connection.

5 years agoQUIC: fixed permitted packet types for PATH_RESPONSE.
Sergey Kandaurov [Fri, 16 Apr 2021 20:03:59 +0000 (23:03 +0300)]
QUIC: fixed permitted packet types for PATH_RESPONSE.

PATH_RESPONSE was explicitly forbidden in 0-RTT since at least draft-22, but
the Frame Types table was not updated until recently while in IESG evaluation.

5 years agoQUIC: added missing checks for limits in stream frames parsing.
Vladimir Homutov [Mon, 19 Apr 2021 06:46:37 +0000 (09:46 +0300)]
QUIC: added missing checks for limits in stream frames parsing.

5 years agoQUIC: fixed parsing of unknown frame types.
Vladimir Homutov [Mon, 19 Apr 2021 08:36:41 +0000 (11:36 +0300)]
QUIC: fixed parsing of unknown frame types.

The ngx_quic_frame_allowed() function only expects known frame types.

5 years agoQUIC: avoid sending extra frames in case of error.
Vladimir Homutov [Thu, 15 Apr 2021 09:17:19 +0000 (12:17 +0300)]
QUIC: avoid sending extra frames in case of error.

5 years agoQUIC: normalize header inclusion.
Sergey Kandaurov [Tue, 13 Apr 2021 09:38:34 +0000 (12:38 +0300)]
QUIC: normalize header inclusion.

Stop including QUIC headers with no user-serviceable parts inside.
This allows to provide a much cleaner QUIC interface.  To cope with that,
ngx_quic_derive_key() is now explicitly exported for v3 and quic modules.
Additionally, this completely hides the ngx_quic_keys_t internal type.

5 years agoQUIC: ngx_quic_frames_stream_t made opaque.
Sergey Kandaurov [Tue, 13 Apr 2021 08:49:52 +0000 (11:49 +0300)]
QUIC: ngx_quic_frames_stream_t made opaque.

5 years agoQUIC: separate files for SSL library interfaces.
Vladimir Homutov [Wed, 14 Apr 2021 11:47:04 +0000 (14:47 +0300)]
QUIC: separate files for SSL library interfaces.

5 years agoQUIC: separate files for tokens related processing.
Vladimir Homutov [Tue, 13 Apr 2021 11:41:52 +0000 (14:41 +0300)]
QUIC: separate files for tokens related processing.

5 years agoQUIC: separate files for output and ack related processing.
Vladimir Homutov [Tue, 13 Apr 2021 11:41:20 +0000 (14:41 +0300)]
QUIC: separate files for output and ack related processing.

5 years agoQUIC: separate files for stream related processing.
Vladimir Homutov [Tue, 13 Apr 2021 11:40:00 +0000 (14:40 +0300)]
QUIC: separate files for stream related processing.

5 years agoQUIC: separate files for frames related processing.
Vladimir Homutov [Tue, 13 Apr 2021 11:38:46 +0000 (14:38 +0300)]
QUIC: separate files for frames related processing.

5 years agoQUIC: separate files for connection id related processing.
Vladimir Homutov [Tue, 13 Apr 2021 11:37:41 +0000 (14:37 +0300)]
QUIC: separate files for connection id related processing.

5 years agoQUIC: headers cleanup.
Vladimir Homutov [Wed, 14 Apr 2021 11:47:37 +0000 (14:47 +0300)]
QUIC: headers cleanup.

The "ngx_event_quic.h" header file now contains only public definitions,
used by modules.  All internal definitions are moved into
the "ngx_event_quic_connection.h" header file.

5 years agoQUIC: separate function for connection ids initialization.
Vladimir Homutov [Fri, 9 Apr 2021 08:33:10 +0000 (11:33 +0300)]
QUIC: separate function for connection ids initialization.

The function correctly cleans up resources in case of failure to create
initial server id: it removes previously created udp node for odcid from
listening rbtree.

5 years agoQUIC: fixed ngx_quic_send_ack_range() function.
Vladimir Homutov [Wed, 7 Apr 2021 10:09:26 +0000 (13:09 +0300)]
QUIC: fixed ngx_quic_send_ack_range() function.

Created frame was not added to the output queue.

5 years agoQUIC: fixed debug message macro.
Vladimir Homutov [Mon, 5 Apr 2021 08:35:46 +0000 (11:35 +0300)]
QUIC: fixed debug message macro.

5 years agoQUIC: added error codes and messages from latest drafts.
Vladimir Homutov [Mon, 5 Apr 2021 08:31:03 +0000 (11:31 +0300)]
QUIC: added error codes and messages from latest drafts.

The AEAD_LIMIT_REACHED was addeded in draft-31.
The NO_VIABLE_PATH was added in draft-33.

5 years agoHTTP/3: keepalive_time support.
Sergey Kandaurov [Fri, 16 Apr 2021 16:42:03 +0000 (19:42 +0300)]
HTTP/3: keepalive_time support.

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 agorelease-1.19.10 tag
Maxim Dounin [Tue, 13 Apr 2021 15:13:59 +0000 (18:13 +0300)]
release-1.19.10 tag

5 years agonginx-1.19.10-RELEASE release-1.19.10
Maxim Dounin [Tue, 13 Apr 2021 15:13:58 +0000 (18:13 +0300)]
nginx-1.19.10-RELEASE

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 agoChanged keepalive_requests default to 1000 (ticket #2155).
Maxim Dounin [Wed, 7 Apr 2021 21:16:30 +0000 (00:16 +0300)]
Changed keepalive_requests default to 1000 (ticket #2155).

It turns out no browsers implement HTTP/2 GOAWAY handling properly, and
large enough number of resources on a page results in failures to load
some resources.  In particular, Chrome seems to experience errors if
loading of all resources requires more than 1 connection (while it
is usually able to retry requests at least once, even with 2 connections
there are occasional failures for some reason), Safari if loading requires
more than 3 connections, and Firefox if loading requires more than 10
connections (can be configured with network.http.request.max-attempts,
defaults to 10).

It does not seem to be possible to resolve this on nginx side, even strict
limiting of maximum concurrency does not help, and loading issues seems to
be triggered by merely queueing of a request for a particular connection.
The only available mitigation seems to use higher keepalive_requests value.

The new default is 1000 and matches previously used default for
http2_max_requests.  It is expected to be enough for 99.98% of the pages
(https://httparchive.org/reports/state-of-the-web?start=latest#reqTotal)
even in Chrome.

5 years agoAdded $connection_time variable.
Maxim Dounin [Wed, 7 Apr 2021 21:16:17 +0000 (00:16 +0300)]
Added $connection_time variable.

5 years agoIntroduced the "keepalive_time" directive.
Maxim Dounin [Wed, 7 Apr 2021 21:15:48 +0000 (00:15 +0300)]
Introduced the "keepalive_time" directive.

Similar to lingering_time, it limits total connection lifetime before
keepalive is switched off.  The default is 1 hour, which is close to
the total maximum connection lifetime possible with default
keepalive_requests and keepalive_timeout.

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 agoHTTP/2: relaxed PRIORITY frames limit.
Maxim Dounin [Tue, 6 Apr 2021 23:03:29 +0000 (02:03 +0300)]
HTTP/2: relaxed PRIORITY frames limit.

Firefox uses several idle streams for PRIORITY frames[1], and
"http2_max_concurrent_streams 1;" results in "client sent too many
PRIORITY frames" errors when a connection is established by Firefox.

Fix is to relax the PRIORITY frames limit to use at least 100 as
the initial value (which is the recommended by the HTTP/2 protocol
minimum limit on the number of concurrent streams, so it is not
unreasonable for clients to assume that similar number of idle streams
can be used for prioritization).

[1] https://hg.mozilla.org/mozilla-central/file/32a9e6e145d6e3071c3993a20bb603a2f388722b/netwerk/protocol/http/Http2Stream.cpp#l1270

5 years agoConfigure: fixed --test-build-epoll on FreeBSD 13.
Maxim Dounin [Mon, 5 Apr 2021 17:14:16 +0000 (20:14 +0300)]
Configure: fixed --test-build-epoll on FreeBSD 13.

In FreeBSD 13, eventfd(2) was added, and this breaks build
with --test-build-epoll and without --with-file-aio.  Fix is
to move eventfd(2) detection to auto/os/linux, as it is used
only on Linux as a notification mechanism for epoll().

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.