]> git.kaiwu.me - haproxy.git/log
haproxy.git
6 hours agoBUG/MINOR: chunk: stop chunk_str{,case}cmp() at the end of the string master
Christopher Faulet [Thu, 3 Dec 2026 21:02:10 +0000 (22:02 +0100)]
BUG/MINOR: chunk: stop chunk_str{,case}cmp() at the end of the string

chunk_strcmp() and chunk_strcasecmp() compare a chunk with a NUL-terminated
string, and only stop on the first difference or at the end of the chunk.
When the chunk contains a NUL byte at the position where the string ends,
both are equal there, so the comparison continues past the end of the
string, reading memory located after it. In addition, the result may be
wrong: "oct\0" may be reported as equal to "oct" if the byte following the
string is zero.

Most callers compare configuration elements, but jwt_decrypt_jwk() does it
on the "kty" field of the JWK, which may come from a variable, and the JSON
decoder turns "\u0000" into a NUL byte. With an ASAN build, this config:

    http-request set-var(txn.jwk) req.fhdr(x-jwk)
    http-request return status 200 hdr x-res "%[req.hdr(x-tok),jwt_decrypt_jwk(txn.jwk)]"

with a request carrying 'x-jwk: {"kty":"oct\u0000","k":"..."}' and any
token using "alg":"dir" reports a global-buffer-overflow in chunk_strcmp()
past the "oct" literal. Without ASAN, the read hits the next constants and
has no other effect than possibly accepting this "kty", and taking the JWK
from client data makes no sense anyway, so the impact is very low.

Let's stop the comparison when reaching the end of the string, and report
the chunk as greater in this case since it is longer.

This exists since the functions were introduced in 1.5 by commit ad8f8e8ff
("MINOR: chunk: provide string compare functions"). It may be backported
to all supported versions.

6 hours agoBUG/MINOR: htx: preserve the first block when a message is moved to another buffer
Christopher Faulet [Thu, 3 Dec 2026 20:43:37 +0000 (21:43 +0100)]
BUG/MINOR: htx: preserve the first block when a message is moved to another buffer

htx_move_to_large_buffer() and similar functions rely on htx_xfer() to
transfer an HTX message to a larger or smaller buffer. But htx_xfer() adds
new blocks in the destination message, so the first block to (re)start
the analysis from (htx->first) was always the head one. When some blocks
were before it in the source message, for instance an interim response
not forwarded yet, the wrong block was used as first block after the
transfer. For instance, after a "wait-for-body" action moving a response
to a large buffer, the next "http-response" rules could be evaluated on a
1xx response instead of the final one.

To fix the issue, a new xfer flag is added, HTX_XFER_KEEP_FIRST. When it
is set and the destination message is empty, the block copied from the
first block of the source message becomes the first block of the
destination message. This flag is now used by the functions moving or
copying a message to a small or large buffer.

This patch must be backported to 3.4.

6 hours agoBUG/MINOR: htx: only rollback blocks copied by the current call in htx_xfer()
Christopher Faulet [Thu, 3 Dec 2026 17:05:26 +0000 (18:05 +0100)]
BUG/MINOR: htx: only rollback blocks copied by the current call in htx_xfer()

When partial copies of headers or trailers are not allowed, htx_xfer()
removes the start-line, header and trailer blocks found at the end of
<dst> when the copy is interrupted, and rolls back on <src> accordingly.
But this was not limited to the blocks copied by the current call. If
<dst> already ended with such blocks, for instance a trailer block added
by the cache applet, these blocks were removed too, and the rollback on
<src> went beyond its first block. In this case, <src> was then fully
drained.

Now, the start-line, header and trailer blocks copied at the end of
<dst> are counted, and only these blocks are removed on rollback.

This patch must be backported to 3.4.

6 hours agoBUG/MINOR: htx: remove the EOM flag from a DATA block truncated by htx_truncate()
Christopher Faulet [Thu, 3 Dec 2026 16:23:51 +0000 (17:23 +0100)]
BUG/MINOR: htx: remove the EOM flag from a DATA block truncated by htx_truncate()

htx_truncate() removes all blocks after the one containing the given
offset, and truncates this last one if it is a DATA block. But the
truncated block kept its flags, including HTX_BLK_FL_EOM. So a message
truncated in the middle of its last DATA block was still considered as
complete.

Now, the EOM flag is removed from the truncated block.

This patch must be backported to 3.5.

6 hours agoMINOR: htx: don't mark the message unordered when data follow a NOOP block
Christopher Faulet [Thu, 3 Dec 2026 14:59:06 +0000 (15:59 +0100)]
MINOR: htx: don't mark the message unordered when data follow a NOOP block

When data are added after a block of a greater type, the HTX message is
marked as unordered. But a NOOP block may be found anywhere in a
message. So data added after a NOOP block without EOM must not be
considered as unordered. Otherwise a useless defragmentation may be
performed.

6 hours agoBUG/MINOR: h1-htx: don't remove data already queued on a chunk parsing error
Christopher Faulet [Thu, 3 Dec 2026 14:53:00 +0000 (15:53 +0100)]
BUG/MINOR: h1-htx: don't remove data already queued on a chunk parsing error

