]> git.kaiwu.me - nginx.git/log
nginx.git
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 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.

5 years agoQUIC: use server ack_delay_exponent when sending ack.
Roman Arutyunyan [Thu, 4 Feb 2021 11:35:36 +0000 (14:35 +0300)]
QUIC: use server ack_delay_exponent when sending ack.

Previously, client one was used.

5 years agoQUIC: removed redundant "app" flag from ngx_quic_close_frame_t.
Sergey Kandaurov [Wed, 3 Feb 2021 09:39:41 +0000 (12:39 +0300)]
QUIC: removed redundant "app" flag from ngx_quic_close_frame_t.

The flag was introduced to create type-aware CONNECTION_CLOSE frames,
and now is replaced with frame type information, directly accessible.
Notably, this fixes type logging for received frames in b3d9e57d0f62.

5 years agoHTTP/3: reverted version check for keepalive flag.
Roman Arutyunyan [Tue, 2 Feb 2021 12:09:48 +0000 (15:09 +0300)]
HTTP/3: reverted version check for keepalive flag.

The flag is used in ngx_http_finalize_connection() to switch client connection
to the keepalive mode.  Since eaea7dac3292 this code is not executed for HTTP/3
which allows us to revert the change and get back to the default branch code.

5 years agoHTTP/3: fixed format specifier.
Roman Arutyunyan [Mon, 1 Feb 2021 15:48:18 +0000 (18:48 +0300)]
HTTP/3: fixed format specifier.

5 years agoHTTP/2: lingering close changed to handle NGX_AGAIN.
Ruslan Ermilov [Mon, 1 Feb 2021 13:42:50 +0000 (16:42 +0300)]
HTTP/2: lingering close changed to handle NGX_AGAIN.

This part somehow slipped away from c5840ca2063d.

While it is not expected to be needed in case of lingering close,
it is good to keep it for correctness (see 2b5528023f6b).

5 years agoClean up trailers in ngx_http_clean_header() as well.
Sergey Kandaurov [Tue, 26 Jan 2021 09:39:28 +0000 (12:39 +0300)]
Clean up trailers in ngx_http_clean_header() as well.

The function has not been updated with introduction of trailers support
in 7034:1b068a4e82d8 (1.13.2).

5 years agoHTTP/3: refactored request body parser.
Roman Arutyunyan [Mon, 25 Jan 2021 13:16:47 +0000 (16:16 +0300)]
HTTP/3: refactored request body parser.

The change reduces diff to the default branch for
src/http/ngx_http_request_body.c.

Also, client Content-Length, if present, is now checked against the real body
size sent by client.

5 years agoQUIC: fixed stateless reset recognition and send.
Roman Arutyunyan [Mon, 1 Feb 2021 11:46:36 +0000 (14:46 +0300)]
QUIC: fixed stateless reset recognition and send.

Previously, if an unexpected packet was received on an existing QUIC
connection, stateless reset token was neither recognized nor sent.

5 years agoQUIC: refactored packet processing.
Roman Arutyunyan [Thu, 28 Jan 2021 09:35:18 +0000 (12:35 +0300)]
QUIC: refactored packet processing.

- split ngx_quic_process_packet() in two functions with the second one called
  ngx_quic_process_payload() in charge of decrypring and handling the payload
- renamed ngx_quic_payload_handler() to ngx_quic_handle_frames()
- moved error cleanup from ngx_quic_input() to ngx_quic_process_payload()
- moved handling closed connection from ngx_quic_handle_frames() to
  ngx_quic_process_payload()
- minor fixes

5 years agoQUIC: stateless retry.
Vladimir Homutov [Fri, 29 Jan 2021 12:53:47 +0000 (15:53 +0300)]
QUIC: stateless retry.

Previously, quic connection object was created when Retry packet was sent.
This is neither necessary nor convenient, and contradicts the idea of retry:
protecting from bad clients and saving server resources.

Now, the connection is not created, token is verified cryptographically
instead of holding it in connection.

