summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)AuthorFilesLines
2026-02-04nginx-1.28.2-RELEASErelease-1.28.2Roman Arutyunyan1-0/+36
2026-02-04Upstream: reinit upstream after reading bad response.Roman Arutyunyan2-1/+5
Previously, when connecting to a backend, if the read event handler was called before the write event handler, and the received response triggered a next upstream condition, then ngx_http_upstream_reinit() was not called to clean up the old upstream context. This had multiple implications. For all proxy modules, since the last upstream response was not cleaned up, it was mixed with the next upstream response. This could result in ignoring the second response status code, duplicate response headers or reporting old upstream header errors. With ngx_http_grpc_module and ngx_http_proxy_v2_module, ctx->connection was left dangling since the object it referenced was allocated from the last upstream connection pool, which was deleted when freeing last upstream. This lead to use-after-free when trying to reuse this object for the next upstream.
2026-02-04Upstream: detect premature plain text response from SSL backend.Roman Arutyunyan1-0/+9
When connecting to a backend, the connection write event is triggered first in most cases. However if a response arrives quickly enough, both read and write events can be triggered together within the same event loop iteration. In this case the read event handler is called first and the write event handler is called after it. SSL initialization for backend connections happens only in the write event handler since SSL handshake starts with sending Client Hello. Previously, if a backend sent a quick plain text response, it could be parsed by the read event handler prior to starting SSL handshake on the connection. The change adds protection against parsing such responses on SSL-enabled connections.
2026-02-04Win32: fixed C4319 warning with MSVC 2022 x86.Aleksei Bavshin1-1/+1
The warning started to appear in Visual Studio 2022 version 17.14.21, which corresponds to the C/C++ compiler version 19.44.35221. The appropriate fix is to avoid mixing uint64_t and ngx_uint_t in an expression with bitwise operations. We can do that here because both the original shm->size value and the result of the expression are 32-bit platform words.
2026-02-04Version bump.Roman Arutyunyan1-2/+2
2025-12-23nginx-1.28.1-RELEASErelease-1.28.1Sergey Kandaurov1-0/+113
2025-12-23Proxy: fixed segfault in URI change.Sergey Kandaurov1-3/+4
If request URI was shorter than location prefix, as after replacement with try_files, location length was used to copy the remaining URI part leading to buffer overread. The fix is to replace full request URI in this case. In the following configuration, request "/123" is changed to "/" when sent to backend. location /1234 { try_files /123 =404; proxy_pass http://127.0.0.1:8080/; } Closes #983 on GitHub.
2025-12-23HTTP/2: extended guard for NULL buffer and zero length.Sergey Kandaurov1-6/+5
In addition to moving memcpy() under the length condition in 15bf6d8cc, which addressed a reported UB due to string function conventions, this is repeated for advancing an input buffer, to make the resulting code more clean and readable. Additionally, although considered harmless for both string functions and additive operators, as previously discussed in GitHub PR 866, this fixes the main source of annoying sanitizer reports in the module. Prodded by UndefinedBehaviorSanitizer (pointer-overflow).
2025-12-23Configure: MSVC compatibility with PCRE2 10.47.Thierry Bastian1-0/+1
2025-12-23OCSP: fixed invalid type for the 'ssl_ocsp' directive.Roman Semenov2-2/+2
2025-12-23Updated OpenSSL and PCRE used for win32 builds.Sergey Kandaurov1-2/+2
2025-12-23SSL: fixed "key values mismatch" with object cache inheritance.Sergey Kandaurov2-12/+63
In rare cases, it was possible to get into this error state on reload with improperly updated file timestamps for certificate and key pairs. The fix is to retry on X509_R_KEY_VALUES_MISMATCH, similar to 5d5d9adcc. Additionally, loading SSL certificate is updated to avoid certificates discarded on retry to appear in ssl->certs and in extra chain.
2025-12-23Mail: xtext encoding (RFC 3461) in XCLIENT LOGIN.Sergey Kandaurov3-4/+43
The XCLIENT command uses xtext encoding for attribute values, as specified in https://www.postfix.org/XCLIENT_README.html. Reported by Igor Morgenstern of Aisle Research.
2025-12-23Upstream: overflow detection in Cache-Control delta-seconds.Sergey Kandaurov1-34/+47
Overflowing calculations are now aligned to the greatest positive integer as specified in RFC 9111, Section 1.2.2.
2025-12-23Fixed inaccurate index directive error report.willmafh1-1/+1
2025-12-23Updated link to xslscript.Sergey Kandaurov1-1/+1
2025-12-23Updated OpenSSL used for win32 builds.Sergey Kandaurov1-1/+1
2025-12-23Mail: reset stale auth credentials with "smtp_auth none;".Sergey Kandaurov2-1/+7
They might be reused in a session if an SMTP client proceeded unauthenticated after previous invalid authentication attempts. This could confuse an authentication server when passing stale credentials along with "Auth-Method: none". The condition to send the "Auth-Salt" header is similarly refined.
2025-12-23Mail: improved error handling in plain/login/cram-md5 auth methods.Sergey Kandaurov1-16/+22
Previously, login and password storage could be left in inconsistent state in a session after decoding errors.
2025-12-23Auth basic: fixed file descriptor leak on memory allocation error.Sergey Kandaurov1-1/+2
Found by Coverity (CID 1662016).
2025-12-23HTTP/2: fixed handling of the ":authority" header.Sergey Kandaurov1-15/+105
Previously, it misused the Host header processing resulting in 400 (Bad Request) errors for a valid request that contains both ":authority" and Host headers with the same value, treating it after 37984f0be as if client sent more than one Host header. Such an overly strict handling violates RFC 9113. The fix is to process ":authority" as a distinct header, similarly to processing an authority component in the HTTP/1.x request line. This allows to disambiguate and compare Host and ":authority" values after all headers were processed. With this change, the ngx_http_process_request_header() function can no longer be used here, certain parts were inlined similar to the HTTP/3 module. To provide compatibility for misconfigurations that use $http_host to return the value of the ":authority" header, the Host header, if missing, is now reconstructed from ":authority".
2025-12-23HTTP/2: factored out constructing the Host header.Sergey Kandaurov1-39/+48
No functional changes.
2025-12-23HTTP/3: fixed handling of :authority and Host with port.Roman Arutyunyan1-5/+8
RFC 9114, Section 4.3.1. specifies a restriction for :authority and Host coexistence in an HTTP/3 request: : If both fields are present, they MUST contain the same value. Previously, this restriction was correctly enforced only for portless values. When Host contained a port, the request failed as if :authority and Host were different, regardless of :authority presence. This happens because the value of r->headers_in.server used for :authority has port stripped. The fix is to use r->host_start / r->host_end instead.
2025-12-23HTTP/3: fixed potential type overflow in string literal parser.Sergey Kandaurov1-0/+6
This might happen for Huffman encoded string literals as the result of length expansion. Notably, the maximum length of string literals is already limited with the "large_client_header_buffers" directive, so this was only possible with nonsensically large configured limits.
2025-12-23Events: compatibility with NetBSD 10.0 in kqueue.Sergey Kandaurov1-2/+2
The kevent udata field was changed from intptr_t to "void *", similar to other BSDs and Darwin. The NGX_KQUEUE_UDATA_T macro is adjusted to reflect that change, fixing -Werror=int-conversion errors.
2025-12-23Configure: set NGX_KQUEUE_UDATA_T at compile time.Sergey Kandaurov2-20/+9
The NGX_KQUEUE_UDATA_T macro is used to compensate the incompatible kqueue() API in NetBSD, it doesn't really belong to feature tests. The change limits the macro visibility to the kqueue event module. Moving from autotests also simplifies testing a particular NetBSD version as seen in a subsequent change.
2025-12-23Events: fixed -Wzero-as-null-pointer-constant warnings in kqueue.Sergey Kandaurov1-2/+2
The kevent udata field is special in that we maintain compatibility with NetBSD versions that predate using the "void *" type. The fix is to cast to intermediate uintptr_t that is casted back to "void *" where appropriate.
2025-12-23SSL: fixed testing OPENSSL_VERSION_NUMBER for OpenSSL 3.0+.Sergey Kandaurov2-2/+2
Prior to OpenSSL 3.0, OPENSSL_VERSION_NUMBER used the following format: MNNFFPPS: major minor fix patch status Where the status nibble (S) has 0+ for development and f for release. The format was changed in OpenSSL 3.0.0, where it is always zero: MNN00PP0: major minor patch
2025-12-23SSL: SSL_group_to_name() compatibility macro.Sergey Kandaurov2-12/+5
No functional changes.
2025-12-23Win32: fixed PCRE license for nginx/Windows zip.Sergey Kandaurov1-1/+1
2025-12-23Updated OpenSSL and PCRE used for win32 builds.Sergey Kandaurov1-2/+2
2025-12-23Win32: skip OpenSSL dependency generation to conserve time.Sergey Kandaurov1-1/+2
Disabling the build dependency feature is safe assuming that nginx/Windows release zip is always built from a clean tree. This allows to speed up total build time by around 40%. As it may not be suitable in general, the option resides here and not in configure.
2025-12-23Use NULL instead of 0 for null pointer constant.Andrew Clayton6-6/+6
There were a few random places where 0 was being used as a null pointer constant. We have a NULL macro for this very purpose, use it. There is also some interest in actually deprecating the use of 0 as a null pointer constant in C. This was found with -Wzero-as-null-pointer-constant which was enabled for C in GCC 15 (not enabled with Wall or Wextra... yet). Link: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117059>
2025-12-23Use NGX_CONF_OK in some function return checks.Andrew Clayton11-11/+11
The functions ngx_http_merge_types() & ngx_conf_merge_path_value() return either NGX_CONF_OK aka NULL aka ((void *)0) (probably) or NGX_CONF_ERROR aka ((void *)-1). They don't return an integer constant which is what NGX_OK aka (0) is. Lets use the right thing in the function return check. This was found with -Wzero-as-null-pointer-constant which was enabled for C in GCC 15 (not enabled with Wall or Wextra... yet). Link: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117059>
2025-12-23QUIC: do not block ACKs by congestion control.Sergey Kandaurov1-7/+17
Previously, it was not possible to send acknowledgments if the congestion window was limited or temporarily exceeded, such as after sending a large response or MTU probe. If ACKs were not received from the peer for some reason to update the in-flight bytes counter below the congestion window, this might result in a stalled connection. The fix is to send ACKs regardless of congestion control. This meets RFC 9002, Section 7: : Similar to TCP, packets containing only ACK frames do not count : toward bytes in flight and are not congestion controlled. This is a simplified implementation to send ACK frames from the head of the queue. This was made possible after 6f5f17358. Reported in trac ticket #2621 and subsequently by Vladimir Homutov: https://mailman.nginx.org/pipermail/nginx-devel/2025-April/ZKBAWRJVQXSZ2ISG3YJAF3EWMDRDHCMO.html
2025-12-23SSL: fixed build with OPENSSL_NO_DH.Sergey Kandaurov2-0/+6
2025-12-23SSL: fixed build with OPENSSL_NO_DEPRECATED.Sergey Kandaurov1-0/+11
2025-12-23Win32: added detection of ARM64 target.Aleksei Bavshin2-0/+8
This extends the target selection implemented in dad6ec3aa63f to support Windows ARM64 platforms. OpenSSL support for VC-WIN64-ARM target first appeared in 1.1.1 and is present in all currently supported (3.x) branches. As a side effect, ARM64 Windows builds will get 16-byte alignment along with the rest of non-x86 platforms. This is safe, as malloc on 64-bit Windows guarantees the fundamental alignment of allocations, 16 bytes.
2025-12-23Core: improved NGX_ALIGNMENT detection on some x86_64 platforms.Aleksei Bavshin1-1/+1
Previously, the default pool alignment used sizeof(unsigned long), with the expectation that this would match to a platform word size. Certain 64-bit platforms prove this assumption wrong by keeping the 32-bit long type, which is fully compliant with the C standard. This introduces a possibility of suboptimal misaligned access to the data allocated with ngx_palloc() on the affected platforms, which is addressed here by changing the default NGX_ALIGNMENT to a pointer size. As we override the detection in auto/os/conf for all the machine types except x86, and Unix-like 64-bit systems prefer the 64-bit long, the impact of the change should be limited to Win64 x64.
2025-12-23Version bump.Sergey Kandaurov1-2/+2
2025-04-23nginx-1.28.0-RELEASErelease-1.28.0Sergey Kandaurov1-0/+36
2025-04-23HTTP/3: fixed NGX_HTTP_V3_VARLEN_INT_LEN value.Roman Arutyunyan1-1/+1
After fixing ngx_http_v3_encode_varlen_int() in 400eb1b628, NGX_HTTP_V3_VARLEN_INT_LEN retained the old value of 4, which is insufficient for the values over 1073741823 (1G - 1). The NGX_HTTP_V3_VARLEN_INT_LEN macro is used in ngx_http_v3_uni.c to format stream and frame types. Old buffer size is enough for formatting this data. Also, the macro is used in ngx_http_v3_filter_module.c to format output chunks and trailers. Considering output_buffers and proxy_buffer_size are below 1G in all realistic scenarios, the old buffer size is enough here as well.
2025-04-23Fixed -Wunterminated-string-initialization with gcc15.Roman Arutyunyan2-8/+11
2025-04-23Stable branch.Sergey Kandaurov1-2/+2
2025-04-16nginx-1.27.5-RELEASErelease-1.27.5Sergey Kandaurov1-0/+71
2025-04-15QUIC: dynamic packet threshold.Roman Arutyunyan1-9/+39
RFC 9002, Section 6.1.1 defines packet reordering threshold as 3. Testing shows that such low value leads to spurious packet losses followed by congestion window collapse. The change implements dynamic packet threshold detection based on in-flight packet range. Packet threshold is defined as half the number of in-flight packets, with mininum value of 3. Also, renamed ngx_quic_lost_threshold() to ngx_quic_time_threshold() for better compliance with RFC 9002 terms.
2025-04-15QUIC: optimized connection frame threshold.Roman Arutyunyan3-1/+6
Previosly the threshold was hardcoded at 10000. This value is too low for high BDP networks. For example, if all frames are STREAM frames, and MTU is 1500, the upper limit for congestion window would be roughly 15M (10000 * 1500). With 100ms RTT it's just a 1.2Gbps network (15M * 10 * 8). In reality, the limit is even lower because of other frame types. Also, the number of frames that could be used simultaneously depends on the total amount of data buffered in all server streams, and client flow control. The change sets frame threshold based on max concurrent streams and stream buffer size, the product of which is the maximum number of in-flight stream data in all server streams at any moment. The value is divided by 2000 to account for a typical MTU 1500 and the fact that not all frames are STREAM frames.
2025-04-15QUIC: CUBIC congestion control.Roman Arutyunyan4-12/+185
2025-04-15QUIC: ignore congestion control when sending MTU probes.Roman Arutyunyan1-0/+1
If connection is network-limited, MTU probes have little chance of being sent since congestion window is almost always full. As a result, PMTUD may not be able to reach the real MTU and the connection may operate with a reduced MTU. The solution is to ignore the congestion window. This may lead to a temporary increase in in-flight count beyond congestion window.
2025-04-15QUIC: do not shrink congestion window after losing an MTU probe.Roman Arutyunyan3-0/+10
As per RFC 9000, Section 14.4: Loss of a QUIC packet that is carried in a PMTU probe is therefore not a reliable indication of congestion and SHOULD NOT trigger a congestion control reaction.