In h1_parse_full_contig_chunks(), the HTX DATA block used to copy the
chunks is reserved with htx_reserve_max_data(). It may be a new block or
the last DATA block, extended. On parsing error, since the commit
4af4feed3 ("BUG/MEDIUM: h1_htx: Remove reverved block on error during
contig chunks parsing"), this block was removed. But when it was an
existing block, data already queued were removed with it. If these data
were already scheduled for output, the channel's output count then
exceeded the data present in the buffer.

Now, on parsing error, the block is only removed if it was created by
this call. Otherwise, it is restored to its previous size.

This patch must be backported with the commit above, as far as 2.6.

6 hours agoBUG/MINOR: h1: reject a short status code without reason phrase
Christopher Faulet [Thu, 3 Dec 2026 14:32:39 +0000 (15:32 +0100)]
BUG/MINOR: h1: reject a short status code without reason phrase

Since the commit 8a47f9028 ("MEDIUM: http: add the "short-status-code"
violation exception"), status codes shorter than 3 digits are rejected by
default. But the check was only performed when the status code was
followed by a space. When it was directly followed by the end of line,
without reason phrase, the status code was still accepted. For
instance, "HTTP/1.1 20\r\n" was accepted while "HTTP/1.1 20 OK\r\n" was
rejected.

Now the status code length is checked in both cases.

This patch must be backported to 3.5, and with the commit above if it is
backported further.

6 hours agoBUG/MINOR: h1: use the right masks to test the accepted HTTP violations
Christopher Faulet [Thu, 3 Dec 2026 14:12:46 +0000 (15:12 +0100)]
BUG/MINOR: h1: use the right masks to test the accepted HTTP violations

Two tests of the accepted HTTP violations were wrong. In
h1_headers_to_hdr_list(), HTTP_VIO_HDR_VALUE_NUL was used as a mask
instead of a bit position. So the NUL character in a header value was
accepted or rejected depending on the "fragment-in-url" and the
"status-code-long" violations. And in h1_process_res_vsn(), the
response version string was checked against the acceptable request
violations instead of the response ones.

This patch must be backported to 3.5.

6 hours agoBUG/MINOR: mux-h2: don't reject an empty DATA frame ending a bodyless response
Christopher Faulet [Thu, 3 Dec 2026 14:04:43 +0000 (15:04 +0100)]
BUG/MINOR: mux-h2: don't reject an empty DATA frame ending a bodyless response

On the backend side, a HEAD response (or a 204/304) may announce a
content-length and be ended by an empty DATA frame with the END_STREAM
flag. It is valid (RFC 9113 #8.1.1). But h2c_handle_data() reported "ES
on DATA frame before content-length" in this case: the stream was reset
with a PROTOCOL_ERROR, a glitch was counted and the stream protocol
errors counter was incremented. The response itself was properly
forwarded because h2_frt_transfer_data() already handled this case.
However, with "tune.h2.be.glitches-threshold", a compliant server could
lose its connection.

Now, like for the END_STREAM flag on the HEADERS frame, the content-length
check is skipped for bodyless responses on the backend side.

The reg-test http_bodyless_response.vtc was extended to check the stream
protocol errors counter of the H2 backend. The HEAD responses received from
the H2 server were already in this case.

This patch should be backported to all stable versions.

10 hours agoBUG/MINOR: haterm: parse the arguments from the first '?' of the URI
Aleksandar Lazic [Thu, 3 Dec 2026 20:34:41 +0000 (21:34 +0100)]
BUG/MINOR: haterm: parse the arguments from the first '?' of the URI

The URI parser looked for the last '?' of the URI instead of the first
one, so only the arguments after the last '?' were used. The example
of the documentation and of the help page, "/?r=500?s=0?c=0?t=1000",
thus only applied "t=1000" and returned a 200. httpterm used the first
'?', and the arguments loop already accepts '?' as a delimiter between
arguments, like '&', ',', ';' and '/'.

Let's stop at the first '?'.

This was introduced with haterm by commit c9d47804d ("MINOR: haterm:
add haterm HTTP server"), so it should be backported to 3.4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Aleksandar Lazic <al-haproxy@none.at>
10 hours agoDOC: haterm: document the X-req and X-rsp headers
Aleksandar Lazic [Thu, 3 Dec 2026 20:00:33 +0000 (21:00 +0100)]
DOC: haterm: document the X-req and X-rsp headers

Describe the two informational headers of the responses and the times
they report in microseconds, including the -1 reported by X-req when
the request body is drained after the response.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Aleksandar Lazic <al-haproxy@none.at>
10 hours agoMINOR: haterm: report the real times in the X-req and X-rsp headers
Aleksandar Lazic [Thu, 3 Dec 2026 20:00:18 +0000 (21:00 +0100)]
MINOR: haterm: report the real times in the X-req and X-rsp headers

The X-req and X-rsp headers inherited from httpterm always reported
"time=0 ms" and "time=0 ms (0 real)", marked as TODO in the code. This
makes them useless to see how long a request took to arrive or how long
haterm really waited before responding.

The dates of the stream are now set using now_ns. X-req reports the
time from the stream creation to the end of the request, which covers
the upload of the request body, or -1 when the body is drained after
the response (?A=1). X-rsp reports the delay requested with ?t=
followed by the one really spent waiting. Both are in microseconds
("us") since most responses take less than a millisecond.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Aleksandar Lazic <al-haproxy@none.at>
10 hours agoMINOR: haterm: add timestamps to the haterm stream
Aleksandar Lazic [Thu, 3 Dec 2026 20:00:02 +0000 (21:00 +0100)]
MINOR: haterm: add timestamps to the haterm stream

Add three dates to struct hstream: the date the stream was created,
the date the request was fully received and the date the response
delay started. They will be used to report the real times in the
X-req and X-rsp headers, which always report 0 for now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Aleksandar Lazic <al-haproxy@none.at>
28 hours agoBUG/MEDIUM: ssl: allow the ML-KEM groups in the FIPS curve check
Chris Staite [Thu, 3 Dec 2026 09:21:17 +0000 (09:21 +0000)]
BUG/MEDIUM: ssl: allow the ML-KEM groups in the FIPS curve check

Since commit 96c7759f3 ("MEDIUM: ssl: add FIPS elliptic curve check for
AWS-LC"), ssl_fips_check_curves() only accepts P-256, P-384 and P-521
when the library runs in FIPS mode, and refuses to start on anything
else. This also rejects the ML-KEM based key exchange groups, which makes
it impossible to enable post-quantum key exchange in FIPS mode:

  ssl-default-server-curves SecP256r1MLKEM768:X25519MLKEM768:P-256:P-384

  [ALERT] 'server <CLT-OCSP-CHK>/<HTTPSCLIENT>' : FIPS mode active but
  non-FIPS curve(s) configured: 'SecP256r1MLKEM768', 'X25519MLKEM768'.

This was observed with AWS-LC FIPS 4.2.0. The same applies to "curves"
on bind and server lines and to ssl-default-bind-curves.

These groups are in fact fine in FIPS mode. ML-KEM is standardized in
FIPS 203, and NIST SP 800-56C Rev. 2 allows a shared secret made of
several components to be used in key derivation as long as one of them
is generated by an approved scheme, which is the case of ML-KEM. This
makes X25519MLKEM768 acceptable despite X25519 alone not being approved.
For SecP256r1MLKEM768 and SecP384r1MLKEM1024 both components are
approved anyway. AWS-LC itself does not restrict these groups when built
in FIPS mode: they are part of its default group list and its service
indicator reports ML-KEM as approved.

The impact is significant since X25519MLKEM768 is the only post-quantum
hybrid group implemented by Chromium and the only one enabled by default
in Firefox (which only uses SecP256r1MLKEM768 after a configuration
change), so browsers cannot get a post-quantum key exchange from a FIPS
HAProxy without it.

Let's add NID_X25519MLKEM768, NID_SecP256r1MLKEM768,
NID_SecP384r1MLKEM1024 and NID_MLKEM512/768/1024 to the list of approved
NIDs, each one being guarded by #ifdef since they depend on the AWS-LC
version. Everything else (X25519 alone, X448, brainpool, P-224, the
pre-standard Kyber drafts) is still rejected.

This must be backported to 3.5.

29 hours agoCI: github: check that AWS-LC FIPS mode is active
William Lallemand [Thu, 3 Dec 2026 14:58:33 +0000 (14:58 +0000)]
CI: github: check that AWS-LC FIPS mode is active

The AWS-LC FIPS workflow previously ran against non-FIPS libraries
without detecting the mistake, leaving FIPS-specific paths untested.

Require haproxy -cc 'fips_mode()' to succeed before running the tests.
This also rejects non-FIPS libraries restored from an existing cache.

This check should be backported to 3.5 along with the build helper fix.

29 hours agoSCRIPTS: honor FIPS mode when building AWS-LC
William Lallemand [Thu, 3 Dec 2026 14:55:54 +0000 (14:55 +0000)]
SCRIPTS: honor FIPS mode when building AWS-LC

The AWS-LC FIPS workflow passes FIPS=1 with AWS_LC_VERSION, but the
shared build helper ignored it and always disabled Go and Perl code
generation. Consequently the jobs built non-FIPS libraries and left
HAProxy's FIPS-specific code paths untested despite appearing to cover
them.

This was introduced by d572a131a7 ("CI: github: add AWS-LC FIPS testing
workflow"), which added the workflow without updating the build helper.

Pass the FIPS setting to CMake and enable the required generators for
FIPS builds. Append -fips to the installed-version marker only in FIPS
mode, leaving the build directory and workflow cache key unchanged.

This fix should be backported to 3.5.

30 hours agoBUG/MINOR: mux-quic: always notify stream upper layer on reset
Amaury Denoyelle [Mon, 30 Nov 2026 14:03:04 +0000 (15:03 +0100)]
BUG/MINOR: mux-quic: always notify stream upper layer on reset

Function qcc_reset_stream() is used when the stream is reset
prematurely. Along the RESET_STREAM emission, it also notifies the
stream upper layer, so that the error is transferred to the other MUX
side.

Previously, the function was skipped if the stream was already locally
closed, as RESET_STREAM is unnecessary in this case. However, this
causes an issue on the backend side as the call is skipped if the
request is already transferred. The error is thus not reported on the
other side and the client will be left waiting until the server timeout
is hit.

On the frontend side, impact is much more limited. If the stream is
locally closed, the server has already transmitted its response and is
no longer waiting. The only user-visible change is on haproxy stream
termination log, with a possible client abort (C---) now reported.

Fix this by adjusting qcc_reset_stream() so that, when the stream is
locally closed, upper-layer notification is still executed even though
the RESET_STREAM emission is skipped.

To ensure notification is only performed once, an additionnal check is
performed to skip it if SE_FL_ERROR or SE_FL_ERR_PENDING is already set.
As a side-effect, this prevents the termination event code from being
overwritten.

This must be backported up to 3.3 after a period of observation, as this
is mainly an issue on the backend side.

31 hours agoREGTESTS: http-messaging: fix h1_big_chunk_size_line race on the error report
Christopher Faulet [Thu, 3 Dec 2026 13:21:42 +0000 (14:21 +0100)]
REGTESTS: http-messaging: fix h1_big_chunk_size_line race on the error report

The request is larger than the buffer, so it is always received in at
least two reads and the chunk-size line error is only detected once the
headers were consumed. Depending on whether the stream analyzed the
headers before that, the error is reported by the H1 mux ("<BADREQ>"
logged) or by the stream, after the request was forwarded to the
server (request line logged, PH-- or even PL-- with a 200). The latter
was observed on macOS.

Let's set "option http-buffer-request" to never forward the request
before the error, and accept both the "<BADREQ>" and the request line
in the log. A 400 with PR-- termination flags is now always expected.

This should be backported with the commit 6e495dbb2a48 ("BUG/MAJOR: h1-htx:
report an error on a too long chunk-size line").

32 hours agoBUG/MINOR: flt-trace: consume the whole block size when dumping HTX data
Christopher Faulet [Thu, 3 Dec 2026 10:02:52 +0000 (11:02 +0100)]
BUG/MINOR: flt-trace: consume the whole block size when dumping HTX data

In trace_htx_hexdump(), the remaining length to dump was decremented by
the length of the block value instead of the block size. But the length
is expressed in bytes of the HTX message. For a block without value or
with a value smaller than the block itself, like a NOOP block, the length
was not decremented accordingly and the dump could go beyond the
forwarded data. For instance, with a NOOP block in the middle of the
payload, one extra byte of the next DATA block was dumped.

Now the whole block size, minus the offset, is consumed.

This patch must be backported to 3.5.

32 hours agoBUG/MINOR: mux-h2: emit the end of stream in h2_done_ff() on EOI without data
Christopher Faulet [Thu, 3 Dec 2026 09:58:06 +0000 (10:58 +0100)]
BUG/MINOR: mux-h2: emit the end of stream in h2_done_ff() on EOI without data

When the producer reports the end of input during a fast-forward without
any data, h2_done_ff() left without emitting anything. It happens for
instance when a close-delimited H1 message is fast-forwarded and the
read0 is detected while no data were received. The end of the stream was
then only reported by h2_do_shutw(), on shutdown, delaying it for no
reason.

Now, in that case, an empty DATA frame with the ES flag is emitted. If it
cannot be emitted, it is still left to h2_do_shutw().

This patch could be backported to all stable versions supporting the
zero-copy forwarding (3.0 and above).

32 hours agoBUG/MINOR: mux-fcgi: don't send anything after the end of the request
Christopher Faulet [Thu, 3 Dec 2026 09:52:22 +0000 (10:52 +0100)]
BUG/MINOR: mux-fcgi: don't send anything after the end of the request

Once the empty STDIN record marking the end of the request was sent, the
stream state was unchanged and fcgi_snd_buf() kept processing the HTX
blocks. So a second EOM flag, on a NOOP or an EOT block, led to a second
empty STDIN record. And DATA blocks were sent in STDIN records after the
end of the request. Both are protocol violations for the FastCGI
application. It should not happen with a valid HTX message, but it is
safer to properly handle this case.

Now, the processing loop stops once the empty STDIN record was sent and
the remaining data are drained, like it is done after a close.

This patch must be backported to 3.5.

32 hours agoREGTESTS: h3: check the options dropping the trailers on the backend side
Christopher Faulet [Thu, 3 Dec 2026 10:26:01 +0000 (11:26 +0100)]
REGTESTS: h3: check the options dropping the trailers on the backend side

This reg-test checks "option http-drop-request-trailers" and "option
http-drop-response-trailers" are properly handled by the H3 mux on the
backend side. Since vtest doesn't speak H3, the H2 requests are converted
to H3 and sent over a local qmux connection to a second frontend which
converts them back to H2.

It is related to the commit 2c98edb72 ("BUG/MINOR: h3: use the right
option to drop the trailers on the backend side"). It relies on QMux, so
it may only be backported to 3.5.

32 hours agoBUG/MINOR: h3: use the right option to drop the trailers on the backend side
Christopher Faulet [Thu, 3 Dec 2026 09:48:42 +0000 (10:48 +0100)]
BUG/MINOR: h3: use the right option to drop the trailers on the backend side

In h3_resp_trailers_send(), the trailers were dropped when the option
"http-drop-response-trailers" was set on the proxy, whatever the side. But
on the backend side, the request trailers are sent. So on a QUIC backend,
"http-drop-request-trailers" was ignored and the request trailers were
dropped if "http-drop-response-trailers" was set, for instance on a listen
section.

Now, like for the H2 mux, the option depending on the side is checked.

This patch must be backported to 3.3.

32 hours agoBUG/MINOR: hlua: do nothing in set_eom() if the message is already ended
Christopher Faulet [Thu, 3 Dec 2026 09:27:50 +0000 (10:27 +0100)]
BUG/MINOR: hlua: do nothing in set_eom() if the message is already ended

HTTPMessage:set_eom() called htx_set_eom() without checking the state of
the message. If the end of the message was already reached, the EOM flag
could be reported twice: when the block carrying it was already forwarded,
the message could be empty and a NOOP block carrying the EOM flag was then
added. And, in a tunnel, the BUG_ON() in htx_set_eom() could be triggered,
the tail block being a RAW_DATA block. It could also be triggered if the
tail block was not a block that can carry the EOM flag.

Now, nothing is done if the message is already ended, the message state
being also checked. And an error is raised if the EOM flag cannot be set
on the tail block. The documentation was updated accordingly.

This patch must be backported to 3.5.

32 hours agoBUG/MEDIUM: mux-fcgi: accept a request ended by trailers without the EOM
Christopher Faulet [Thu, 3 Dec 2026 09:14:09 +0000 (10:14 +0100)]
BUG/MEDIUM: mux-fcgi: accept a request ended by trailers without the EOM

When the first record of a request is sent, the length of the body must be
known, either because a content-length was announced or because the whole
message was received. In this last case, the tail block of the HTX message
must carry the EOM flag. But since the commit 221c40bbf ("MINOR: htx: Add
a noop block to carry the EOM flag on an empty message"), an EOT block
without the EOM flag is a valid state, the EOM flag being reported later
on a NOOP block. It happens for instance when an H3 request is received
with trailers, the FIN being received in a separate frame. The wait for
the request body stops on the trailers, the payload being fully received.
So such request was rejected by the FCGI mux with a parsing error.

Now, the request is also accepted when the tail block is an EOT block.
The CONTENT_LENGTH parameter is already computed by counting the DATA
blocks up to the trailers. The empty STDIN record will be sent on the NOOP
block carrying the EOM flag.

This patch must be backported to 3.5.

32 hours agoBUG/MINOR: http-ana: don't stop waiting for the body on a NOOP block
Christopher Faulet [Thu, 3 Dec 2026 09:10:49 +0000 (10:10 +0100)]
BUG/MINOR: http-ana: don't stop waiting for the body on a NOOP block

In http_wait_for_msg_body(), all the payload was considered as received
when the tail block of the HTX message was of a type greater than
HTX_BLK_DATA, to detect the trailers. But since the commit 221c40bbf
("MINOR: htx: Add a noop block to carry the EOM flag on an empty
message"), a NOOP block may be found anywhere in the message and its type
is greater than HTX_BLK_DATA. So a NOOP block without the EOM flag at the
end of the message stopped the wait, the rules being evaluated on a
partial payload. For now, such block can only be produced by the
HTTPMessage:unset_eom() Lua function.

Now, only TLR and EOT blocks are considered.

This patch must be backported to 3.5.

32 hours agoBUG/MEDIUM: mux-h1: report an error when the payload is smaller than the C-L
Christopher Faulet [Thu, 3 Dec 2026 08:57:45 +0000 (09:57 +0100)]
BUG/MEDIUM: mux-h1: report an error when the payload is smaller than the C-L

When the end of a message with a content-length was reached, the H1 mux
never checked the whole announced payload was sent. On the last DATA block
carrying the EOM flag, on a NOOP block carrying the EOM flag or on the
trailers, the message was switched to the DONE state, regardless of the
remaining length. With the zero-copy forwarding, the EOM flag was just
ignored and the message remained in DATA state. The same was true when
the payload was fast-forwarded, the end of input being ignored by
h1_done_ff(). The connection was not reused, thanks to the check performed
in h1s_destroy(). But, on the server side, the request was considered as
finished while the server was still waiting for the remaining payload. So
the client got a 504 after the server timeout. This happens for instance
when the content-length is modified by an http-request rule.

Now, an error is reported in this case, like for a payload larger than
announced or a chunk smaller than announced. In h1_done_ff(), the stream
is also woken up because it is called by the producer. Since the error
cannot be reported on the HTX message in that case, it is reported on the
server side and the client gets a 502 instead of a 500. A reg-test was
added.

This patch should be backported to all stable versions. Before 3.5, there
is no NOOP block, so the corresponding part must be dropped. Before 2.9,
there is no h1_done_ff(), so the corresponding part must be dropped too.

32 hours agoBUG/MINOR: mux-h1: skip raw data after a rejected CONNECT again
Christopher Faulet [Thu, 3 Dec 2026 08:34:46 +0000 (09:34 +0100)]
BUG/MINOR: mux-h1: skip raw data after a rejected CONNECT again

Since the commit e99253b70 ("BUG/MINOR: mux-h1: properly handle NOOP
blocks and track EOM emission"), RAW_DATA blocks found in DONE state on
the backend side are only skipped if the end of the request was sent,
the H1S_F_EOM_SENT flag being set. But this flag was never set for a
CONNECT request. In h1_make_eoh(), the CONNECT case is handled before the
EOM flag is tested, even if the EOH block carries the EOM flag, which is
always the case for a CONNECT request received from an H1 or an H2
client. So when a CONNECT was rejected by the server, early tunnel data
still pending in the request buffer were rejected with a processing
error instead of being silently skipped. It was a regression of the
commit 04456142e ("BUG/MINOR: mux-h1: Discard pending raw data after a
tunnel rejection").

Now, the H1S_F_EOM_SENT flag is set for a CONNECT request when the EOH
block carries the EOM flag.

This patch must be backported to 3.5.

32 hours agoBUG/MEDIUM: mux-h2: don't lose EOM when the output buffer is full
Christopher Faulet [Thu, 3 Dec 2026 08:27:04 +0000 (09:27 +0100)]
BUG/MEDIUM: mux-h2: don't lose EOM when the output buffer is full

When a NOOP block carrying the EOM flag was processed by h2_snd_buf(), an
empty DATA frame with the ES flag was emitted to report the end of the
message. But if this frame could not be emitted, because the output buffer
was full or could not be allocated, the NOOP block was removed anyway and
counted as sent. So the end of the message was lost and the END_STREAM was
never sent. This could happen when the END_STREAM was received in a
separate empty DATA frame (or a standalone FIN for H3) while the H2
connection was congested. A server waiting for the end of the request could
then wait until a timeout. On the client side, the END_STREAM was only sent
on the stream shutdown.

Now, the NOOP block is kept when the empty DATA frame cannot be emitted.
The stream is blocked, like for other blocks, and it will be retried when
some room is made in the output buffer.

This patch must be backported to 3.5.

32 hours agoBUG/MEDIUM: mux-h2: always end the stream with the trailers
Christopher Faulet [Thu, 3 Dec 2026 07:37:01 +0000 (08:37 +0100)]
BUG/MEDIUM: mux-h2: always end the stream with the trailers

Since the commit 221c40bbf ("MINOR: htx: Add a noop block to carry the EOM
flag on an empty message"), an EOT block without the EOM flag is a valid
state. In this case, h2s_make_trailers() emitted a trailers HEADERS frame
without the ES flag, and the END_STREAM was then sent in an empty DATA
frame when the NOOP block carrying the EOM flag was processed. But in H2,
the trailers frame must end the stream (RFC 9113 #8.1). The peer must
treat such message as malformed. This happens for instance when H3
trailers are received without the FIN, the FIN arriving in a separate
frame, and forwarded to an H2 server.

Waiting for the EOM before emitting the trailers is not an option: the
H2 mux has no way to be woken up when the NOOP block carrying the EOM is
forwarded, so the stream could be blocked until a timeout. But nothing
else than the EOM may follow the trailers. So, like for the H1 mux, the
EOT block now ends the message on the wire, with or without the EOM
flag. The trailers frame always carries the ES flag and the stream is
always half-closed (local). The NOOP block carrying the EOM, if any, is
then silently drained.

This patch must be backported to 3.5.

32 hours agoBUG/MEDIUM: cache: report the end of message via HTX after a zero-copy forwarding
Christopher Faulet [Wed, 2 Dec 2026 16:53:30 +0000 (17:53 +0100)]
BUG/MEDIUM: cache: report the end of message via HTX after a zero-copy forwarding

Since the commit c061ba30f ("MAJOR: cache: Send cached objects using
zero-copy forwarding"), when all the payload of a cached object was sent
using the zero-copy forwarding, the end of the message was directly
reported by http_cache_fastfwd(), by setting the EOI and EOS flags on the
applet. The end of the message was then only reported to the consumer via
the IOBUF_FL_EOI flag. But the H1 mux does not emit the last chunk in
that case. So, for an object ending on a DATA block (typically from an
H2 origin without content-length) and too large to be sent at once with
its headers, the response was sent chunked to HTTP/1.1 clients without
its last chunk, and every cache hit failed. The H2 and H3 muxes were not
affected because they set the END_STREAM flag on the last DATA frame. And
objects ending on an EOT block were not affected either because the
zero-copy forwarding stops on this block.

Now, http_cache_fastfwd() only disables the zero-copy forwarding when all
the payload was forwarded, like the stats applet does. The end of the
message is then reported by the I/O handler via the HTX message, by
setting the EOM flag. So the consumer can properly finish the message.

A reg-test was added, with an H2 origin and HTTP/1.1 clients.

This patch must be backported as far as 3.0.

32 hours agoBUG/MEDIUM: cache: don't store a close-delimited response cut by an error
Christopher Faulet [Wed, 2 Dec 2026 16:45:28 +0000 (17:45 +0100)]
BUG/MEDIUM: cache: don't store a close-delimited response cut by an error

A response without content-length and not chunked ends with the close of
the server connection. In that case, the HTTP analyzer considers the end
of the message is reached as soon as the end of stream or an abort is
reported on the server side, whatever the reason. So the http_end callback
of the cache filter was called and the cache entry was marked as complete,
even if the response was cut by a timeout, a reset or a client abort. The
truncated object was then served to every client until it expired.

Now, for a response without transfer length, the cache entry is only
committed if the end of input was reached on the server side, without
error. Otherwise, the entry is released.

A reg-test was added to check a clean close and a server timeout. The
reset case cannot be tested with vtest.

This patch must be backported to all stable versions.

32 hours agoBUG/MEDIUM: bwlim: never stop the forwarding on the trailers
Christopher Faulet [Wed, 2 Dec 2026 16:17:18 +0000 (17:17 +0100)]
BUG/MEDIUM: bwlim: never stop the forwarding on the trailers

The bwlim filter limits the amount of data forwarded by returning, from its
http_payload callback, the number of bytes allowed by the quota. But this
quota was applied on all the HTTP payload, including the trailers (TLR
blocks) and the EOT block. So the forwarding could stop in the middle of
the trailers. However, the muxes emit the trailers all at once and cannot
send them partially. On the H1 side, an error was reported because a TLR
block was larger than the amount of data to send, and the response was
aborted without its trailers. On the H2 side, all the trailers were
emitted, consuming more data than forwarded, leading to an inconsistent
state and the stream could linger until the client timeout (or a crash on
a BUG_ON() with DEBUG_STRICT).

Only the payload must be subject to the bandwidth limitation. So now, when
the limit ends on a TLR block or on the EOT block, it means all the data
were forwarded, and everything is forwarded. This is also true when
nothing can be forwarded because the stream is paused: the trailers are no
longer delayed.

This patch must be backported to all stable versions.

32 hours agoBUG/MEDIUM: mux-h1: don't swap buffers for a chunk that cannot be framed
Christopher Faulet [Wed, 2 Dec 2026 15:11:39 +0000 (16:11 +0100)]
BUG/MEDIUM: mux-h1: don't swap buffers for a chunk that cannot be framed

When a chunked message is sent and a new chunk is started in the zero-copy
path of h1_make_data(), the chunk size is taken from the <kop> hint of the
sedesc when it is set. Since the commit e582abe8a ("BUG/MEDIUM: mux-h1:
never forward more data than announced in a chunk"), an error is reported
if the DATA block is bigger than the announced chunk size. But this check,
like the other ones on the chunk size, was performed after the buffers were
swapped and the chunk size was prepended. So the output buffer already
contained the chunk size line followed by more data than announced, and it
was sent anyway. The response was cut and the client waited for the end of
the chunk until the client timeout.

However, <kop> is only a minimal guarantee. It may be lower than the DATA
block, for instance when the end of a chunk and the beginning of the next
one are merged in the same block, after some data were forwarded
mid-chunk, like when the cache stops storing a response exceeding the
maximum object size. It is not an error. The copy path properly handles
this case by splitting the block.

So now, the conditions to perform the zero-copy are evaluated in a
dedicated function, h1_zero_copy_data_allowed(), before swapping the
buffers. For chunked messages, it is only performed if the whole block fits
in the current chunk or in the new one, and if the end of the message
matches the end of the chunk. Otherwise, the copy path is used. It splits
the block or reports the error before anything is emitted. The checks on
the chunk size performed after the buffers swap are useless now and are
removed. Messages with a content-length are not changed: the check on the
announced length is still performed after the buffers swap, but an error
there is a real protocol error.

The commit above was introduced in 3.5-dev14 and was marked to be
backported as far as 3.3. This patch must be backported with it, so to
3.5, and as far as 3.3 where the commit above was backported.

32 hours agoBUG/MINOR: mux-pt: report send errors in termination events from done_ff()
Christopher Faulet [Thu, 15 Oct 2026 09:48:50 +0000 (09:48 +0000)]
BUG/MINOR: mux-pt: report send errors in termination events from done_ff()

When the zero-copy forwarding is used with splicing, the data received by
the producer are immediately sent by the consumer through
mux_pt_done_ff(). If this send fails, the error is reported to the sedesc
but, unlike in mux_pt_snd_buf() and mux_pt_resume_fastfwd(), no "snd_err"
termination event is reported for the mux connection. So the term_events
sample fetch misses it and only shows the receive error detected later by
the fd/xprt layer, which makes the analysis of aborted spliced transfers
misleading. The H1 mux reports it in h1_done_ff().

This was introduced with the commit 9cbc3229e ("MINOR: tevt/mux-pt: Add
support for termination event logs") in 3.2-dev5. This patch must be
backported as far as 3.2.

32 hours agoDOC: config: fix the graceful close description of tune.h1.*.glitches-threshold
Christopher Faulet [Wed, 7 Oct 2026 16:14:03 +0000 (18:14 +0200)]
DOC: config: fix the graceful close description of tune.h1.*.glitches-threshold

The description of the graceful close performed at 75% of the H1 glitches
thresholds was copied from the H2 one and says that a GOAWAY is advertised,
which doesn't exist in HTTP/1. The H1 mux switches the connection to close
mode instead, so that it is closed at the end of the current transfer (with
a "Connection: close" header on the frontend side). Let's fix the
description.

This was introduced with commit 5904f8279 ("MINOR: mux-h1: perform a
graceful close at 75% glitches threshold") in 3.4-dev2, and should be
backported as far as 3.4.

32 hours agoBUG/MINOR: htx: mark the message unordered when inserting headers or trailers
Christopher Faulet [Mon, 28 Sep 2026 17:10:48 +0000 (19:10 +0200)]
BUG/MINOR: htx: mark the message unordered when inserting headers or trailers

Before commit 0a9ecebda ("MEDIUM: htx: Insert headers and trailers
before corresponding end-of block") in 3.5-dev8, htx_add_header() and
htx_add_trailer() set HTX_FL_UNORDERED when the block was added after
the end-of-headers or end-of-trailers block, since its payload is then
located after the ones of the following blocks. The new code now moves
the block before the end-of block, but doesn't set this flag anymore
while the payloads are still unordered. The flag is used to decide to
defragment the message in the body sample fetches (req.body,
res.body, req.body_param...), so that DATA blocks may be merged and the
body retrieved without copy. Without it, this optimization is skipped. This
is not a correctness issue, but a performance regression.

Let's set the flag again when the new block is moved.

This patch should be backported to 3.5.

32 hours agoBUG/MINOR: flt_trace: consider tunneled data (RAW_DATA blocks) as data
Christopher Faulet [Mon, 28 Sep 2026 17:11:14 +0000 (19:11 +0200)]
BUG/MINOR: flt_trace: consider tunneled data (RAW_DATA blocks) as data

Since tunneled data are stored in HTX_BLK_RAW_DATA blocks, the trace
filter's HTX helpers only considering HTX_BLK_DATA blocks ignore them:
nothing is hexdumped for tunneled data (e.g. websocket or CONNECT) and the
"random-forwarding" option is silently disabled for them since the data
length is found to be zero.

Let's use htx_is_data_type() to consider both block types.

Tunneled data are stored in HTX_BLK_RAW_DATA blocks since 3.5-dev8, so
this patch should be backported to 3.5.

32 hours agoMINOR: h1: preserve version and method flags when restarting on output_full
Christopher Faulet [Tue, 1 Dec 2026 14:31:07 +0000 (15:31 +0100)]
MINOR: h1: preserve version and method flags when restarting on output_full

When the conversion of the parsed headers into HTX does not fit in the
destination, h1_postparse_req_hdrs() and h1_postparse_res_hdrs() reset the
message parser state to restart the parsing once the destination was
drained. But the reset dropped some flags not derived from the message
itself: on the response side, the HEAD or CONNECT method flags set by the
mux from the request, and the version flag, which is only set by the mux
for a response without start line (FCGI). On the next parsing they would
not be set again: for a FCGI response, the version is never re-derived
from the message, so the synthesized start line could get the wrong HTTP
version, and a response to a HEAD request could be framed with a body.
On the request side, the version flag is preserved too, for consistency.

This cannot be triggered today: the reset is only reachable on the H1 side,
where the mux sets the method flags again before each parsing attempt and
the parser sets the version flag from the start line, and a FCGI response
cannot hit output_full (there is only one response per stream, so the
destination HTX is empty when its headers are parsed, and a too large
message takes the error path instead). This is a hardening aligning the
reset with the restart convention of h1_headers_to_hdr_list()
(H1_MF_RESTART_MASK plus H1_MF_VER_11).

32 hours agoBUG/MINOR: mux-fcgi: reject 1xx interim responses from a FCGI server
Christopher Faulet [Tue, 1 Dec 2026 14:13:31 +0000 (15:13 +0100)]
BUG/MINOR: mux-fcgi: reject 1xx interim responses from a FCGI server

There is no way to handle an interim (1xx) response from a FCGI server: the
FCGI protocol has no notion of interim response, the request is fully
processed before the response is emitted. If one was relayed as-is, the
client would receive an orphan interim response followed by an error,
without any final response.

The H1 parser does not complete a 1xx message (no EOM, waiting for the final
response), so such a response was previously forwarded to the HTX layer and
then to the client if the application closed the connection without sending
a final response: the client received a "100 Continue" with a bogus "status:
100" header, followed by a 502. Now the response is rejected as soon as the
headers are parsed and the client only gets the 502.

This may be backported to all supported versions.

32 hours agoMINOR: mux-h1: ignore the trailers when formatting a non-chunked HTX message
Christopher Faulet [Tue, 1 Dec 2026 13:48:28 +0000 (14:48 +0100)]
MINOR: mux-h1: ignore the trailers when formatting a non-chunked HTX message

h1_format_htx_msg() documents that the trailers are silently ignored when
the message is not chunked, but the HTX_BLK_TLR blocks were formatted like
headers in that case. A trailer name/value pair would then be emitted after
the body of a non-chunked message, without any framing, corrupting the
output.

No caller can currently reach this (the only caller formats fixed error
messages, which have no trailers), so this is a latent hardening of the
documented contract.

32 hours agoREGTESTS: mux-h1: check the H2 preface received in several segments
Christopher Faulet [Tue, 1 Dec 2026 13:32:27 +0000 (14:32 +0100)]
REGTESTS: mux-h1: check the H2 preface received in several segments

Follows commit "BUG/MINOR: mux-h1: support the H2 preface received in
several segments": an HTTP/2 prior-knowledge client sending its preface in
several segments on an HTTP/1 listener must still be upgraded.

The preface is sent as raw segments with sendhex, split at 18 and 23 bytes
(the lowest and the highest splits that used to fail), at 1 and 16 bytes,
and in several small segments. It is followed by a raw H2 request (SETTINGS
+ HEADERS with literal headers). A short delay is used between the
segments, otherwise they could be received at once. The upgrade is verified
on the backend side: the vtest client cannot initialize its H2 state after
a segmented preface (the first "stream" command always sends a preface). A
barrier is used to wait for the server before closing the client
connection. Two negative cases are also checked: a partial preface followed
by garbage and a preface-like magic, both answered with a 400.

It could be backported with the commit above.

32 hours agoBUG/MINOR: mux-h1: support the H2 preface received in several segments
Christopher Faulet [Tue, 1 Dec 2026 12:57:54 +0000 (13:57 +0100)]
BUG/MINOR: mux-h1: support the H2 preface received in several segments

When a cleartext HTTP/2 prior-knowledge client connects to an HTTP/1
listener, the connection is upgraded to H2 if the first request matches the
H2 connection preface. But the check with b_isteq() only succeeds when the
whole 24-byte preface is already buffered. When the preface is received in
two or more segments and the first one holds 18 to 23 bytes ("PRI *
HTTP/2.0\r\n\r\n" possibly with the beginning of "SM"), b_isteq() reports a
partial match (0), the data are parsed as a complete but invalid H1 request
and the client receives a 400 instead of the upgrade.

The fix detects the partial match by truncating the preface to the number of
buffered bytes, and then waits for more data instead of parsing it as
H1. The full preface still upgrades, anything that is not a strict prefix of
the preface is parsed as H1 exactly as before, and the http-request timeout
still applies while waiting.

This patch could be backported to all supported versions.

32 hours agoMINOR: mux-h1: never negotiate a zero-sized chunk in h1_nego_ff()
Christopher Faulet [Tue, 1 Dec 2026 11:07:51 +0000 (12:07 +0100)]
MINOR: mux-h1: never negotiate a zero-sized chunk in h1_nego_ff()

In h1_nego_ff(), with NEGO_FF_FL_EXACT_SIZE and a chunked message in
CHUNK_CRLF/CHUNK_SIZE state, a producer calling with <count> == 0 makes
h1_make_chunk() emit "0\r\n", i.e. the last-chunk, prematurely ending the
message for the peer.

No case was found where it happens. The stream connectors (sc_conn_recv()
and sc_applet_recv()) only call the producers to fast-forward data when
there is something to forward. But it is not true for all producers. For
instance, haterm may negotiate with <count> == 0 when its splicing pipe
still contains data while everything was already produced. In that case,
the message is already finished, and the fast-forwarding is disabled
because of the message state. But nothing in h1_nego_ff() prevents it for
a chunked message.

So let's harden it: when <count> is 0, no chunk is started. The iobuf is
still set up as usual, so the producer can safely use it, and nothing is
forwarded. The IOBUF_FL_NO_FF flag is not set because <count> == 0 is a
transient condition, and this flag would permanently disable the
fast-forwarding for the stream.

33 hours agoCLEANUP: h3: reduce header dependency list
Amaury Denoyelle [Wed, 2 Dec 2026 15:06:23 +0000 (16:06 +0100)]
CLEANUP: h3: reduce header dependency list

Remove unneeded header include statements in H3 module. In particular,
quic_conn.h is no longer needed: this requires replacing the
qc_counters() call with dedicated code.

33 hours agoBUG/MINOR: h3: always initialize <hdng_prf> to remove any ambiguity
Amaury Denoyelle [Wed, 2 Dec 2026 15:19:32 +0000 (16:19 +0100)]
BUG/MINOR: h3: always initialize <hdng_prf> to remove any ambiguity

This patch ensures that the h3c connection member <hdng_prf> is always
initialized to NULL.

This is similar to the previous patch which dealt with the
<prx_counters> member: the current code is ambiguous for a backend
connection whose target could be either a server or a proxy instance.
This is no longer possible since the removal of dispatch and option
transparent modes, but the NULL initialization is kept as a defensive
measure.

This should be backported up to 3.5.

33 hours agoBUG/MINOR: h3: remove ambiguity on NULL <prx_counters>
Amaury Denoyelle [Wed, 2 Dec 2026 15:53:25 +0000 (16:53 +0100)]
BUG/MINOR: h3: remove ambiguity on NULL <prx_counters>

The h3c <prx_counters> member is initialized from the proxy, accessed
through the connection target. On the backend side, a server instance is
expected. Historically, a connection target could alternatively be set
to the proxy itself in specific configurations (dispatch and transparent
backends).

In practice, these cases were never usable with QUIC. However, the rest
of the HAProxy codebase is still written defensively around this case.
To remove the current ambiguity, add NULL checks before dereferencing
the <prx_counters> member in the two h3_stats.c helpers.

This must be backported up to 3.3, as this is only relevant since QUIC
backend support.

33 hours agoCLEANUP: h3: adjust diverging prototype
Amaury Denoyelle [Wed, 2 Dec 2026 16:09:37 +0000 (17:09 +0100)]
CLEANUP: h3: adjust diverging prototype

Align h3_inc_err_cnt() prototype with its definition. To ensure future
similar issues are caught, include the header in its corresponding
source file.

This may be backported up to 2.6.

34 hours agoBUG/MEDIUM: cache: do not store unused HTX blocks with the headers
Olivier Houchard [Thu, 3 Dec 2026 10:30:40 +0000 (11:30 +0100)]
BUG/MEDIUM: cache: do not store unused HTX blocks with the headers

When a response is stored, http_action_store_cache() copies all the
blocks of the headers, including the unused ones left by a removed
header, such as after "http-response del-header" or "set-header" on a
header which is not the last one. When the object is served, the applet
tries to add this empty block again, which htx_add_blk() refuses since
commit 58ce50527 ("MINOR: htx: never create, leave nor accept an empty
HTX block"), so each cache hit ends with a 500.

Skip the unused blocks when storing the headers. This can be tested
with "http-response del-header X-Test" before "http-response
cache-store", and a server sending X-Test followed by another header:
the second request for the same URL gets a 500.

This should fix github issue #3616. It must be backported to 3.5.

34 hours agoBUG/MINOR: quic: do not use the FD of another thread group's listener
Olivier Houchard [Thu, 3 Dec 2026 10:03:37 +0000 (11:03 +0100)]
BUG/MINOR: quic: do not use the FD of another thread group's listener

With per-thread-group FD tables, quic_dgram_parse() looks for a listener
of the same bind line in the current thread group, since commit
62d6ed440 ("MEDIUM: quic: Do not use another thread group's listener
FD"). But the CID tree is shared by all bind lines, so a datagram for a
connection may be received on a bind line which has no listener in the
group of the connection's thread, and the listener of the other group
was then kept. If no connection ended up being used, its FD, which
means nothing in the current group, was used to send a Version
Negotiation, Retry or Stateless Reset packet, and a new connection
could be attached to that listener.

Drop the packet in these cases only, ie when the version is not
supported or when no connection is found. Packets for an existing
connection do not need the listener and are still processed. This can
be tested with "tune.fd.tables per-thread-group" and two QUIC bind lines
on different thread groups, by sending to the second one the datagrams
of a connection established on the first one.

This was reported by deanliang06 <dextersquad4@gmail.com>, who proposed
a first fix dropping all such datagrams:

  https://www.mail-archive.com/haproxy@formilux.org/msg47862.html

This should be backported to 3.5.

35 hours agoMINOR: quic: initialize the flags of the QUIC ssl_sock_ctx
Dongwon Jang [Thu, 3 Dec 2026 06:34:07 +0000 (15:34 +0900)]
MINOR: quic: initialize the flags of the QUIC ssl_sock_ctx

qc_alloc_ssl_sock_ctx() takes the ssl_sock_ctx from a pool and does not
initialize its <flags>, so they may be those of a previous connection.
Nothing reads these flags on a QUIC connection for now:
SSL_SOCK_F_HAS_ALPN is set there by the ALPN callback but is only
tested by the TCP I/O handler.

Let's initialize them so that a flag can be read from a QUIC connection
as well. Otherwise the flag added by the next commit could be seen on a
QUIC connection which did not set it.

2 days ago[RELEASE] Released version 3.6-dev0 quic-interop v3.6-dev0
Willy Tarreau [Wed, 2 Dec 2026 15:36:16 +0000 (16:36 +0100)]
[RELEASE] Released version 3.6-dev0

Released version 3.6-dev0 with the following main changes :
    - MINOR: version: mention that it's development again

2 days agoMINOR: version: mention that it's development again
Willy Tarreau [Wed, 2 Dec 2026 15:35:24 +0000 (16:35 +0100)]
MINOR: version: mention that it's development again

This essentially reverts 5db177002f ("MINOR: version: mention that
3.5 is stable now").

2 days ago[RELEASE] Released version 3.5.0 v3.5.0
Willy Tarreau [Wed, 2 Dec 2026 15:18:55 +0000 (16:18 +0100)]
[RELEASE] Released version 3.5.0

Released version 3.5.0 with the following main changes :
    - BUG/MEDIUM: http-htx: normalize Host header carrying the scheme's default port
    - MEDIUM: http: reject percent-encoded chars in the authority and Host
    - DOC: security: a few more clarifications on report processing
    - BUG/MINOR: jwt: Create jwt tree entry even for new empty certificates
    - BUG/MEDIUM: jwt: Add refcount to jwt tree entry
    - BUG/MINOR: jwt: Do not keep ckch_store if jwt tree entry creation failed
    - BUG/MINOR: jwt: Create jwt tree entry even for new empty certificates
    - Revert "BUG/MINOR: jwt: Create jwt tree entry even for new empty certificates"
    - BUG/MAJOR: h3: prevent demux full BUG_ON() crash with incomplete DATA
    - CLEANUP: mux_quic: fix indentation in rcv_buf
    - DEV: sslkeylogger: mark it as a debugging tool only
    - BUG/MEDIUM: mux-h2: don't block other streams while waiting for a tunnel
    - BUG/MINOR: jwe: check that the EC point is on the curve
    - BUG/MINOR: ocsp: Increment certificate_ocsp refcount in 'ssl_sock_copy_cert_key_and_chain'
    - BUG/MEDIUM: ssl: prevent CN fallback when a SAN extension is present
    - BUG/MINOR: http-fetch: only defrag HTX message with payload when fetching body
    - MINOR: http-ana: remove the HTX defrag when waiting for a message payload
    - BUG/MEDIUM: backend: only start the mux early when 0-RTT may be used
    - BUG/MEDIUM: backend: read the cached ALPN only once in connect_server()
    - BUG/MEDIUM: connection: use the websocket mux after the handshake too
    - BUG/MINOR: connection: don't use the cached ALPN if SSL_NO_CACHED_INFO
    - BUG/MINOR: stick-table: don't deinit the buckets of a never initialized table
    - DOC: configuration: warn against using SSLKEYLOGFILE
    - MINOR: ssl: warn at startup when SSLKEYLOGFILE is set
    - BUILD: compression: silence clang's -Wunused-but-set-global on comp_res_ring
    - BUG/MINOR: http-ana: let s-maxage override a null max-age whatever their order
    - BUG/MEDIUM: http-ana: do not let "public" cancel directives forbidding storage
    - MINOR: http-ana: add a transaction flag for requests forbidding storage
    - BUG/MINOR: http-ana: do not store responses to requests with "no-store"
    - MINOR: mux-quic: add conn flag on glitch error set
    - BUG/MINOR: mux-quic: fix crash on frame alloc failure after glitch error
    - BUG/MINOR: mux-quic: fix crash with double qcc_set_error() on QCS free
    - BUG/MINOR: deviceatlas: fix free() of an uninitialized cnew in checkinst
    - BUG/MINOR: log: preserve NULL bytes of strings with "bin"
    - BUG/MINOR: quic-be: install the peer CID only from an accepted Initial
    - REGTESTS: quic: backend must adopt the SCID of the first valid Initial
    - BUG/MEDIUM: mux-h1: defer read0 while input is buffered
    - BUG/MINOR: spoe: force "always" reuse policy when converting SPOP backend
    - BUG/MINOR: stats: never add an empty DATA block in the HTX message
    - BUG/MINOR: flt-decomp: don't leave an empty DATA block when draining
    - MINOR: htx: never create, leave nor accept an empty HTX block
    - DOC: config: Fix docroot description indentation
    - DOC: config: document the FCGI path handling and its security implications
    - BUG/MINOR: h1-htx: report the trailer parsing error position
    - MINOR: tools: add memupper() / memlower() to convert a memory block
    - CLEANUP: pattern: remove the unneeded strlen in pat_idx_tree_pfx()
    - CLEANUP: sample: reduce struct sample by filling a hole
    - OPTIM: acl: always keep the local sample 64-byte aligned
    - OPTIM: acl: only reset ctx and flags, not the whole sample
    - OPTIM: pattern: use ebst_lookup_len() when possible
    - CLEANUP: quic: refactor qc_new_conn() to use an obj_type
    - BUG/MINOR: ssl: free ech_filedir in ssl_sock_free_ssl_conf()
    - BUG/MINOR: ssl: fix ALPN/NPN loss on duplicated crt-list ssl configs
    - BUG/MEDIUM: ssl: fix verify bypass on duplicated crt-list ssl configs
    - BUG/MEDIUM: leastconn: don't hide an avoided server from later lookups
    - Revert "OPTIM: acl: only reset ctx and flags, not the whole sample"
    - Revert "BUG/MINOR: http-ana: Increment scf bytes_out value if an haproxy error is sent"
    - BUG/MEDIUM: peers: do not clear the alive flag of a replacement session
    - BUILD: mux-quic: silence an invalid null-deref warning at -O1
    - IMPORT: uslz: fix a build warning with gcc -O1
    - BUG/MINOR: pattern: do not index too large prefixes using the tree
    - BUG/MINOR: ocsp: Fix too strict parser of 'do-ocsp-request' action
    - DOC: vars: Add missing http/tcp-check part of the set-vars-from-map action
    - BUG/MEDIUM: ssl: ignore unexpected EOFs reported by the SSL library
    - MEDIUM: ssl: never return 0 from the BIO read callback
    - BUG/MEDIUM: peers: don't push updates before a reloaded process resyncs
    - BUG/MINOR: server: reject from/name in peers section
    - MINOR: ssl: unset SSLKEYLOGFILE unless explicitly allowed
    - DOC: config: ssl_c_err, ssl_c_ca_err and ssl_c_ca_err_depth on resumed sessions
    - BUG/MEDIUM: ssl: do not resume sessions whose client cert failed the verification
    - CLEANUP: mux-quic: adjust includes statements
    - BUG/MEDIUM: mux-h1: accept a late EOM on content-length messages
    - BUG/MEDIUM: compression: finish the stream on a NOOP block with EOM
    - BUG/MEDIUM: flt-decomp: don't forward trailers before pending data
    - BUG/MEDIUM: flt-decomp: report an error on a truncated payload
    - BUG/MEDIUM: flt-decomp: allocate the buffer to emit pending data
    - BUG/MEDIUM: flt-decomp: skip responses without a transfer length
    - BUG/MEDIUM: flt-decomp: accept an empty payload
    - BUG/MINOR: flt-decomp: don't lose emitted data on a truncated payload
    - BUG/MEDIUM: mux-h2: send END_STREAM when the trailers are dropped
    - BUG/MINOR: mux-fcgi: don't send the empty STDIN record twice
    - BUG/MEDIUM: mux-fcgi: send the empty STDIN record after a chunked request
    - DEV: patchbot: prepare for new version 3.6-dev
    - MINOR: version: mention that 3.5 is stable now

2 days agoMINOR: version: mention that 3.5 is stable now
Willy Tarreau [Wed, 2 Dec 2026 15:17:39 +0000 (16:17 +0100)]
MINOR: version: mention that 3.5 is stable now

This version will be maintained up to around Q1 2028. The INSTALL file
also mentions it.

2 days agoDEV: patchbot: prepare for new version 3.6-dev
Willy Tarreau [Wed, 2 Dec 2026 15:11:39 +0000 (16:11 +0100)]
DEV: patchbot: prepare for new version 3.6-dev

The bot will now load the prompt for the upcoming 3.6 version so we have
to rename the files and update their contents to match the current version.

2 days agoBUG/MEDIUM: mux-fcgi: send the empty STDIN record after a chunked request
Christopher Faulet [Wed, 2 Dec 2026 14:26:27 +0000 (15:26 +0100)]
BUG/MEDIUM: mux-fcgi: send the empty STDIN record after a chunked request

When a chunked request was sent to a FastCGI application, the empty
STDIN record marking the end of the request was not sent when the
request body and the EOT block were processed at once by
fcgi_strm_send_stdin(). In this function, all blocks but the DATA ones
were removed without checking the EOM flag. Only the EOM flag on a DATA
block was considered, which is only the case for content-length
requests. So for chunked requests, with or without trailers, an
application reading its input to the end waited forever. The request
ended on a 504 after the server timeout, holding a server slot
meanwhile.

Before the commit 9b1a3215f ("MINOR: mux-fcgi: Use flags of HTX blocks to
detect end of message during sending"), it was handled at the end of the
function by testing the HTX_FL_EOM flag on the emptied HTX message.

Now, fcgi_strm_send_stdin() stops on a block carrying the EOM flag and
lets fcgi_snd_buf() handle it, to send the empty STDIN record.

No backport needed.

2 days agoBUG/MINOR: mux-fcgi: don't send the empty STDIN record twice
Christopher Faulet [Wed, 2 Dec 2026 14:26:27 +0000 (15:26 +0100)]
BUG/MINOR: mux-fcgi: don't send the empty STDIN record twice

In fcgi_snd_buf(), when an EOT block carrying the EOM flag was found, an
empty STDIN record was sent to signal the end of the request. Then, the
NOOP case was also executed because of a fallthrough. The EOM flag was
tested again and a second empty STDIN record was sent. It happened when
the EOT block was processed separately from the request body. The
FastCGI application could then handle the second record as a protocol
error.

Now, EOT and NOOP blocks are handled the same way, and only one empty
STDIN record is sent.

No backport needed.

2 days agoBUG/MEDIUM: mux-h2: send END_STREAM when the trailers are dropped
Christopher Faulet [Wed, 2 Dec 2026 14:26:27 +0000 (15:26 +0100)]
BUG/MEDIUM: mux-h2: send END_STREAM when the trailers are dropped

When "option http-drop-response-trailers" or "option
http-drop-request-trailers" was set, the trailers loop in
h2s_make_trailers() was skipped. But since the commit 221c40bbf ("MINOR:
htx: Add a noop block to carry the EOM flag on an empty message"), this
loop is also responsible for retrieving the EOM flag on the EOT block.
So, when the trailers were dropped, the end of the message was never
detected and nothing was emitted to close the stream. The H2 clients
received a RST_STREAM(CANCEL) on complete responses and, on the server
side, a 504 was returned after the server timeout. Because a chunked H1
message always ends with an EOT block, every chunked H1 message was
affected, with or without trailers.

Now, the loop is always performed to find the EOT block, but the
trailers are skipped when they must be dropped. In that case, an empty
DATA frame with the ES flag is emitted.

No backport needed.

2 days agoBUG/MINOR: flt-decomp: don't lose emitted data on a truncated payload
Olivier Houchard [Wed, 2 Dec 2026 14:30:38 +0000 (15:30 +0100)]
BUG/MINOR: flt-decomp: don't lose emitted data on a truncated payload

When a truncated payload was detected, the error was reported
immediately, and the decompressed data emitted during the same call were
lost with it: for a 30kB response missing the end of its gzip stream,
only 15.8kB were delivered before the abort.

Now the error is only reported when nothing was emitted during the call
and the channel has no more outgoing data. Until then, the filter waits
to be called again once the output is drained. The filter was introduced
in 3.5-dev6, so no backport is needed.

2 days agoBUG/MEDIUM: flt-decomp: accept an empty payload
Olivier Houchard [Wed, 2 Dec 2026 14:30:37 +0000 (15:30 +0100)]
BUG/MEDIUM: flt-decomp: accept an empty payload

Some servers announce a content-encoding on a message with an empty
payload, e.g. a chunked response with only the last chunk. No data are
passed to the decoder in this case, so it never reports the end of the
compressed stream: the end of the message was held forever, and since
truncated payloads are detected, it was reported as an error.

Now the filter remembers when payload data were received. When the end
of the payload is reached without any, there is nothing to decompress
and the decompression is considered as finished, so the empty message is
forwarded. The filter was introduced in 3.5-dev6, so no backport is
needed.

2 days agoBUG/MEDIUM: flt-decomp: skip responses without a transfer length
Olivier Houchard [Wed, 2 Dec 2026 14:28:49 +0000 (15:28 +0100)]
BUG/MEDIUM: flt-decomp: skip responses without a transfer length

When a compressed response has neither a content-length nor a chunked
encoding, its end is only known when the server closes. In this case,
http_response_forward_body() ends the message as soon as the close is
reported and the filter is not called anymore, so the decompressed data
it could not emit yet were lost. The response was silently truncated,
e.g. 998006 bytes delivered out of 1MB, with nothing reported to the
client nor in the logs.

Let's not decompress such messages, like the compression filter already
does. They are forwarded untouched, with their content-encoding header,
including in "always" mode. The filter was introduced in 3.5-dev6, so no
backport is needed.

2 days agoBUG/MEDIUM: flt-decomp: allocate the buffer to emit pending data
Olivier Houchard [Wed, 2 Dec 2026 14:11:12 +0000 (15:11 +0100)]
BUG/MEDIUM: flt-decomp: allocate the buffer to emit pending data

When the decompressed data do not fit in the buffer, the remaining ones
are emitted on a next call. But once the first part was sent, the
channel buffer may have been released, and in this case nothing could be
emitted and the message was stuck. This happens with requests whose EOM
is carried by the last DATA block (content-length in H1, or H2) when
this block is decompressed into more than a buffer, e.g. 30kB of text:
the client gets a 504.

Now the buffer is allocated when the filter still has something to emit.
Since the HTX message seen by the caller changes in this case, it is now
retrieved again after the call to the filters, in both
http_request_forward_body() and http_response_forward_body(). The filter
was introduced in 3.5-dev6, so no backport is needed.

2 days agoBUG/MEDIUM: flt-decomp: report an error on a truncated payload
Olivier Houchard [Wed, 2 Dec 2026 14:11:12 +0000 (15:11 +0100)]
BUG/MEDIUM: flt-decomp: report an error on a truncated payload

When the compressed payload is truncated while the HTTP message itself
is complete, the decoder never reports the end of the stream and no
error was raised. The end of the message was held forever: no timeout
applied, the stream was only released when the client left, and
depending on the payload size a thread could spin meanwhile.

Now, once the whole message was received and all the input was consumed,
if flushing the decompression state produces nothing while the
decompression is still not finished, an error is returned, as for a
corrupted payload. The filter was introduced in 3.5-dev6, so no backport
is needed.

2 days agoBUG/MEDIUM: flt-decomp: don't forward trailers before pending data
Olivier Houchard [Wed, 2 Dec 2026 14:11:12 +0000 (15:11 +0100)]
BUG/MEDIUM: flt-decomp: don't forward trailers before pending data

In decomp_stream_blk(), only the EOT block was held while decompressed
data were still pending. TLR blocks, and the NOOP block carrying the EOM
since commit 221c40bbf ("MINOR: htx: Add a noop block to carry the EOM
flag on an empty message"), were forwarded immediately. When the
decompressed data did not all fit in the buffer, the trailers and the
end of the message were thus sent before the remaining data: a chunked
gzip response of 30kB with a trailer was delivered as a complete message
of 15.8kB. In the request direction, it led to a 500 with "IH--".

Now these blocks are handled like the EOT block. In addition, when the
decompression state is flushed on such a block and the decompression is
finished with nothing left to emit, the block is now counted as
forwarded, otherwise the following ones would be counted while this one
is not. The filter was introduced in 3.5-dev6 by commit f0710d808
("MEDIUM: flt-decomp: implement decomp-req and decomp-res filters"), so
no backport is needed.

2 days agoBUG/MEDIUM: compression: finish the stream on a NOOP block with EOM
Olivier Houchard [Wed, 2 Dec 2026 13:47:18 +0000 (14:47 +0100)]
BUG/MEDIUM: compression: finish the stream on a NOOP block with EOM

Since commit 221c40bbf ("MINOR: htx: Add a noop block to carry the EOM
flag on an empty message"), the end of a message may come alone on a
NOOP block when it is received after the last data. comp_http_payload()
only finished the compression on a DATA block carrying the EOM or on a
TLR or EOT block, so in this case the compressed stream was never
finished while the response was sent as complete. This happens with an
H2 server sending END_STREAM in a separate empty DATA frame, or with a
FastCGI application ending its response after its last output. Some
clients accept such a stream, others report an unexpected end of file.

Let's handle a NOOP block carrying the EOM like the TLR and EOT blocks.
This was brought in 3.5-dev14, so no backport is needed.

2 days agoBUG/MEDIUM: mux-h1: accept a late EOM on content-length messages
Olivier Houchard [Wed, 2 Dec 2026 13:47:18 +0000 (14:47 +0100)]
BUG/MEDIUM: mux-h1: accept a late EOM on content-length messages

When the last bytes of a message with a content-length are sent by the
zero-copy path of h1_make_data() or by h1_done_ff() before the EOM is
known, the message is switched to H1_MSG_TRAILERS. If the EOM then comes
alone on a NOOP block, h1_make_trailers() reports a processing error.
This happens when an H2 peer sends END_STREAM in a separate empty DATA
frame after the payload was already forwarded, e.g. a node client piping
a stream into a request with a content-length: the client gets a 500
with "IH--" although the server received the whole request. With an H2
server doing the same, the response is logged with "ID--" and the client
connection is not kept alive.

Let's end the message when a NOOP block carrying the EOM is found in
h1_make_trailers() and the message is not chunked. It remains an error
for chunked messages, for which the EOM is expected on the EOT block.
This was brought in 3.5-dev14 by commit e99253b70 ("BUG/MINOR: mux-h1:
properly handle NOOP blocks and track EOM emission"), so no backport is
needed.

2 days agoCLEANUP: mux-quic: adjust includes statements
Amaury Denoyelle [Wed, 2 Dec 2026 09:02:09 +0000 (10:02 +0100)]
CLEANUP: mux-quic: adjust includes statements

Add missing include statements in the MUX QUIC module and remove the
unneeded ones. Also convert some of them to forward declarations in a
header file to reduce the dependency chain.

3 days agoBUG/MEDIUM: ssl: do not resume sessions whose client cert failed the verification
William Lallemand [Tue, 1 Dec 2026 16:59:57 +0000 (16:59 +0000)]
BUG/MEDIUM: ssl: do not resume sessions whose client cert failed the verification

The ssl_c_err, ssl_c_ca_err and ssl_c_ca_err_depth sample fetches read
the verify errors that ssl_sock_bind_verifycbk() stores in the
connection's xprt_st. This callback is only called during a full
handshake: on a resumed session (TLS ticket, session ID or TLS 1.3 PSK),
xprt_st is reset and the callback does not run, so the three fetches
return 0 (X509_V_OK) even when the session was established with a client
certificate whose verification failed, whether the error was ignored by
"ca-ignore-err" or "crt-ignore-err" or not. ssl_c_verify is not affected
because it reads the verify result stored in the session.

A user may mistakenly rely on these fetches for access control on resumed
sessions, for example after ignoring verification errors with
"ca-ignore-err" or "crt-ignore-err". Such a configuration can reject an
expired, revoked or self-signed client certificate on the first
connection, then accept the same client when it resumes the session.

Fix this by clearing the session id context when the verification fails,
whether the error is ignored or not, so that a session established with
a failed verification cannot be resumed: the next connection performs a
full handshake and the verify callback fills xprt_st again.

Sessions whose verification succeeded keep resuming as before.

This should be backported to all stable branches after an observation period.

Reported-by: Justin Sun <justin@capy.ai>
3 days agoDOC: config: ssl_c_err, ssl_c_ca_err and ssl_c_ca_err_depth on resumed sessions
William Lallemand [Tue, 1 Dec 2026 16:59:52 +0000 (16:59 +0000)]
DOC: config: ssl_c_err, ssl_c_ca_err and ssl_c_ca_err_depth on resumed sessions

The ssl_c_err, ssl_c_ca_err and ssl_c_ca_err_depth fetches are only filled
by ssl_sock_bind_verifycbk(), which only runs during a full handshake: on
a resumed session they read 0 (X509_V_OK), even when the session was
established with a client certificate whose verification reported an
error, ignored or not. ssl_c_verify reads the verify result stored in the
session and is not affected.

Document this limitation for each of the three fetches, and mention that
access decisions should rather be taken on ssl_c_verify, which stays
correct on resumed sessions.

This must be backported to all stable branches.

3 days agoMINOR: ssl: unset SSLKEYLOGFILE unless explicitly allowed
William Lallemand [Tue, 1 Dec 2026 12:56:42 +0000 (12:56 +0000)]
MINOR: ssl: unset SSLKEYLOGFILE unless explicitly allowed

OpenSSL 3.5 builds configured with enable-sslkeylog honor SSLKEYLOGFILE
and write TLS connection secrets directly to a file. This bypasses HAProxy
logging, adds filesystem access during handshakes, degrades performance
and leaks file descriptors across master-worker reloads. HAProxy already
provides tune.ssl.keylog and sample fetches for logging these secrets
through its normal logging facilities.

Replace the startup warnings with a conditional unsetenv() before full
configuration parsing can load certificates and create SSL contexts.
Add the experimental ssl-workaround-bogus-keylogfile { on | off } global
option, defaulting to off. Setting it to on leaves the variable untouched;
setting it to off keeps the default behavior of removing the variable.

Discover this option and expose-experimental-directives during the initial
configuration pass so the decision is known before certificate loading.
Repeat the conditional unsetenv() after a worker restores its initial
environment. Keep the original environment backup unchanged so reloads
can reevaluate the option, without copying or restoring the variable.

Document the OpenSSL version and build option requirements, discourage
native key logging due to its filesystem access and reload issues, and
recommend tune.ssl.keylog instead.

3 days agoBUG/MINOR: server: reject from/name in peers section
Amaury Denoyelle [Tue, 1 Dec 2026 12:58:55 +0000 (13:58 +0100)]
BUG/MINOR: server: reject from/name in peers section

The new positional keywords 'from' and 'name' were introduced to extend
server inheritance. However, nothing was implemented to ensure they were
rejected in a peers section.

Thus, it would be possible for a peer server to inherit from a
default-server in a standard backend. This could cause unexpected
behavior as a peer server does not support the full keyword range of the
instances declared in standard proxies.

Clarify this situation by rejecting usage of these keywords in a peers
section. A fatal error is reported if this is encountered.

Note that _srv_parse_from() is still called for peers server and
default-server, as it is necessary to preserve the original unnamed
default-server overloading mechanism. The new error is only reported if
'from' is found.

This is not a breaking change since 'from' and 'name' were implemented
in the current dev branch.

No need to backport.

3 days agoBUG/MEDIUM: peers: don't push updates before a reloaded process resyncs
Frederic Lecaille [Tue, 1 Dec 2026 14:16:33 +0000 (15:16 +0100)]
BUG/MEDIUM: peers: don't push updates before a reloaded process resyncs

On a soft reload, the new process starts with empty stick-tables and
serves immediately. As soon as its sessions to the remote peers are up,
peer_send_msgs() pushes its own values to them: it only checks the learn
state of the destination peer, never the resync state of the process
itself. The remote peers overwrite their entries with those values, then
count them and push them back, possibly after the old process's lesson
has arrived. Since updates carry absolute values and no ordering, the key
then continues from the value counted from scratch on every peer, and its
whole history is lost.

The same race is visible before the local lesson is even assigned: the
first push to a remote peer happens as soon as that session is up, which
is what makes the reset possible when both nodes write the same key.

Fix this by not pushing anything while the process has not finished its
resync (PEERS_RESYNC_FINISHED). Updates made meanwhile are not lost:
they are sent with their current value once the resync is over, which is
correct since a message carries a value and not an increment.

This is restricted to a process started from older ones, which is what
nb_oldpids accounts for: it is non-zero only when -sf or -st was used and
the signal could be delivered to the old processes. An instance started
on its own has no older process to learn from, and holding its pushes
back delays the replication of its entries by up to PEER_RESYNC_TIMEOUT
(5s): with no ancestor and two peers starting empty, neither can teach
the other, so the remote resync state is only left on timeout. This is
not theoretical: with the condition applied unconditionally, both
reg-tests/stickiness/{srvkey-addr,lb-services}.vtc fail. They start two
instances without ancestors, one side reports used:0, and the requests
routed there get a 504 or time out. Both pass with the nb_oldpids
restriction, which only affects processes that really are reloaded.

The condition was introduced with the peers code itself, so it should be
backported to all stable versions.

This fixes GitHub issue #3613. Thank you to @swenske for the detailed
report, the traces and the analysis of the race.

3 days agoMEDIUM: ssl: never return 0 from the BIO read callback
Olivier Houchard [Tue, 1 Dec 2026 14:35:29 +0000 (15:35 +0100)]
MEDIUM: ssl: never return 0 from the BIO read callback

Commit "BUG/MEDIUM: ssl: ignore unexpected EOFs reported by the SSL
library" sets SSL_OP_IGNORE_UNEXPECTED_EOF so that a close without a
close_notify is no longer turned into an error by OpenSSL 4.0 and AWS-LC
5.9. But with this option, the library reports such a close exactly as
if a close_notify had been received, so there is no way to tell them
apart anymore. We don't use that information for now, but we may want
to in the future.

Let's remove the option, and make ha_ssl_read() return -1 with no retry
flag instead of 0 when the connection is shut or in error, as is already
done for a shutdown during a frontend handshake. The library then
reports a syscall failure, as older versions did, which
ssl_sock_to_buf() handles as a regular shutdown.

This should not be backported, the commit above is enough for the
stable versions.

3 days agoBUG/MEDIUM: ssl: ignore unexpected EOFs reported by the SSL library
Olivier Houchard [Tue, 1 Dec 2026 14:35:29 +0000 (15:35 +0100)]
BUG/MEDIUM: ssl: ignore unexpected EOFs reported by the SSL library

When the peer closes the connection without sending a close_notify,
ha_ssl_read() returns 0. OpenSSL 4.0 and AWS-LC 5.9 now take this for an
unexpected EOF and fail the connection, where older versions reported a
syscall failure that ssl_sock_to_buf() handles as a regular shutdown.
Such closes are then logged as errors ("CD" or "SD") and the other side
gets a reset. With OpenSSL 4.0 a fatal alert is also emitted on the
closed connection, which prevents TLSv1.2 sessions from being resumed
and makes tcp-check-ssl.vtc fail.

Let's set SSL_OP_IGNORE_UNEXPECTED_EOF on the bind and server contexts
when the library provides it, so that such a close is reported as a
clean shutdown again.

This must be backported to all supported versions. This was reported in
GitHub issue #3605 by Yeonggi Kim, who also suggested this fix.

3 days agoDOC: vars: Add missing http/tcp-check part of the set-vars-from-map action
Remi Tricot-Le Breton [Tue, 1 Dec 2026 14:30:47 +0000 (15:30 +0100)]
DOC: vars: Add missing http/tcp-check part of the set-vars-from-map action

This action can be used in both tcp-check and http-check rules but it
was never mentioned in the doc.

3 days agoBUG/MINOR: ocsp: Fix too strict parser of 'do-ocsp-request' action
Remi Tricot-Le Breton [Tue, 1 Dec 2026 13:33:37 +0000 (14:33 +0100)]
BUG/MINOR: ocsp: Fix too strict parser of 'do-ocsp-request' action

The parsing function of the 'do-ocsp-request' action raised an error on
any argument different than the expected 'reason-var' and 'status-var'
ones, but it prevented any 'if' condition from being added at the end.

This patch does not need to be backported.

3 days agoBUG/MINOR: pattern: do not index too large prefixes using the tree
Willy Tarreau [Tue, 1 Dec 2026 13:25:01 +0000 (14:25 +0100)]
BUG/MINOR: pattern: do not index too large prefixes using the tree

This is exactly the same as commit 60904f86 ("BUG/MINOR: pattern: do
not index too large strings using the tree") but for pat_idx_tree_pfx()
this time: we need to limit the length of indexed prefixes with trees
to 4095 bytes, the other ones need to use the list.

This needs to be backported to all versions.

3 days agoIMPORT: uslz: fix a build warning with gcc -O1
Willy Tarreau [Tue, 1 Dec 2026 10:56:22 +0000 (11:56 +0100)]
IMPORT: uslz: fix a build warning with gcc -O1

At -O1, gcc emits this warning because it doesn't clearly see that all
paths reach this place with sym properly initialized:

  src/uslz.c: In function 'uslz_eob_follows':
  src/uslz.c:745:18: warning: 'sym' may be used uninitialized in this function [-Wmaybe-uninitialized]
    745 |         if (!ret || sym != 256)
        |             ~~~~~^~~~~~~~~~~~~

Let's just preset it to zero. Unfortunately it slightly inflates the code
with more instructions and stack usage because the compiler does not see
that the called functions don't use it, but it has almost no impact on
measured performance. Another approach consists in passing the pointer to
state->symbol, but even if it reduces the code, it suffers a bigger slowdown
likely due to having to access the member that's a bit colder in the cache.

This is slz commit 544c4d5cca. No backport to haproxy stable versions is
needed.

3 days agoBUILD: mux-quic: silence an invalid null-deref warning at -O1
Willy Tarreau [Tue, 1 Dec 2026 10:52:40 +0000 (11:52 +0100)]
BUILD: mux-quic: silence an invalid null-deref warning at -O1

It's just because it sees that qcs_sc(qcs) can return a NULL, but on
the second call it forgets it just tested it, as usual. Let's pass it
via a local variable.

3 days agoBUG/MEDIUM: peers: do not clear the alive flag of a replacement session
Hyeonggeun Oh [Mon, 30 Nov 2026 16:31:20 +0000 (16:31 +0000)]
BUG/MEDIUM: peers: do not clear the alive flag of a replacement session

When an incoming connection supersedes an established session with the
same peer, the old applet is shut down with peer_session_forceshutdown(),
then the new one is installed and the peer is flagged PEER_F_ALIVE. But
when the old applet is released later, peer_session_release() clears
PEER_F_ALIVE unconditionally, even though the applet does not own the
peer anymore. The collision delay before the next liveness check is 50 to
2049ms while the first heartbeat is due after 3s, so the sync task finds
the replacement not alive and kills it.

The liveness is tracked per session, so clear the flag in
__peer_session_deinit(), which is only called for the applet owning the
peer, instead of on every applet release. In the collision path, the
deinit happens before the new session is flagged, so the order is
preserved.

This should fix GH issue #3519. It must be backported to all stable
versions.

Signed-off-by: Hyeonggeun Oh <hyeonggeun.oh@plaintexting.com>
3 days agoRevert "BUG/MINOR: http-ana: Increment scf bytes_out value if an haproxy error is...
Christopher Faulet [Tue, 1 Dec 2026 08:12:29 +0000 (09:12 +0100)]
Revert "BUG/MINOR: http-ana: Increment scf bytes_out value if an haproxy error is sent"

This reverts commit 306931dfb1d3b40cf0e2364be0fe719389905feb. The internal
responses are already accounted when data are forwarded to the mux on front
side, in sc_conn_send().

This patch should fix the issue #3614. It must be backported as far as 3.3.

3 days agoRevert "OPTIM: acl: only reset ctx and flags, not the whole sample"
Willy Tarreau [Tue, 1 Dec 2026 10:40:50 +0000 (11:40 +0100)]
Revert "OPTIM: acl: only reset ctx and flags, not the whole sample"

This reverts commit 903405ce3c3c09352503423cb67117a7e95a518d.

According to Claude (?) this is the one that breaks the CI because some
bogus sample fetches rely on pre-existing data before the call. This
possibly indicates a new class of bugs to take care of, so that's not
in scope for this version.

3 days agoBUG/MEDIUM: leastconn: don't hide an avoided server from later lookups
Olivier Houchard [Tue, 1 Dec 2026 10:15:30 +0000 (11:15 +0100)]
BUG/MEDIUM: leastconn: don't hide an avoided server from later lookups

When fwlc_get_next_server() walks past a node without picking a server
from it, it raises the smallest key recorded in lbprm.lb_seq so that the
next lookups start further. It also does so after skipping the server to
avoid on a redispatch, though this server remains usable for everybody
else. The server then stays out of the lookups until another one is
queued at a key at or below its own: it gets no traffic while being the
least loaded, and if the other servers leave, requests are queued and
end with a 503 while a server is up.

Fix it by no longer raising the smallest key once a server was avoided
in the lookup. It can be reproduced with two servers, "retry-on 503" and
"option redispatch": hold a few requests on one server and have the
other one return a 503, the next requests all go to the busy server.

This was introduced by commit 9fe72bba3 ("MAJOR: leastconn; Revamp the
way servers are ordered.") in 3.2-dev9. This must be backported as far
as 3.2.

3 days agoBUG/MEDIUM: ssl: fix verify bypass on duplicated crt-list ssl configs
William Lallemand [Tue, 1 Dec 2026 10:09:18 +0000 (10:09 +0000)]
BUG/MEDIUM: ssl: fix verify bypass on duplicated crt-list ssl configs

crtlist_dup_ssl_conf() duplicates a ssl_bind_conf for the crt-list
entries created by the multi-keytype bundle emulation (crt.pem.ecdsa +
.pem.rsa) and for each "ssl-f-use" rule, but it never copied the
verify, no_ca_names, early_data and ktls scalar fields. Because dst
is allocated with calloc(), the duplicates always carried
verify == SSL_SOCK_VERIFY_NONE, so the switch in
ssl_sock_prepare_ctx() fell back to the bind-level ssl_conf and
configured OpenSSL with SSL_VERIFY_NONE: a "verify required ca-file"
set on a crt-list line or on a ssl-f-use line was silently ignored
for every keytype of a bundle (and for the whole frontend with
ssl-f-use), letting unauthenticated clients complete the TLS
handshake and reach the backend with ssl_c_used == 0, without any
warning at startup or under "haproxy -c".

The bundle duplication exists since 2.3 and the ssl-f-use rules since
3.2. Copying the scalar fields is enough to restore the intended
behaviour: entry-level verify is now enforced on every duplicated
entry.

Note for backports: the ktls field of struct ssl_bind_conf was
introduced in 3.3 (e8674658aec "MINOR: cfgparse: Add a new ktls option
to bind and server"), so the "dst->ktls = src->ktls;" line must be
dropped when backporting to 3.2, 3.1 and 3.0. The other three fields
(verify, no_ca_names, early_data) exist in every concerned branch.

Reported-by: Dominik Maier <dmnk@google.com>
3 days agoBUG/MINOR: ssl: fix ALPN/NPN loss on duplicated crt-list ssl configs
William Lallemand [Tue, 1 Dec 2026 10:08:57 +0000 (10:08 +0000)]
BUG/MINOR: ssl: fix ALPN/NPN loss on duplicated crt-list ssl configs

The npn_str and alpn_str buffers of a ssl_bind_conf are not plain C
strings but length-prefixed wire-format buffers built by
ssl_sock_parse_alpn(), where each protocol name is preceded by its
length byte and the total length is kept in npn_len/alpn_len. The
duplicates produced by crtlist_dup_ssl_conf() for the multi-keytype
bundle emulation and for the "ssl-f-use" rules were copied with
strdup() up to the first NUL byte, so any protocol name whose wire
length byte is zero terminated the copy early, and npn_len and alpn_len
were left to their calloc() default of 0. As a result
ssl_sock_prepare_ctx() saw alpn_len == 0 and never registered the ALPN
selection callback: the "alpn" and "npn" parameters of a crt-list line
or of a ssl-f-use line were silently dropped for every duplicated
entry, and the negotiation fell back to no ALPN.

Copy the buffers with their explicit lengths and carry npn_len and
alpn_len over to the duplicate, so the callback is registered and
advertises the full protocol list.

This must be backported to 3.4, 3.3, 3.2 and 3.1.

Reported-by: Dominik Maier <dmnk@google.com>
3 days agoBUG/MINOR: ssl: free ech_filedir in ssl_sock_free_ssl_conf()
William Lallemand [Tue, 1 Dec 2026 10:08:08 +0000 (10:08 +0000)]
BUG/MINOR: ssl: free ech_filedir in ssl_sock_free_ssl_conf()

The "ech" parameter of a bind line stores the ECH keys directory in
ssl_bind_conf.ech_filedir, and the bind-level ssl_conf goes through
ssl_sock_free_ssl_conf() in ssl_sock_free_bind_conf(), but the
function never freed the field: the string was leaked at each proxy
stop and start, so on every reload of a configuration using
"bind ... ssl ech <dir>".

Free ech_filedir in ssl_sock_free_ssl_conf(), guarded by USE_ECH like
its assignment in bind_parse_ech().

This must be backported to 3.4, 3.3, 3.2 and 3.1.

Reported-by: Dominik Maier <dmnk@google.com>
3 days agoCLEANUP: quic: refactor qc_new_conn() to use an obj_type
Amaury Denoyelle [Tue, 1 Dec 2026 09:36:49 +0000 (10:36 +0100)]
CLEANUP: quic: refactor qc_new_conn() to use an obj_type

Function qc_new_conn() is used both on frontend and backend sides. First
parameter was a void pointer, either referring to a listener or a server
instance, depending on the proxy side. This was used to set either the
local listener or the local server variable, the other one remaining
NULL.

This code works as expected, but it triggers a false report from
coverity, which has no way to know that either the listener or the
server is set. Adjust the code to use an obj_type enum pointer instead
of an opaque one, plus a switch statement that makes this state
explicit.

This should fix coverity report from github issue #3247.

3 days agoOPTIM: pattern: use ebst_lookup_len() when possible
Willy Tarreau [Mon, 30 Nov 2026 19:49:54 +0000 (20:49 +0100)]
OPTIM: pattern: use ebst_lookup_len() when possible

In pat_match_str(), we're looking up strings using ebst_lookup(),
but we know the length and already have ebst_lookup_len() that is
made for this purpose, so better rely on it since it's a bit faster.
This speeds up request rate by 1% on configs with a few tens of
string lookups.

3 days agoOPTIM: acl: only reset ctx and flags, not the whole sample
Willy Tarreau [Mon, 30 Nov 2026 18:56:25 +0000 (19:56 +0100)]
OPTIM: acl: only reset ctx and flags, not the whole sample

When evaluating an ACL, each expression starts with a memset(0) on the
local sample before calling sample_process(). This is a waste, as the
comment clearly says that the goal is to reset ctx and flags (i.e. 52
bytes), not the whole 144 (no need to erase a possibly older IPv6
address). Let's just do precisely that, because tests with many ACLs
show that up to 1.5% CPU is spent there with a few tens of rules, and
this memset() alone is responsible for 12-20% of the whole function's
time for short matches.

3 days agoOPTIM: acl: always keep the local sample 64-byte aligned
Willy Tarreau [Mon, 30 Nov 2026 18:55:29 +0000 (19:55 +0100)]
OPTIM: acl: always keep the local sample 64-byte aligned

Better have this sample aligned in the stack, it's used for literally
every match and it experiences a memset(0) for each of them. Having it
aligned encourages the compiler to use SIMD instructions instead of
rep stos to clear it.

3 days agoCLEANUP: sample: reduce struct sample by filling a hole
Willy Tarreau [Mon, 30 Nov 2026 18:55:00 +0000 (19:55 +0100)]
CLEANUP: sample: reduce struct sample by filling a hole

The struct sample keeps a 32-bit hole at the beggining after the flags,
and ends up with a 32-bit member (opt) that imposes extra padding.
Let's just move opt into the hole and reduce it from 152 to 144 bytes.
That counts more than it seems because a lot of expression processing
creates copies of samples or memset() them (e.g. in every pattern match
in ACLs).

3 days agoCLEANUP: pattern: remove the unneeded strlen in pat_idx_tree_pfx()
Willy Tarreau [Mon, 30 Nov 2026 18:01:15 +0000 (19:01 +0100)]
CLEANUP: pattern: remove the unneeded strlen in pat_idx_tree_pfx()

The pattern's length is already known since it's passed with the
string, so let's use it as-is instead of calling strlen() on the
pattern to be indexed.

3 days agoMINOR: tools: add memupper() / memlower() to convert a memory block
Willy Tarreau [Tue, 1 Dec 2026 06:59:26 +0000 (07:59 +0100)]
MINOR: tools: add memupper() / memlower() to convert a memory block

These were taken from sample_conv_str2upper() andample_conv_str2lower()
respectively. They're inline and operate on an opaque memory block cast
to uchar. They're vectorizable when the compiler knows the length. The
original functions were updated to call them, the code does not change.

4 days agoBUG/MINOR: h1-htx: report the trailer parsing error position
Christopher Faulet [Mon, 30 Nov 2026 15:31:05 +0000 (16:31 +0100)]
BUG/MINOR: h1-htx: report the trailer parsing error position

Trailer parsing uses a dedicated h1m (tlr_h1m) whose err_pos is relative to
the start of the trailers in the source buffer, i.e. to the offset passed
to h1_parse_msg_tlrs(). On a parsing error the main message's err_pos was
set to h1m->next, the chunk-parsing position, so the error snapshot taken
by h1_capture_bad_message() pointed to the wrong location.

h1_parse_msg_tlrs() now seeds tlr_h1m.err_pos with -1 or -2 depending on
the caller's leniency instead of copying h1m->err_pos. This way a stale
non-negative err_pos left over from a tolerated violation in the main
message headers can no longer suppress the trailer parser's capture (all
capture branches in h1_headers_to_hdr_list() are gated on err_pos == -1),
and it cannot be leaked back into the main message either.

On error, when the trailer parser pinpointed the faulty byte, the main
message's err_pos is now set to ofs + tlr_h1m.err_pos, i.e. the position
in the source buffer. Otherwise the previous behavior (h1m->next) is kept
as the fallback. This mirrors what h1_parse_msg_hdrs() already does for
headers via h1m->next, and makes mux_h1/mux_fcgi capture the correct
position for the H1_MSG_TRAILERS state.

No backport needed, this only affects error snapshots reporting.

4 days agoDOC: config: document the FCGI path handling and its security implications
Christopher Faulet [Mon, 30 Nov 2026 14:15:15 +0000 (15:15 +0100)]
DOC: config: document the FCGI path handling and its security implications

Some users report the FCGI support as a security issue because the
request path is URL-decoded and used to build the SCRIPT_NAME,
SCRIPT_FILENAME, PATH_INFO and PATH_TRANSLATED parameters without any
check: a path with '.' or '..' segments, or an absolute path, may point
outside the document root, and if the FastCGI application executes the
corresponding script, it may serve arbitrary files.

This is intentional. HAProxy does not normalize request paths by
default and passes them as-is, because only the component that will
interpret the request reliably knows how to normalize its paths
depending on its environment. HAProxy is not aware of the file system
layout, the mount points or the symlinks on the remote host, so it
cannot safely know if a path is finally inside or outside the document
root. It is the application's responsibility to check the script it is
asked to execute, exactly like for a web server, and it may also be
handled by the administrator with http-request rules.

To prevent the same question from being raised again, this is now
clearly documented in a new section 10.4 'Path handling and security
considerations', with a pointer from the docroot directive.

No backport is needed.

4 days agoDOC: config: Fix docroot description indentation
Christopher Faulet [Mon, 30 Nov 2026 14:22:21 +0000 (15:22 +0100)]
DOC: config: Fix docroot description indentation

The description of the FCGI docroot directive was not properly
indented. Let's fix it.

4 days agoMINOR: htx: never create, leave nor accept an empty HTX block
Christopher Faulet [Mon, 30 Nov 2026 13:36:36 +0000 (14:36 +0100)]
MINOR: htx: never create, leave nor accept an empty HTX block

An HTX block of any type must never have a size of 0. A zero-sized DATA
block especially has a special meaning on the wire: for a chunked
message, mux-h1 emits a zero-sized chunk, i.e. the last-chunk,
prematurely ending the message for the peer, and any data following in
the HTX message would then be interpreted as a new message (request
smuggling towards a server, response splitting towards a client).

HTX producers are not supposed to leave empty blocks and no way was
found to make a client or server create one, but the HTX API itself
could create or leave them, and the consequence would be dramatic. So
the invariant is now enforced by the HTX API:

  * __htx_add_blk() is the single entry point for block creation, it
    now refuses to create a block of size 0. htx_add_data_atonce() and
    htx_add_last_data() thus also refuse empty data.

  * htx_replace_blk_value() refuses a replacement that would empty the
    block, returning NULL as if there was not enough space. The caller
    must then remove the block itself with htx_remove_blk().

  * htx_change_blk_value_len() and htx_set_blk_value_len() now BUG_ON
    if they would empty a block, except for a header or a trailer whose
    value may legitimately be empty because the name is never empty.

  * htx_cut_data_blk() now BUG_ONs if the cut removes the whole block.

Special blocks (EOH, EOT, NOOP) are created with a size of 1, and no
other block is ever created empty, so no legitimate caller is affected.
The two callers that could produce an empty block were fixed in the two
previous commits.

4 days agoBUG/MINOR: flt-decomp: don't leave an empty DATA block when draining
Christopher Faulet [Mon, 30 Nov 2026 13:36:33 +0000 (14:36 +0100)]
BUG/MINOR: flt-decomp: don't leave an empty DATA block when draining

When there is not enough room to drain the decompressed data,
decomp_stream_blk_drain() replaces the fully consumed part of the DATA
block with the drained data. But if nothing could be drained, i.e. the
drainable length is 0, and the block was fully consumed, the block was
left empty in the HTX message. Similarly, when the function is called
without a block, because there is no DATA block to drain into, a
zero-sized DATA block could be added if nothing was drainable.

An empty DATA block is not supposed to remain in an HTX message. For a
chunked message, mux-h1 would emit a zero-sized chunk, i.e. the
last-chunk, prematurely ending the message for the client and making
it interpret any remaining data as a new message (response splitting).

So, when the block is fully consumed and nothing can be drained in its
place, the block is now removed instead of being emptied, taking care
of the EOM flag, if the block was carrying it. And when there is no
block to drain into, nothing is added if nothing is drainable. This
latter case is handled by htx_add_last_data() which refuses empty data.

This is a latent bug, no way was found to trigger it with a
well-behaving client or server, but the HTX API is about to enforce the
no-empty-data-block invariant, so the filter must behave accordingly.

No backport needed.

4 days agoBUG/MINOR: stats: never add an empty DATA block in the HTX message
Christopher Faulet [Mon, 30 Nov 2026 13:28:10 +0000 (14:28 +0100)]
BUG/MINOR: stats: never add an empty DATA block in the HTX message

In stats_putchk(), the current chunk is added to the HTX message with
htx_add_data_atonce(), without checking the chunk is not empty. If the
chunk is empty when the function is called, a zero-sized DATA block is
added to the HTX message. For a chunked response, mux-h1 would emit a
zero-sized chunk, i.e. the last-chunk, prematurely ending the message
for the client and making it interpret any remaining data as a new
message (response splitting).

No way was found to make a stats dump produce an empty chunk, so this
is a latent bug, but the HTX API is not supposed to accept empty data
blocks and the consequence would be dramatic. So, let's simply skip the
add when the chunk is empty. It also avoids stats_putchk() to wrongly
report a full buffer once the HTX API starts to refuse empty data.

This may be backported if desired.