Commit Graph
8756 Commits
Author SHA1 Message Date
nishat shabbir 82f5fd93b9 Fixed Priority parsing of large integers on 32-bit platforms
On 32-bit platforms, ngx_atoi() fails on syntactically valid Integers
above 2147483647, and the whole Priority field was rejected.  Now such
values are ignored, similar to Decimals.
2026-10-15 19:37:10 +04:00
Aleksei Bavshin c44e4c6b2d Core: fixed ioctl(FIOASYNC) argument type
The documented argument type for this operation is an integer boolean.
Passing 1 as u_long makes the call silently fail on 64-bit big-endian
platforms, as the kernel receives only high 4 bytes set to 0.
2026-10-15 08:35:38 -07:00
Aleksei Bavshin 7e40bbc09f Control API: use more portable ioctl(FIOASYNC)
While both FIOASYNC and O_ASYNC are non-standard, the former is more
widespread and is already used in ngx_process.c.

Fixes build on Solaris and Illumos.
2026-10-15 08:35:38 -07:00
Vadim Zhestikov faf9438989 SSL: workaround for i2d_SSL_SESSION() negative values
i2d_SSL_SESSION() may unexpectedly return a negative value on
memory allocation failure, even though the NULL buffer was passed,
notably in LibreSSL.

Reported by szzzy.
2026-10-15 08:15:52 -07:00
Vadim Zhestikov e72a6a0bc3 SSL: ignored EIO after shutdown with kernel TLS
After SSL shutdown, lingering close reads the socket with recv().  With
kernel TLS receive offload, which OpenSSL enables for TLS 1.3 since
3.2.0, recv() fails with EIO on a record other than application data,
such as the "close notify" alert from the client, and this was logged
at the "alert" level.

Now ngx_ssl_shutdown() marks connections with kernel TLS receive
offload, and EIO on such connections is ignored, so the read ends as
at EOF.

Reported by soukichi on GitHub.

Closes: https://github.com/nginx/nginx/issues/651
2026-10-15 08:13:24 -07:00
Vadim Zhestikov 2b84cd7dd7 Dav: restored the request URI on a destination mapping error.
The COPY and MOVE handler temporarily replaces r->uri with the
destination to map it to a path, restoring it only on success.  When
ngx_http_map_uri_to_path() failed for the destination, the handler
returned without restoring r->uri, leaving it set to the client-supplied
destination.  Later processing that derives a target from the request
URI, such as an error_page with a variable, then resolved against the
destination instead of the request target.
2026-10-15 08:12:19 -07:00
Oskar Eichler 1f214f4158 Control API: log errors from accepted socket setup
Accepted control connections discarded errno when setting close-on-exec,
nonblocking I/O, or signal ownership. The error log identified the failed
fcntl() operation but omitted the operating system reason.

Pass ngx_socket_errno to the three error logs, consistently with listener
setup and inherited socket handling.
2026-10-15 08:07:43 -07:00
Vadim Zhestikov 1f868497b7 Win32: removed unused winsock extension function pointers 2026-10-15 08:06:49 -07:00
Vadim Zhestikov b390773fad Win32: removed the iocp event module
The I/O completion ports event method has never been completed: the
module is compiled into Windows builds, but is not documented or
supported.

Prodded by Marek Ludha.
2026-10-15 08:06:49 -07:00
dgprivate 35a437d3d9 HTTP/3: avoid undefined behaviour with empty encoder field values
A zero length field value in encoder stream instructions left the value
data pointer NULL, passed then to ngx_memcpy() in ngx_http_v3_insert().
For the reasons outlined in b0a4d0fb8, it is now set to an empty string.
2026-10-15 19:00:47 +04:00
Sergey Kandaurov cae9999860 Version bump 2026-10-15 15:51:50 +04:00
Roman Arutyunyan 28c4fc458a nginx-1.31.7-RELEASE release-1.31.7 2026-10-01 21:19:27 +04:00
Roman Arutyunyan f8a23425bd Avoid post-rewrite URI to path mapping with alias
Previously, after a "rewrite" had changed the URI, and before a new
location was chosen, the new URI might not match the current location
prefix.  This becomes a problem when the location uses "alias", which
is why normally such inconsistency is detected by checking the
r->valid_location flag.  Meanwhile this flag only handles the
inconsistency when using the "break" directive or parameter.  However
in absence of those, there's still an inconsistency window from URI
change up until the end of the current set of rewrite directives.
URI to path mapping within this window might result in a buffer
overflow if location's prefix was longer than the rewritten URI.