5 years agoHTTP/3: call ngx_handle_read_event() from client header handler.
Roman Arutyunyan [Fri, 29 Jan 2021 16:42:47 +0000 (19:42 +0300)]
HTTP/3: call ngx_handle_read_event() from client header handler.

This function should be called at the end of an event handler to prepare the
event for the next handler call.  Particularly, the "active" flag is set or
cleared depending on data availability.

With this call missing in one code path, read handler was not called again
after handling the initial part of the client request, if the request was too
big to fit into a single STREAM frame.

Now ngx_handle_read_event() is called in this code path.  Also, read timer is
restarted.

5 years agoREADME: reflect renaming of several transport parameter directives.
Sergey Kandaurov [Wed, 27 Jan 2021 10:09:45 +0000 (13:09 +0300)]
README: reflect renaming of several transport parameter directives.

Reported by Kyriakos Zarifis.

5 years agoYear 2021.
Maxim Dounin [Tue, 19 Jan 2021 17:35:17 +0000 (20:35 +0300)]
Year 2021.

5 years agoCore: removed post_accept_timeout.
Maxim Dounin [Tue, 19 Jan 2021 17:32:00 +0000 (20:32 +0300)]
Core: removed post_accept_timeout.

Keeping post_accept_timeout in ngx_listening_t is no longer needed since
we've switched to 1 second timeout for deferred accept in 5541:fdb67cfc957d.

Further, using it in HTTP code can result in client_header_timeout being
used from an incorrect server block, notably if address-specific virtual
servers are used along with a wildcard listening socket, or if we've switched
to a different server block based on SNI in SSL handshake.

5 years agoRemoved incorrect optimization of HEAD requests.
Maxim Dounin [Tue, 19 Jan 2021 17:21:12 +0000 (20:21 +0300)]
Removed incorrect optimization of HEAD requests.

The stub status module and ngx_http_send_response() (used by the empty gif
module and the "return" directive) incorrectly assumed that responding
to HEAD requests always results in r->header_only being set.  This is not
true, and results in incorrect behaviour, for example, in the following
configuration:

   location / {
       image_filter size;
       return 200 test;
   }

Fix is to remove this incorrect micro-optimization from both stub status
module and ngx_http_send_response().

Reported by Chris Newton.