The following example resulted in a buffer overflow with the request
"/foo/1":

location /foo/ {
    alias /bar/;
    rewrite ^/foo/.*$ /x;
    return 200 $request_filename;
}

Alternatively, $request_filename might be used in access log format,
"set", "if", "add_header", etc.

The fix is to reject URI mapping in ngx_http_map_uri_to_path() if the
r->uri_changed flag is set.
2026-10-01 21:19:27 +04:00
Roman Arutyunyan 6aa4b3fdd4 Script: reserved memory overrun protection in ngx_http_script_run()
In b76754049 buffer overrun protection in script was introduced.
However in ngx_http_script_run() data could still spill over to the
reserved area.  This had no visible effects except the return value
which could extend beyond the maximum formatted string size.  This
value is however currently unused in the nginx code.

Later in a8289aa69 string length recalculation was implemented to
protect against buffer underwrite.  Considering a possible spillover to
the reserved area, the final string size could become larger than the
allocated buffer size.  This could later result in writing beyond
the buffer boundaries.  Maximum buffer overflow is the size of the
reserved area.

This could affect calculating document root from variables in HTTP
or using access logging in HTTP or Stream.  In the case of access
logging a possible impact is limited by an off-by-one write of a null
byte.

Reported by Matt Suiche of Tolmo Inc.
2026-10-01 21:19:27 +04:00
Vadim Zhestikov 1916f26e6c SSL: synced all session ticket keys to the worker process
The per-worker ticket key mirror is allocated with three slots
(ngx_array_push_n(keys, 3)), matching the shared memory
ticket_keys[3] array and the decrypt callback, which scans all
keys->nelts slots by key name.  Key rotation, however, synced
only two slots from shared memory, leaving the third slot's
name, hmac_key, and aes_key uninitialized.

A ticket whose key name matched the uninitialized slot (which
holds unspecified pool memory, all zero in the best case) could
therefore be HMAC-verified and decrypted with uninitialized key
material, allowing a forged session.

Sync all keys->nelts slots, as ngx_ssl_ticket_keys_cleanup()
already assumes.

Reported by PhiNode Labs.
2026-10-01 21:19:27 +04:00
Vadim Zhestikov 1c173a2d87 HTTP/3: kept the skipped frame length separate from data length
ngx_http_v3_parse_data() stored the remaining length of a skipped
(unknown) frame in st->length -- the same field the request body
filter uses for the number of DATA payload bytes to pass on as
request body.  When an unknown frame was split across parser
invocations, the skip was interrupted with st->length holding the
skip remainder; on the next buffer the body filter, which calls
the parser only while st->length == 0, treated that remainder as
request body.

When proxying, this could result in sending unframed bytes, potentially
allowing for bypass of client_max_body_size, which is enforced only on
the DATA path, or an injection.

The fix is to keep unknown frame payload in a separate st->skip counter.

Reported by Hansol Lee of GOTROOT.
2026-10-01 21:19:27 +04:00
Vadim Zhestikov 6adfc05ece Limited the number of pending operations per request
Each pending asynchronous operation holds a reference in
r->main->blocked, an 8-bit field, and the increments were not checked.
With 256 operations pending on a single request the counter wrapped to
zero, after which the request could be freed while those operations
still referenced its pool.  This is the same overflow that 4ec67cf86
addressed for r->main->count, and left unaddressed for r->main->blocked.

Operations beyond the limit are now performed synchronously where a
synchronous path exists, and refused otherwise, so that the counter
cannot overflow.

Reported by cyberlancer.
2026-10-01 21:18:52 +04:00
Maxim Dounin adf76b2fea Upstream: fixed X-Accel-Redirect handling from cache files.
The X-Accel-Redirect header might appear in cache files if its handling
is ignored with the "proxy_ignore_headers" directive.  If the cache file
is later served with different settings, ngx_http_upstream_process_headers()
used to call ngx_http_upstream_finalize_request(NGX_DECLINED), which
is not expected to happen before the cleanup handler is installed and
resulted in ngx_http_finalize_request(NGX_DONE) (after 2b032e8df,
nginx 1.7.11), leading to unexpected request counter decrement, "request
count is zero" alerts, and segmentation faults.

Similarly, errors in ngx_http_upstream_process_headers() resulted in
ngx_http_upstream_finalize_request(NGX_HTTP_INTERNAL_SERVER_ERROR) being
called.  This is also not expected to happen before the cleanup handler is
installed, and resulted in ngx_http_finalize_request(NGX_DONE) without
proper request finalization.

Fix is to avoid calling ngx_http_upstream_finalize_request() from
ngx_http_upstream_process_headers(), notably when the cleanup handler
is not yet installed.  Errors are now simply return NGX_ERROR, so the
caller is responsible for proper finalization by calling either
ngx_http_finalize_request() or ngx_http_upstream_finalize_request().
And X-Accel-Redirect handling now does not call
ngx_http_upstream_finalize_request(NGX_DECLINED) if no cleanup handler
is installed.

Reported by Jiří Setnička
(https://mailman.nginx.org/pipermail/nginx-devel/2024-February/HWLYHOO3DDB3XTFT6X3GRMXIEJ3SJRUA.html).
2026-10-01 16:34:43 +04:00
Sergey KandaurovandNitin Swami 2b5c2b605b GeoIP: support for the MaxMind DB (MMDB) databases
The MaxMind DB format is now recognized, with the fallback to the
legacy format (reached End-of-Life in May 2022).  Migration requires
switching to MMDB database files:

    geoip_country  /usr/share/GeoIP/GeoLite2-Country.mmdb;
    geoip_city     /usr/share/GeoIP/GeoLite2-City.mmdb;
    geoip_org      /usr/share/GeoIP/GeoLite2-ASN.mmdb;

Either libmaxminddb or libGeoIP is sufficient to build the modules;
configure fails if neither is found.

Notes on the MMDB lookups:

*) $geoip_country_code3 and $geoip_city_country_code3 are converted from
   the alpha-2 codes with a compiled-in ISO 3166-1 table, as the MMDB
   databases provide alpha-2 codes only.

*) $geoip_org looks up "autonomous_system_organization", "isp",
   "organization", and "domain" in turn, to match the legacy ASNum, ISP,
   Org, and Domain database editions.

*) $geoip_area_code has no MMDB counterpart and is never found.

*) $geoip_region and $geoip_region_name come from subdivisions[0], and
   thus may differ in value from the legacy ones.

*) $geoip_dma_code comes from location.metro_code, which is deprecated
   by MaxMind and may be absent.

Co-authored-by: Nitin Swami <n.swami@f5.com>
2026-09-30 20:17:54 +04:00
Sergey Kandaurov d30f68d82a Updated OpenSSL and PCRE used for win32 builds 2026-09-30 18:05:11 +04:00
Ivan Ovchinnikov b862596041 QUIC: fixed binary upgrade from older versions
Before 63af971a1 (1.31.7), the NGINX_BPF_MAPS environment variable
was passed to the new binary on binary upgrade whenever the quic_bpf
module was built, even if "quic_bpf" was not enabled, with an empty
value if there were no QUIC BPF socket groups.

Since 63af971a1, such an empty value was treated as inherited maps,
and the new binary refused to start: with the "cannot be disabled
during binary upgrade" error if "quic_bpf" was not enabled, or with
a parsing error otherwise.

The fix is to ignore an empty value, which means there are no maps
to inherit.
2026-09-29 14:39:10 -07:00
Sai Krishna Kumar Reddy YADAMAKANTIandRoman Arutyunyan 63af971a1e QUIC: support BPF reload and binary upgrade
The SO_COOKIE dependency is removed.  QUIC BPF dispatching now uses
separate sockets for new and established connections: listener sockets
handle new connections, while per-worker sockets handle established
ones.  Server connection IDs encode a random worker key, which BPF
uses to route established packets directly to the correct worker
socket.  New connections are routed through listen keys using a
dual slot scheme that enables both reload and binary upgrade.