5 years agoUpstream: fixed zero size buf alerts on extra data (ticket #2117).
Maxim Dounin [Tue, 12 Jan 2021 13:59:31 +0000 (16:59 +0300)]
Upstream: fixed zero size buf alerts on extra data (ticket #2117).

After 7675:9afa45068b8f and 7678:bffcc5af1d72 (1.19.1), during non-buffered
simple proxying, responses with extra data might result in zero size buffers
being generated and "zero size buf" alerts in writer.  This bug is similar
to the one with FastCGI proxying fixed in 7689:da8d758aabeb.

In non-buffered mode, normally the filter function is not called if
u->length is already 0, since u->length is checked after each call of
the filter function.  There is a case when this can happen though: if
the response length is 0, and there are pre-read response body data left
after reading response headers.  As such, a check for u->length is needed
at the start of non-buffered filter functions, similar to the one
for p->length present in buffered filter functions.

Appropriate checks added to the existing non-buffered copy filters
in the upstream (used by scgi and uwsgi proxying) and proxy modules.

5 years agoContrib: vim syntax, update core and 3rd party module directives.
Gena Makhomed [Tue, 29 Dec 2020 11:13:57 +0000 (13:13 +0200)]
Contrib: vim syntax, update core and 3rd party module directives.

5 years agoVersion bump.
Maxim Dounin [Mon, 11 Jan 2021 19:06:27 +0000 (22:06 +0300)]
Version bump.

5 years agoHTTP/3: removed HTTP/3-specific code.
Roman Arutyunyan [Mon, 21 Dec 2020 17:35:13 +0000 (17:35 +0000)]
HTTP/3: removed HTTP/3-specific code.

The ngx_http_set_lingering_close() function is not called for HTTP/3.

The change reduces diff to the default branch.

5 years agoHTTP/3: client header validation.
Roman Arutyunyan [Mon, 18 Jan 2021 10:43:36 +0000 (13:43 +0300)]
HTTP/3: client header validation.

A header with the name containing null, CR, LF, colon or uppercase characters,
is now considered an error.  A header with the value containing null, CR or LF,
is also considered an error.

Also, header is considered invalid unless its name only contains lowercase
characters, digits, minus and optionally underscore.  Such header can be
optionally ignored.

5 years agoHTTP/3: added comment.
Roman Arutyunyan [Tue, 12 Jan 2021 21:08:55 +0000 (21:08 +0000)]
HTTP/3: added comment.

5 years agoHTTP/3: client pseudo-headers restrictions.
Roman Arutyunyan [Fri, 22 Jan 2021 12:57:41 +0000 (15:57 +0300)]
HTTP/3: client pseudo-headers restrictions.

- :method, :path and :scheme are expected exactly once and not empty
- :method and :scheme character validation is added
- :authority cannot appear more than once

5 years agoHTTP/3: refactored request parser.
Roman Arutyunyan [Fri, 22 Jan 2021 13:34:06 +0000 (16:34 +0300)]
HTTP/3: refactored request parser.

The change reduces diff to the default branch for
src/http/ngx_http_request.c and src/http/ngx_http_parse.c.

5 years agoQUIC: draft-33 salt and retry keys.
Sergey Kandaurov [Mon, 11 Jan 2021 12:25:48 +0000 (15:25 +0300)]
QUIC: draft-33 salt and retry keys.

Notably, the version negotiation table is updated to reject draft-33/QUICv1
(which requires a new TLS codepoint) unless explicitly asked to built with.

5 years agoQUIC: fixed header protection macro name.
Vladimir Homutov [Wed, 30 Dec 2020 17:47:35 +0000 (20:47 +0300)]
QUIC: fixed header protection macro name.

5 years agoQUIC: ngx_quic_bpf module.
Vladimir Homutov [Fri, 25 Dec 2020 12:01:15 +0000 (15:01 +0300)]
QUIC: ngx_quic_bpf module.

The quic kernel bpf helper inspects packet payload for DCID, extracts key
and routes the packet into socket matching the key.

Due to reuseport feature, each worker owns a personal socket, which is
identified by the same key, used to create DCID.

BPF objects are locked in RAM and are subject to RLIMIT_MEMLOCK.
The "ulimit -l" command may be used to setup proper limits, if maps
cannot be created with EPERM or updated with ETOOLONG.

5 years agorelease-1.19.6 tag
Maxim Dounin [Tue, 15 Dec 2020 14:41:39 +0000 (17:41 +0300)]
release-1.19.6 tag

5 years agonginx-1.19.6-RELEASE release-1.19.6
Maxim Dounin [Tue, 15 Dec 2020 14:41:39 +0000 (17:41 +0300)]
nginx-1.19.6-RELEASE

5 years agoUpdated OpenSSL used for win32 builds.
Maxim Dounin [Tue, 15 Dec 2020 13:49:24 +0000 (16:49 +0300)]
Updated OpenSSL used for win32 builds.

5 years agoCore: added interface to linux bpf() system call.
Vladimir Homutov [Tue, 15 Dec 2020 12:23:07 +0000 (15:23 +0300)]
Core: added interface to linux bpf() system call.

It contains wrappers for operations with BPF maps and for loading BPF programs.

5 years agoQUIC: ngx_quic_module.
Vladimir Homutov [Fri, 25 Dec 2020 11:18:51 +0000 (14:18 +0300)]
QUIC: ngx_quic_module.

5 years agoQUIC: moved all quic sources into src/event/quic.
Vladimir Homutov [Fri, 25 Dec 2020 11:01:28 +0000 (14:01 +0300)]
QUIC: moved all quic sources into src/event/quic.

5 years agoQUIC: removed unused <openssl/aes.h> inclusion.
Sergey Kandaurov [Tue, 22 Dec 2020 13:41:56 +0000 (16:41 +0300)]
QUIC: removed unused <openssl/aes.h> inclusion.

The low-level API was used in early QUIC development.

5 years agoQUIC: fixed -Wtype-limits with GCC <= 5 (ticket #2104).
Sergey Kandaurov [Tue, 22 Dec 2020 09:04:16 +0000 (12:04 +0300)]
QUIC: fixed -Wtype-limits with GCC <= 5 (ticket #2104).

5 years agoQUIC: fixed logging PATH_CHALLENGE/RESPONSE and build with GCC < 5.
Sergey Kandaurov [Tue, 22 Dec 2020 09:04:15 +0000 (12:04 +0300)]
QUIC: fixed logging PATH_CHALLENGE/RESPONSE and build with GCC < 5.

5 years agoQUIC: fixed building ALPN callback without debug and http2.
Sergey Kandaurov [Tue, 22 Dec 2020 09:04:15 +0000 (12:04 +0300)]
QUIC: fixed building ALPN callback without debug and http2.

5 years agoQUIC: fixed build with OpenSSL < 1.1.1.
Sergey Kandaurov [Tue, 22 Dec 2020 09:03:43 +0000 (12:03 +0300)]
QUIC: fixed build with OpenSSL < 1.1.1.

The <openssl/kdf.h> header is available since OpenSSL 1.1.0, and HKDF API
used for separate Extract and Expand steps in TLSv1.3 - since OpenSSL 1.1.1.

5 years agoQUIC: converted to SSL_CIPHER_get_protocol_id().
Sergey Kandaurov [Mon, 21 Dec 2020 12:05:43 +0000 (15:05 +0300)]
QUIC: converted to SSL_CIPHER_get_protocol_id().

This API is available in BoringSSL for quite some time:
https://boringssl.googlesource.com/boringssl/+/3743aaf

5 years agoHTTP/3: staticize internal parsing functions.
Sergey Kandaurov [Wed, 16 Dec 2020 12:47:41 +0000 (12:47 +0000)]
HTTP/3: staticize internal parsing functions.

5 years agoHTTP/3: staticize ngx_http_v3_methods.
Sergey Kandaurov [Wed, 16 Dec 2020 12:47:38 +0000 (12:47 +0000)]
HTTP/3: staticize ngx_http_v3_methods.

5 years agoMerged with the default branch.
Sergey Kandaurov [Tue, 15 Dec 2020 16:55:43 +0000 (16:55 +0000)]
Merged with the default branch.

5 years agoFixed double close of non-regular files in flv and mp4.
Maxim Dounin [Fri, 11 Dec 2020 10:42:07 +0000 (13:42 +0300)]
Fixed double close of non-regular files in flv and mp4.

With introduction of open_file_cache in 1454:f497ed7682a7, opening a file
with ngx_open_cached_file() automatically adds a cleanup handler to close
the file.  As such, calling ngx_close_file() directly for non-regular files
is no longer needed and will result in duplicate close() call.

In 1454:f497ed7682a7 ngx_close_file() call for non-regular files was removed
in the static module, but wasn't in the flv module.  And the resulting
incorrect code was later copied to the mp4 module.  Fix is to remove the
ngx_close_file() call from both modules.

Reported by Chris Newton.

5 years agoRemoved extra allocation for r->uri.
Maxim Dounin [Thu, 10 Dec 2020 17:09:39 +0000 (20:09 +0300)]
Removed extra allocation for r->uri.

The ngx_http_parse_complex_uri() function cannot make URI longer and does
not null-terminate URI, so there is no need to allocate an extra byte.  This
allocation appears to be a leftover from changes in 461:a88a3e4e158f (0.1.5),
where null-termination of r->uri and many other strings was removed.