On reload, new workers register new sockets and keys while old workers
continue receiving established connections through their encoded keys.
On binary upgrade, the new master uses the opposite slot, and exiting
masters clear their entries so traffic shifts to the surviving
instance.

Co-authored-by: Roman Arutyunyan <arut@nginx.com>
2026-09-29 21:46:41 +04:00
Sai Krishna Kumar Reddy YADAMAKANTI ce6e7d6c12 QUIC: added BPF packet data fallback
Use bpf_skb_load_bytes() in the reuseport BPF helper when the required
QUIC header bytes are not available through direct packet access.  This
keeps the direct access fast path while allowing the helper to parse the
flags byte, DCID length byte, and DCID key from non linear skb data.

A similar approach was implemented in [1].

[1] https://git.angie.software/web-server/angie/commit/4b527f5
2026-09-29 21:46:41 +04:00
Andrew Clayton b74b5c961e HTTP/2: switch to RFC 9218 priorities
Advertise SETTINGS_NO_RFC7540_PRIORITIES (0x9) in the initial SETTINGS
frame and order the output by the RFC 9218 effective priority instead of
the RFC 7540 dependency tree, which is removed in the same step.
Placing the switch last keeps it self-contained and easy to revert.

RFC 9218, Section 2.1: a server can send SETTINGS_NO_RFC7540_PRIORITIES
with a value of 1 to indicate that it will ignore RFC 7540 priority
signals.  A received value other than 0 or 1 is a connection error.

Frames are ordered by urgency first, then non-incremental ahead of
incremental, then by stream id, which keeps streams of equal priority
in the order their requests arrived (RFC 8941, Section 4.2).  The same
order is applied to ngx_http_v2_waiting_queue().

The RFC 7540 priority scheme is removed: PRIORITY frames are validated
for framing errors and then ignored, the priority fields of a HEADERS
frame are skipped, and the dependency tree (node parent/children/weight,
the dependencies queue, ngx_http_v2_set_dependency(),
ngx_http_v2_node_children_update() and the per-connection
priority_limit) is gone.  RFC 9113, Sections 5.3.1 and 5.3.2, deprecate
stream prioritization: it proved complex, was implemented unevenly and
widely ignored, and its protocol elements are retained for wire
compatibility only.

With the tree gone, a buffered PRIORITY_UPDATE node no longer needs to
be attached to it, so the set_dependency() call from the buffering path
falls away, leaving the node parked in h2c->closed on its own.

Assisted-by: opencode:claude-opus-4.8
2026-09-28 22:01:20 +01:00
Andrew Clayton 4f21c3ddb8 HTTP/2: merge upstream Priority header for proxied requests
When nginx proxies a request over HTTP/2 and the upstream returns a
Priority response header, record it as the stream's server priority and
recompute the effective priority by merging it with the client's value
(RFC 9218, Section 8): a parameter present in the response overrides the
client's, a parameter absent leaves it unchanged.  The client and server
inputs are kept separate so a later client PRIORITY_UPDATE does not
discard the server hint.

The merge affects only how this hop schedules the stream; the Priority
header forwarded to the client is left unchanged, so
$upstream_http_priority continues to report what the origin sent.

Assisted-by: opencode:claude-opus-4.8
2026-09-28 22:01:20 +01:00
Andrew Clayton 4d147459db HTTP/2: parse Priority request header
Parse the RFC 9218 Priority request header, an RFC 8941 Structured
Fields Dictionary such as "u=3, i".

The header lines are collected during header block processing and, once
the block is complete, combined into a single value and parsed once in
ngx_http_v2_run_request(), as RFC 8941, Section 4.2, requires all field
lines of the same field to be combined before parsing.  This mirrors how
cookies are handled.  The header is still passed through to the request
so it stays visible to variables and proxying.

A malformed field is ignored, leaving the defaults.  A PRIORITY_UPDATE
frame overrides the header (RFC 9218, Section 7): if a frame has already
been applied to the stream the header is not consulted.

Assisted-by: opencode:claude-opus-4.8
2026-09-28 22:01:20 +01:00
Andrew Clayton 2b6c2de41d HTTP/2: handle PRIORITY_UPDATE frames
Implement the RFC 9218 PRIORITY_UPDATE frame (type 0x10).  The frame is
sent on stream 0 and carries a prioritized stream id and a Priority
Field Value; it is validated for framing errors and dispatched from
ngx_http_v2_state_head().

A PRIORITY_UPDATE conveys a complete set of parameters (RFC 9218,
Section 7): omitted parameters reset to their defaults, so the value
replaces any earlier signal.  A frame for a stream that already exists
is applied at once.  A frame for a not-yet-created stream is buffered on
its node until the HEADERS frame arrives; the node is parked in
h2c->closed and, while the RFC 7540 tree is still present, attached to
the root as is done for a PRIORITY frame with a zero dependency.  The
number of buffered signals is bounded by the node reuse budget.

A malformed value is logged and ignored, leaving the current priority
untouched.  A value that does not fit the state buffer while the frame
is fragmented is skipped.

The signals are only collected here; the scheduler still uses the
RFC 7540 dependency tree until the switch to RFC 9218.

Assisted-by: opencode:claude-opus-4.8
2026-09-28 22:01:20 +01:00
Andrew Clayton b5bd4b3487 Add RFC 9218 priority types and parser
Implement a strict RFC 8941 Structured Fields Dictionary parser for the
RFC 9218 Extensible Prioritization Scheme, shared by HTTP/2 (and, later,
HTTP/3).

New files:
- ngx_http_priority.h: the ngx_http_priority_t and
  ngx_http_priority_state_t types and the parse/state API.
- ngx_http_priority.c: the parser plus ngx_http_priority_state_init()
  and ngx_http_priority_state_update() (client/server merge).

The field is parsed strictly: a syntax error fails the whole field
(RFC 8941, Section 4.2, treats it as absent), and only on a successful
parse are the RFC 9218, Section 4, rules applied, ignoring unknown
members, out-of-range urgency and members of an unexpected type.  On
error the caller keeps any previously signalled priority.  The parser
bounds the number of members, inner-list items and parameters, and the
length of individual strings, tokens and byte sequences, that it will
accept.

The sources are built only with HTTP/2 (for now), alongside the Huffman
sources, rather than unconditionally into the core HTTP module.

Assisted-by: opencode:claude-opus-4.8
2026-09-28 22:01:20 +01:00
Sourav Bhowmik 939334efff QUIC: fixed frame threshold with a small stream buffer size
Since 2fb32ff (1.27.5), the connection frame threshold degraded to a
few or zero frames when using a small stream buffer.  The previously
hardcoded minimum of 10000 frames is now used.
2026-09-25 22:27:38 +04:00
Sourav Bhowmik d115763f8e Rejected zero size in buffer-size directives
When set to zero, this resulted in a buffer with no room to read into.
As there is no meaningful interpretation of a zero-sized buffer, such
configuration is explicitly rejected.

Reported by kh-lee
2026-09-25 22:27:38 +04:00
Eugene GrebenschikovandSergey Kandaurov d10dd3123a SSL: avoid matching IP addresses in dNSName and commonName
OpenSSL 1.0.2+ validates IP addresses only against iPAddress
subjectAltName entries via X509_check_ip().  For older OpenSSL
versions, equivalent validation is now performed.

Note that dNSName entries are still logged when checking an IP
address, they are not used for matching.

Co-authored-by: Sergey Kandaurov <pluknet@nginx.com>
2026-09-24 12:33:26 -07:00
4f86b96da9 SSL: support for iPAddress subjectAltName in certificates.
Known public services with iPAddress subject altnames include 1.1.1.1
and 8.8.8.8.  IP address certificates from Let's Encrypt are expected
to be available soon:

https://letsencrypt.org/2025/07/01/issuing-our-first-ip-address-certificate

Origin: <https://freenginx.org/hg/nginx/rev/5e23335edf67>
Co-authored-by: Eugene Grebenschikov <e.grebenshchikov@f5.com>
Co-authored-by: Sergey Kandaurov <pluknet@nginx.com>
2026-09-24 12:33:26 -07:00
Maxim Dounin 0831b97e72 SSL: fixed subjectAltName and commonName debug logging.
Previously, ASN1_STRING_length() was used as a length for "%*s" format
specifier, which is wrong, since string length is expected to be "size_t",
and ASN1_STRING_length() returns "int".

Origin: <https://freenginx.org/hg/nginx/rev/a540fac7e04a>
Signed-off-by: Eugene Grebenschikov <e.grebenshchikov@f5.com>
2026-09-24 12:33:26 -07:00
Sergey Kandaurov 1967e2bdc4 SSL: avoid writing to a connection with a failed read
It is possible to receive application data together with socket close.
In this case, SSL_read() may return SSL_ERROR_SYSCALL with ECONNRESET,
specifically after OpenSSL sent TLSv1.3 tickets on a closed connection.

Before OpenSSL 4.0, a subsequent SSL_write() returned SSL_ERROR_SYSCALL
with EPIPE in this case.  The behaviour was changed to remember the
error state and handle such a call as a protocol error, see for details
https://github.com/openssl/openssl/issues/30631.  This makes SSL_write()
return SSL_ERROR_SSL with the empty error queue, which results in
"[crit] ... SSL_write() failed" errors, as caught by ssl_stapling.t.

The fix is to check the result of the last read stored in c->ssl->last,
to avoid calling SSL_write() after a failed read.  For consistency, the
check is added to ngx_ssl_sendfile(): SSL_sendfile() resets the error
state the same way SSL_write() does, though it does not seem to be
reachable in http.

Based on a patch by Maxim Dounin.

Signed-off-by: Sergey Kandaurov <pluknet@nginx.com>
Origin: <https://freenginx.org/hg/nginx/rev/ff5becaf5444>
2026-09-24 20:16:39 +04:00
Maxim Dounin 381c876ec6 SSL: clarified clean shutdown condition
OpenSSL up to 3.0, when a TCP connection is closed by the peer, returns
SSL_ERROR_SYSCALL without an error queue and with errno set to 0.  Since
OpenSSL 3.0 with SSL_OP_IGNORE_UNEXPECTED_EOF, which nginx sets, this is
reported as SSL_ERROR_ZERO_RETURN instead.

Closing a connection without the close_notify alert is incorrect, yet
common enough in the real world to be handled as a non-error condition.
Truncation attacks are expected to be prevented at the protocol level;
notably, they are not possible for HTTP/1.x requests at all, and only
possible for HTTP/1.x responses if neither Content-Length nor chunked
transfer encoding is used.

Previously, "ERR_peek_error() == 0" was used to detect this, which is
too broad: it also matches TCP-level errors, such as ECONNRESET, which
are better reported as errors, the way the plain TCP code does it in
ngx_unix_recv().

Now only a clean TCP close is treated as a clean connection close.  Most
notably, connection resets now result in "SSL_read() failed" errors.

This change is a modified version of a patch by Maxim Dounin.  The
modifications include resolved conflicts and the refined commit log.

Signed-off-by: Sergey Kandaurov <pluknet@nginx.com>
Origin: <https://freenginx.org/hg/nginx/rev/4c0b66b5046f>
2026-09-24 20:16:39 +04:00
Sergey Kandaurov ef0aa967dc Version bump 2026-09-16 16:13:02 +04:00
Maxim Dounin 3dbce28821 Dav: destination validation for COPY and MOVE with "alias".
If COPY or MOVE methods are enabled, the DAV module assumes that it is
configured for the whole server, and does not try validate that the
destination URI is within the particular location.  This, however, does
not work well if it is in fact configured in a non-root location, and
this location uses the "alias" directive, such as in the following
configuration:

    location /prefix/ {
        dav_methods COPY;
        alias /foo/;
    }

In particular, if the destination URI is shorter than the aliased
location prefix, calling ngx_http_map_uri_to_path() with such
destination URI used to result in segmentation faults (9739e755b).  And
if the destination URI is longer than the aliased location prefix, but
does not match it, calling ngx_http_map_uri_to_path() resulted in
unexpected path values, including ones above the "alias" directory
specified.

The fix is to check destination URI prefix if "alias" is used, similarly
to what we do with "try_files".  Additionally, the
ngx_http_map_uri_to_path() function was updated with additional sanity
checking to prevent similar issues.

This change is a modified version of a patch by Maxim Dounin.  The
modifications include skipping the prefix check if the URI was
rewritten, which preserves the "alias" diagnostics of
ngx_http_map_uri_to_path().

Signed-off-by: Vadim Zhestikov <v.zhestikov@f5.com>
Origin: <https://freenginx.org/hg/nginx/rev/aae28b083279>
2026-09-15 16:31:12 -07:00
Sergey Kandaurov 0a5db852e1 nginx-1.31.6-RELEASE release-1.31.6 2026-09-15 19:06:48 +04:00
Sergey Kandaurov 22ba566244 QUIC: ignore the QUIC extension received in TLS handshake
Instead of failing the handshake, it is now accepted and ignored like
any other unknown extension.  Unlike stated in RFC 9001, Section 8.2,
this represents less strict behaviour following RFC 8446, Section 4.2.
2026-09-15 19:06:31 +04:00
Sergey Kandaurov 7c7363266d QUIC: registering the compat extension in all SSL contexts
With the OpenSSL compatibility layer, the transport parameters custom
TLS extension used to be registered only in SSL contexts of virtual
servers reachable over QUIC.

The ClientHello callback introduced in 0373fe5d9 (1.29.2) is called
by OpenSSL between collecting and parsing extensions, so the custom
extensions may not match the expected number if the SSL context was
replaced with SSL_set_SSL_CTX().

The fix is to register the extension in all SSL contexts, including
those that cannot be reached over QUIC, so that the array bounds are
preserved; the compatibility layer as a whole is initialized only
if the configuration has QUIC listeners.  The keylog callback,
meaningful for QUIC connections, is kept on QUIC addresses.

Reported by Banny Liao.
2026-09-15 19:06:31 +04:00
Sergey Kandaurov f9c4264b6b Geo: check binary base CRC32 before relocation
This provides safe pointer handling in the event of a corrupted file.
2026-09-11 17:46:20 +04:00
Sergey Kandaurov ea5b634fdc Control API: fixed socket inheritance on binary upgrade
The environment may be replaced while parsing configuration, as it
happens with the perl module, which calls ngx_set_environment() when
creating an interpreter.  As a result, the control socket was not
inherited on binary upgrade.

The variable is now read before ngx_init_cycle(), similarly to
inherited listening sockets.
2026-09-11 16:27:35 +04:00
Roman Arutyunyan df5269cc42 Handle nested location lookup error
Previously, when looking up a nested location after a prefix location
match, the nested regex or predicate match error could be ignored if
more regex or predicate locations were configured at the current level.
Now such error leads to request finalization.
2026-09-10 12:10:38 +04:00
Roman Arutyunyan 005f9f5d4d Handle predicate location variable error
Previously, the error was ignored and the predicate was treated as
false.  Now the error leads to the request finalization.
2026-09-09 19:37:03 +04:00
Sergey Kandaurov 5c812c034e Removed non-existing support link in the man page 2026-09-07 20:08:48 +04:00
Sergey Kandaurov 76a8d9f041 Added -l option to the man page
Fixes 4bc459a15.
2026-09-07 20:08:48 +04:00
Sergey Kandaurov 69dcf98c1c Version bump 2026-09-07 20:08:48 +04:00
Roman Arutyunyan 231a60ee3e nginx-1.31.5-RELEASE release-1.31.5 2026-09-02 15:17:13 +04:00
Roman Arutyunyan 0356f3d2c9 Updated OpenSSL and PCRE used for win32 builds 2026-09-01 22:22:29 +04:00
Ava HahnandPavel Pautov 1c1c17c104 Control API: in memory config dump.
The /control/config endpoint returns the currently parsed and running
configuration on GET request.

Example:

$ curl 127.0.0.1:1234/1/control/config | jq
[
  {
    "name": "/path/to/nginx.conf",
    "content": "..."
  },
  {
    "name": "/path/to/included.conf",
    "content": "..."
  }
]

Co-authored-by: Pavel Pautov <p.pautov@f5.com>
2026-09-01 10:34:56 -07:00