Olivier Houchard [Thu, 19 Nov 2026 09:53:50 +0000 (10:53 +0100)]
BUG/MEDIUM: xprt_qmux: apply the configured bidi streams limit on FE
QMux frontends always advertise 100 bidirectional streams, ignoring
"tune.quic.fe.stream.max-concurrent" and "tune.quic.fe.stream.max-total"
which QUIC applies in quic_transport_params_init(). The MUX however
relies on the client never being allowed to open more than
stream.max-total streams: with a value below 100, releasing the first
remote stream hits BUG_ON(qcc->lfctl.ms_bidi > max) in
qcc_release_remote_stream(), so the process dies on the first completed
request on a "proto qmux" frontend.
Let's compute the frontend limit as QUIC does. The h3_clr QMux reg-test
now sets stream.max-total to cover this.
This was introduced in 3.4 by commit 497cabd9e ("MEDIUM: quic: implement
fe.stream.max-total"), which did not apply to the QMux transport
parameters. It must be backported to 3.4.
Olivier Houchard [Thu, 19 Nov 2026 17:08:33 +0000 (18:08 +0100)]
BUG/MEDIUM: quic: do not spin on the accept tasklet of a blocked listener
Since commit 4377dbd75 ("BUG/MINOR: quic: Missing listener accept queue
tasklet wakeups") in 2.8-dev5, quic_accept_run() wakes itself up again as
long as connections remain in a listener's accept queue, so that those
beyond the maxaccept budget are accepted. But when the listener cannot
accept anymore, because it is full (bind maxconn) or limited (rate limit,
global maxconn), the tasklet runs in a loop and uses 100% of a thread
until the listener is resumed.
Let's only retry at once when the listener is still ready. Otherwise,
the accept tasklets of the threads with queued connections are woken up
when the listener is enabled again, and when it is unbound so that these
connections are refused.
This should be backported to all stable versions, with the previous
commit.
Olivier Houchard [Thu, 19 Nov 2026 17:00:34 +0000 (18:00 +0100)]
BUG/MEDIUM: quic: refuse handshakes completed after the listener unbind
QUIC connections are accepted once their handshake is complete. When a
soft-stop unbinds the listener in the meantime, the connection is still
queued, but listener_accept() does not call accept_conn() anymore on the
unbound receiver. The connection never gets its mux and the client waits
until its timeout, while the stopping process keeps it until its idle
timeout and quic_accept_run() wakes itself up in a loop, using 100% of a
thread.
Let's close such connections with a CONNECTION_REFUSED error instead,
when their handshake completes on an unbound listener, or when they are
still queued once it is unbound. The client gets the error right after
its handshake and the stopping process can leave.
This was introduced in 2.8 with the soft-stop support for connections
with their own socket, by commit fb375574f ("MINOR: quic: mark quic-conn
as jobs on socket allocation"). It should be backported to all stable
versions.
Olivier Houchard [Thu, 19 Nov 2026 15:45:45 +0000 (16:45 +0100)]
BUG/MINOR: h3: reject interim responses ending the stream
On the backend side, a HEADERS frame carrying a 1xx status with the FIN
bit is converted into an interim response ending the message with the
EOM flag, which the H1 and H2 muxes never do. The stream forwards it as
an interim response and the client then gets a 502 once the end of the
stream is reported, while such a response is malformed since a final
response must follow an interim one.
Let's reject it as a malformed response with H3_ERR_MESSAGE_ERROR, as
the H2 mux does with an END_STREAM flag on a 1xx response, so the client
only gets a 502.
This was introduced with the backend side support by commit f79effa30
("MINOR: h3: convert HTTP/3 response into HTX for backend side support")
in 3.3-dev2, so it must be backported to 3.3.
Olivier Houchard [Thu, 19 Nov 2026 15:44:09 +0000 (16:44 +0100)]
BUG/MINOR: hlua: reject interim responses in HTTP applets
A Lua HTTP service may set a 1xx status. But it can only send one
response, so once the service returns, the interim response is ended
with the EOM flag, which the H1 and H2 muxes never do on a 1xx. The
stream forwards it as an interim response and, the applet being done,
produces a 502 while the interim response is still in the buffer. Since
commit 5fb43f017 ("MEDIUM: htx: Harden HTX API to avoid invalid uses
when EOM was reached") in 3.5-dev8, it crashes on
BUG_ON(htx_msg_ended(dst)). Before, the client got the interim response
followed by the 502.
Let's make start_response() raise a Lua error for interim responses
other than 101, so the service fails with a 500 as for any other error.
The documentation of set_status() was updated accordingly.
Olivier Houchard [Thu, 19 Nov 2026 13:51:19 +0000 (14:51 +0100)]
BUG/MINOR: hlua: wait for the request in HTTP applets
Since the HTTP applet uses its own buffers, it only waits for the input
buffer to be allocated before parsing the request, so it may run on an
empty buffer and crash on BUG_ON() when it is woken up before the request
was transferred, e.g. when the stream yields after the applet creation.
Let's wait for some input data instead, as the other HTTP applets do.
This was introduced by commit 48df877da ("MEDIUM: hlua: Update the http
applet to use its own buffers") in 3.3-dev4, so it must be backported to
3.3.
BUG/MEDIUM: hlua: make coroutine.create() safe under haproxy (new attempt)
We got a report from Khaled Nassar that the current coroutine.create()
wrapper implementation that was introduced in 8cd620b4 ("MINOR: hlua:
safe coroutine.create()") is still not safe. Indeed, the fact that the
freshly created coroutine could outlive the ctx that created it (and is
thus bound to it) was overlooked.
This obviously causes undefined behavior ranging from UAF to potential
memory disclosures when the coroutine which outlives its parent ctx
still continues to reference the parent hlua which is destroyed.
As of today, Lua doesn't provide a way to forcefully kill a coroutine
or thread that we created. This means we don't have control over
user created coroutines which were instanciated using coroutine.create()
This is really bug-prone, so instead of allowing potentially unsafe usages
we refuse to create threads from sub contexts. This means
coroutine.create() may only be used from the main context (body / init)
where we know for sure that the context which created the thread will
outlive it.
If user is willing to do parallel work and the current coroutine.create()
is too restrictive, core.register_task() may come into play.
It may be backported to 2.8, although we may decide to change the hard
error into a warning to prevent existing scripts breakage, especially
if coroutine.create() was used wisely by ensuring the coroutine couldn't
outlive its parent context. The warning could give time to migrate to
more suitable API such as core.register_task().
Thanks to Khaled Nassar for having reported the issue.
Amaury Denoyelle [Thu, 19 Nov 2026 13:43:06 +0000 (14:43 +0100)]
MINOR: ncbuf/test: define seed for random insert test
Previously, random seed was not set so random insert test would always
use the same offsets. Change this to use the machine timestamp to
generate different runs each time.
The seed is displayed during the test. It can also be forced via command
line argument '-j' to be able to replay a specific run.
Amaury Denoyelle [Thu, 19 Nov 2026 13:41:26 +0000 (14:41 +0100)]
MINOR: ncbuf/test: define max iteration to random insert test
To ensure random insert test does not run for too long, specify a
maximum number of iteration. By default it is set to 10.000, which
is sufficient to fill a 16kB buffer. It can also be overriden on the
command-line using option '-i'.
Amaury Denoyelle [Thu, 19 Nov 2026 10:54:13 +0000 (11:54 +0100)]
MINOR: ncbuf/test: extract random insert test in a dedicated function
ncbuf modules provides a function for unit testing. One of the test is
the insertion of random offsets and then their removal. Extract this in
a dedicated test function for better readability.
Amaury Denoyelle [Thu, 19 Nov 2026 13:35:34 +0000 (14:35 +0100)]
BUG/MINOR: ncbuf/test: remove unnecessary delay in random insert
A delay is used for better readability when the buffer content is
displayed on each iteration during the random insert test.
However, this delay also applied when nothing was printed. This renders
the test artificially long. Thus, removes the delay when print is not
requested so that the test can run as fast as possible.
Amaury Denoyelle [Thu, 19 Nov 2026 10:50:50 +0000 (11:50 +0100)]
BUG/MINOR: ncbuf/test: remove list dependency for standalone tests
List dependency prevents compiling ncbuf module as a standalone unit to
execute unit tests. This was required for the random insertion test,
where each inserted offset is saved in a list.
Removes the list dependency and implements a simple single-linked list
for random offsets. This fixes compilation in standalone mode.
Amaury Denoyelle [Thu, 19 Nov 2026 09:39:47 +0000 (10:39 +0100)]
CLEANUP/MINOR: ncbmbuf: avoid noop memcpy when data ends on wrapping
This patch is similar to the previous one applied to ncbuf. It changes
the comparison operator used against wrapping address during an add
operation, so that data fitting with the buffer end are inserted with a
single memcpy invocation.
Amaury Denoyelle [Thu, 19 Nov 2026 09:49:41 +0000 (10:49 +0100)]
CLEANUP/MINOR: ncbuf: avoid noop memcpy when data ends on wrapping
The ncbuf add operation implements support for wrapping in case the
newly inserted data exceeds the buffer end.
This operation is inefficient due to an excessive comparison, in case
the data just ends at the buffer boundary. Two memcpy are used, the
second one with a 0 length argument which is a noop.
Change the comparison to greater-than to select the single memcpy path.
The main objective of this patch is to clean up wrapping comparison and
avoid future incorrect code duplication.
Amaury Denoyelle [Wed, 18 Nov 2026 15:50:24 +0000 (16:50 +0100)]
BUG/MINOR: quic: do not reject CRYPTO data exactly fitting in buffer
CRYPTO data buffering does not support wrapping of data. A BUG_ON()
ensures data never wraps during SSL read operations. This can never fire
as a similar comparison exists first in CRYPTO parsing to reject
wrapping content.
However, this code uses an incorrect greater-than-or-equal operator on
buffer wrapping. This incorrectly rejects CRYPTO content that exactly
fits in the receive buffer and closes connection. Fixes the comparison
operators so that CRYPTO data ending exactly at the buffer end can now
be normally handled.
This should be backported up to 2.6 after a period of observation.
BUG/MEDIUM: http-ana: restore the purge of backend analyzers on applets
Commit 7568a0555 ("BUG/MINOR: http-ana: fix response compression for
applets") introduced a regression. It removed the purge of the request
analyzers performed when a request was intercepted by an applet, to only set
AN_REQ_HTTP_INNER. The idea was that http_process_request() called on
AN_REQ_HTTP_INNER configures all the analyzers needed to handle keep-alive
and compression on the HTTP response.
But doing so, some analyzers that were removed before the commit above,
remain attached. One of them, AN_REQ_SWITCHING_RULES, is responsible to set
a backend and all backend analyzers with it. So an request intercepted by an
applet in the frontend is still branched to a backend with its analyzers
armed. And they are evaluated against the intercepted request, as if it was
forwarded to the backend. Thus the http-request rules of the unassigned
backend are applied to the applet request. For instance, with a
"http-request deny" rule in the backend, a request intercepted by the
frontend stats applet is denied with a 403.
So the purge of the backend analyzers is restored, to only keep the
minimally required analyzers to handle keep-alive and compression on the
HTTP response. But, unlike the antique code from 1.5-dev24, the inner
processing is preserved: AN_REQ_HTTP_INNER is not removed by the purge
because it is needed to enable compression of the applet response when the
applet is branched from a backend.
REGTESTS: protobuf: cover the gRPC message compression flag
Regression test for "BUG/MINOR: sample: do not parse compressed gRPC
messages in ungrpc".
Two bodies are added to the frontend which already walks a body of two
gRPC messages:
- "01 000000050a03616161 00 00000002 1007" flags the first message
compressed. Its payload must not be parsed, so x-g1 stays empty
instead of reading "aaa". x-g2 must still find 7 in the second
message, which checks the skip resumes on a message boundary.
- "02 00000002 1007" sets an invalid flag, so the walk must stop and
x-g2 must stay empty.
A failing expect aborts the script, so the second body is only observed
after the fix, not before it.
Martin Mirchev [Wed, 18 Nov 2026 12:39:28 +0000 (20:39 +0800)]
BUG/MINOR: sample: do not parse compressed gRPC messages in ungrpc
sample_conv_ungrpc() skips the 5-byte gRPC message header without looking
at its Compressed-Flag byte, so a message whose payload is compressed
(flag 1) is handed to the protobuf parser as if it were plain protobuf,
and so is a message with an invalid flag value. A request body
"01 00 00 00 02 08 2a" (compressed flag, 2-byte payload) returns 42 from
"req.body,ungrpc(1,uint32)", exactly as the uncompressed one does, while
the real field value would only appear after decompression.
Skip compressed messages, as their payload cannot be parsed, and stop on
a flag other than 0 or 1 since the gRPC framing is then invalid.
Dinko Korunic [Wed, 18 Nov 2026 17:05:05 +0000 (18:05 +0100)]
BUG/MINOR: payload: also encode an absolute payload_lv offset2
Since commit bf65cd4d77 ("MAJOR: arg: converts uint and sint in sint")
in 1.6-dev3, the optional offset2 of payload_lv is stored as a single
SINT whose LSB indicates a relative offset and whose 63 MSB carry the
value, and smp_fetch_payload_lv() decodes it this way. But
val_payload_lv() only encodes relative values as "(v << 1) + 1" and
leaves absolute ones untouched. An absolute offset2 is thus read as half
of its value, and an odd one is even taken as a relative offset. With a
payload starting with "01 41 42 43 44 45":
req.payload_lv(0,1,4) returns 0x42 instead of 0x44
req.payload_lv(0,1,5) behaves like (0,1,+2), returns 0x43
instead of 0x45
This only affects which bytes are extracted: the resulting offset is
still checked against the buffer by the fetch function, so there is no
memory-safety impact. Configurations using an absolute offset2 were
silently reading from the wrong place and will now read from the
documented one.
Let's always encode offset2, adding the relative flag as the LSB. Relative
and implicit offsets are not affected.
This depends on the previous commit "BUG/MEDIUM: payload: reject
out-of-range payload and payload_lv arguments" for its context, and
should be backported to all supported versions along with it.
Dinko Korunic [Wed, 18 Nov 2026 17:05:04 +0000 (18:05 +0100)]
BUG/MEDIUM: payload: reject out-of-range payload and payload_lv arguments
The offsets and lengths taken by the payload and payload_lv sample fetch
families are parsed as 64-bit ARGT_SINT, but smp_fetch_payload() and
smp_fetch_payload_lv() store them into unsigned ints and perform their
bounds checks in 32 bits:
if (buf_size > max || buf_offset + buf_size > max)
The payload, req.payload and res.payload keywords have no argument
validation at all, and val_payload_lv() only rejects a negative offset1
and a null length. A negative or oversized argument therefore becomes a
value close to 4G once truncated, the sum wraps, passes the checks, and
the fetch either returns a sample pointing about 4 GB past the buffer
(payload) or makes the length loop read past it (payload_lv, where a
negative length turns into a ~4G byte count). Each of these expressions
crashes the process the first time it is evaluated, for example from a
"tcp-request content" rule:
req.payload(-1,1)
req.payload(4294967295,1)
req.payload_lv(1,-1) (heap-buffer-overflow read)
req.payload_lv(4294967295,1)
req.payload_lv(0,1,+4294967290) (once a converter reads the sample)
Lua is affected as well (e.g. txn.f:req_payload(-1,1)), since it relies
on the same validation callbacks. HTX streams are not affected because
the fetches return early there. The tcp-check path performs the same
arithmetic on check->bi.
Such an expression has to be written in the configuration, so this is not
a vulnerability per the threat model, but nothing warns about it, and once
it is present the first connection that reaches the rule crashes the
process.
This patch adds val_payload() for the payload family, which limits both
the offset and the length to [0, INT_MAX] (a null length still means "the
rest of the buffer"). val_payload_lv() now limits offset1 to [0, INT_MAX],
the length to [1, INT_MAX], the raw offset2 to [-2*INT_MAX, INT_MAX], and
the resulting relative offset to [0, INT_MAX]. INT_MAX is far beyond any
buffer size so no working configuration is affected, and with each term
bounded this way the sums computed by the fetch functions can no longer
wrap, so these functions are left untouched. Configurations that used
out-of-range values already crashed or never matched; they now fail to
load with an explicit error instead:
invalid args in fetch method 'req.payload' : payload offset must be
between 0 and 2147483647
Lua calls now raise an error instead of crashing.
This should be backported to all supported versions.
REGTESTS: quic: undecryptable 0-RTT packets must not exhaust the Rx buffer
On a listener with "allow-0rtt", a 0-RTT packet whose header protection
cannot be removed is queued in the 0-RTT encryption level pqpkts list, with
a reference on the connection Rx buffer. That buffer is reclaimed in order
and stops at the first referenced packet, so a queued 0-RTT packet pins all
the data behind it. When no 0-RTT RX secret exists, because the early data
were rejected by the TLS stack or because the TLS library does not support
0-RTT, those packets can never be decrypted and are never released: past
about 64 kB, every packet of the connection is dropped until the idle
timeout.
The test completes a handshake, keeps the connection healthy with an HTTP/3
request, then injects 120 long header 0-RTT packets whose payload is
encrypted with keys haproxy does not know, which reproduces the state
reached when 0-RTT keys are absent. Dropped packets are counted as
dropped_pkt_bufoverrun, shown as dropbuff= by "show quic full", so the vtc
asserts through the CLI that this field does not appear: the Rx buffer was
not exhausted and the connection was not stalled.
It needs the Python client in reg-tests/quic/qclient, so it carries
'#REGTEST_EXTRA=qclient' and only runs when requested.
REGTESTS: quic: NEW_CONNECTION_ID must not reference a retired CID
A NEW_CONNECTION_ID frame stored pointers to the CID and the stateless
reset token of its quic_connection_id. RETIRE_CONNECTION_ID frees that
object at once, while a frame built for it may still be queued, in flight,
or duplicated later for a retransmission: it was then built from freed
memory.
Retiring sequence numbers 1 and 2 in the same packet is enough to reach
it: the second RETIRE frees the CID the first NEW_CONNECTION_ID frame
still points to. With the pool cache, the freed object is handed back to
the next CID of the same connection, so two frames carry the same CID,
which the client detects. Without it (ASan, DEBUG_DONT_SHARE_POOLS), freed
heap content is sent and the sanitizer reports a use-after-free.
The test drives a real handshake through the QUIC client in
reg-tests/quic/qclient, then retires both sequence numbers in one packet,
and checks two things: no duplicate CID is advertised for two different
sequence numbers, and the connection is closed with a transport error of
type PROTOCOL_VIOLATION, as RFC 9000 19.16 requires for a sequence number
that was never sent. A crash instead of the CONNECTION_CLOSE frame leaves
the test waiting, which also fails it.
It needs the Python client, so it carries '#REGTEST_EXTRA=qclient' and
only runs when requested.
REGTESTS: quic: backend must drop packets with an unsupported version
On backend connections, quic_rx_pkt_parse() accepts long header packets
carrying an unsupported version, since the version checks only apply to
listeners. Such packets keep QUIC_PACKET_TYPE_UNKNOWN, which maps to no
encryption level, and reach BUG_ON(!qel || !pktns) in qc_enc_level_alloc()
from qc_try_rm_hp().
A server which does not support the negotiated version answers with a
Version Negotiation packet (RFC 9000 6.1), so no malicious peer is needed.
The test starts a socket that replies to the Initial with a long header
packet using an unsupported version, and checks that the request fails with
a 503 instead of killing the process. It needs no helper beyond python3, so
it carries no #REGTEST_EXTRA directive.
Replaying some QUIC bugs requires a peer that completes a handshake and
then sends specific frames. Hand-crafted datagrams cannot do that.
Add a minimal QUIC v1 + TLS 1.3 + HTTP/3 client in reg-tests/quic/qclient:
- qcrypto.py: RFC 9001 packet protection (HKDF, initial keys, varints,
long and short header protection).
- qclient.py: a QClient object over a real socket, with the received
frames exposed. Hooks on the send and handshake paths let a caller
alter packets, and the helpers cover key updates, connection migration
and HTTP/3 requests, so tests can drive whatever scenario they need.
Both need the 'cryptography' package. Tests using them will carry
'#REGTEST_EXTRA=qclient' and run only when requested.
MINOR: reg-tests: add --extra to run tests needing optional tools
Some VTC files need helper programs that are not built with HAProxy, such
as the Python QUIC client in reg-tests/quic/qclient/. They cannot simply be
typed 'slow' or 'devel' instead: their type says what they check, and the CI
jobs select tests by type.
Add a new --extra option to run-regtests.sh. A VTC file declares the helper
it needs:
#REGTEST_EXTRA=qclient
and is skipped unless that name is listed in the --extra option. From the
Makefile, options are passed after '--':
$ make reg-tests -- --extra qclient
The filter only adds tests: files without the directive, and the selection
made by --type/REGTESTS_TYPES, are unchanged.
Not to be backported: this is development tooling.
Olivier Houchard [Wed, 18 Nov 2026 16:41:03 +0000 (17:41 +0100)]
BUG/MEDIUM: mux-quic: cap elastic MAX_STREAMS to stream.max-total
With "tune.streams-elasticity", qcc_release_remote_stream() grants as
MAX_STREAMS increment the difference between the elastic limit and the
streams still usable by the peer. Unlike the static path, nothing caps
the new limit to "tune.quic.fe.stream.max-total". If the window was
reduced under load and the load then drops, the increment computed close
to the end of the connection may exceed the remaining streams, and the
next released stream hits BUG_ON(qcc->lfctl.ms_bidi > max).
Let's cap the increment to the remaining streams. It is still at least 1
since ms_bidi is below max there.
This was introduced by commit e139dd90e ("MAJOR: mux_quic: support
stream elasticity during connection lifetime") in 3.4-dev13 and must be
backported to 3.4.
Olivier Houchard [Wed, 18 Nov 2026 16:52:44 +0000 (17:52 +0100)]
BUG/MEDIUM: quic: never advertise more streams than configured
With "tune.streams-elasticity", the initial max-streams-bidi transport
parameter is set to conn_calc_max_streams() of the configured limit,
i.e. the lowest of "tune.quic.fe.stream.max-concurrent" and
"tune.quic.fe.stream.max-total". But this function may return more than
the value it is passed, as it also considers the share of the extra
streams budget left for each remaining connection, which does not depend
on it: with "tune.streams-elasticity 1000", it returns 10 at low load.
When "tune.quic.fe.stream.max-total" is lower than this, releasing the
first remote stream hits BUG_ON(qcc->lfctl.ms_bidi > max) in
qcc_release_remote_stream(), so the process dies on the first completed
request.
Let's not advertise more than the configured limit. The stream_max_total
reg-test now enables stream elasticity to cover this.
This was introduced by commit d21ec4c70 ("MINOR: quic: use stream
elasticity value for initial advertisement") in 3.4-dev13 and must be
backported to 3.4.
On QMux, qcm_init() takes over the Rx buffer of the xprt layer. When it
fails later, its error path resets qcc->conn before calling
qcc_release(), which only releases the QMux connection buffers when a
connection is attached, so the Rx buffer is leaked. A client connecting
with TLS but without ALPN to a "proto qmux" listener makes
qcc_install_app_ops() fail and leaks one buffer per connection.
Let's release the QMux Rx buffer in the qcm_init() error path, where the
connection type is still known. The Tx one cannot be allocated yet.
This was introduced in 3.4 by commit 81f22cd68 ("MINOR: mux-quic: define
Rx connection buffer for QMux") and must be backported to 3.4.
Willy Tarreau [Wed, 18 Nov 2026 15:58:50 +0000 (16:58 +0100)]
[RELEASE] Released version 3.5-dev13
Released version 3.5-dev13 with the following main changes :
- BUG/MINOR: tcpcheck: fix out-of-bounds reads on short MySQL error packets
- BUG/MEDIUM: mux-h2: put BE conn back in idle list after deferred shut
- BUG/MEDIUM: mux-spop: do not enforce the timeout on connections with streams
- MINOR: mux-spop: ignore conn->owner when deciding if a connection is dead
- BUG/MEDIUM: mux-spop: refresh the connection timeout before parking it idle
- MINOR: mux-spop: don't add a closing connection to an idle list on detach
- BUG/MEDIUM: mux-fcgi: put BE conn back in idle list after deferred shut
- BUG/MAJOR: cache: do not mix variants varying on different headers
- BUG/MEDIUM: cache: fix "show cache" crash/skip with several caches
- BUG/MEDIUM: cache: do not create a second applet when two cache-use rules hit
- BUG/MEDIUM: cache: forbid cache rules in defaults sections
- BUG/MEDIUM: filters: order the implicit filters around the explicit ones
- BUG/MINOR: cache: do not refuse to store responses with "Age: 0"
- BUG/MINOR: cache: do not remove the Age header from the forwarded response
- BUG/MINOR: cache: recognize null qvalues with decimals in Accept-Encoding
- BUG/MINOR: cache: do not eat the request while waiting for a buffer
- BUG/MINOR: cache: reduce the max-age lifetime by the response's Age
- BUG/MINOR: cache: compare the Age to the heuristic lifetime when none is given
- BUG/MINOR: cache: do not ignore null lifetimes not written as "max-age=0"
- REGTESTS: cache: cover the object lifetime with a single script
- BUG/MINOR: quic: fix ACK_ECN parsing after optional ack ranges
- BUG/MINOR: qmux: remove invalid BUG_ON() on empty record
- BUG/MINOR: init: fix missing error on no listener on config check
- BUG/MEDIUM: fd: Mark a fd as dead on early close
- BUG/MEDIUM: mux-h1: Report EOS when a demux error is handled by the app layer
- BUG/MINOR: cache: skip already resolved filters when resolving caches
- BUG/MINOR: quic: remove CID on BE conn alloc failure
- BUG/MINOR: h3: prevent missing request FIN on empty trailers
- BUG/MINOR: sample: fix host_only and port_only on empty input
- BUG/MINOR: sample: reject a \0 byte in raw string fetches
- BUG/MINOR: http-ana: don't emit a network-path Location for a "/" redirect prefix
- BUG/MINOR: log: don't let an LF in a forwarded message create new events
- BUG/MEDIUM: mux_quic: fix Rx flow control increment on RESET_STREAM
- OPTIM: lb-chash: don't look for more servers when there is only one
- OPTIM: lb-chash: limit the scan to few consecutive nodes
- MEDIUM: backend: avoid picking the same server twice in random draws
- DOC: config: explain the effect of the weights on random's draws
- IMPORT: slz: update slz to 1.4-dev5-24
- MINOR: compression: pass COMP_CT_EVENT to the algorithms for server-sent events
- MINOR: compression: add tune.comp.res.ring to disable the rings of responses
- MEDIUM: compression/slz: use the event content type for server-sent events
- DEV: sse-latency: add a parameter after the content-type
- MINOR: http-ana: also match text/event-stream with trailing parameters
- BUG/MINOR: h3: skip content-length check on backend bodyless responses
- BUG/MINOR: h3: reject CANCEL_PUSH on backend side
- MINOR: h3: reject malformed push frames
- BUG/MEDIUM: sample: parse json_query integers within the token length
- BUG/MINOR: mjson: bound the exponent in mystrtod()
- BUG/MEDIUM: stick-tables: compute the shard of string keys on the stored key
- BUG/MINOR: hq-interop: skip zero-copy with large buffers
- BUG/MINOR: hq-interop: ignore uni streams in HTTP/0.9
- BUG/MINOR: hq-interop: drop data after request
- REGTESTS: http-messaging: Fix abortonclose issue with connect_tunnels
- REGTESTS: http-messaging: Properly handle WINDOW_UPDATEs with connect_tunnels
- BUG/MEDIUM: quic: do not keep 0-RTT packets which cannot be decrypted
- BUG/MEDIUM: quic-be: keep the source port range of a closing backend connection
- BUG/MINOR: quic-be: do not register the connection before the quic_conn is initialized
- BUG/MINOR: quic: initialize the members read by quic_conn_release() first
- BUG/MINOR: debug: Do not allocate context when we don't need one
- DEV: h2: add h2dec, a raw HTTP/2 frame decoder
- DEV: h2: add mkhdr.c, a C port of mkhdr.sh
- DEV: h2: mkhdr: add -n to repeat the emitted frames
- DEV: h2: mkhdr: support stream ID ranges with -i
- DEV: h2: mkhdr: support "--" as a delimiter between frame descriptions
- MINOR: ssl: add alpn_remove_token() to drop a protocol from an ALPN string
- MINOR: global: add tune.options2 to host new GTUNE2_* flags
- MINOR: global: add tune.h2.fe.enabled to disable HTTP/2 on frontends
- MINOR: sample: add h2_enabled to report whether H2 may be used on frontends
- REGTEST: ssl: test tune.h2.fe.enabled and h2_enabled on two instances
- IMPORT: slz-prv: work around lobotomized compilers' fallthrough diagnostics
- MINOR: sample: add smp_prepare_out() to prepare an output buffer
- OPTIM: sample: use smp_prepare_out() in the lower and upper converters
- MINOR: sample: add a "tr" converter
- BUG/MINOR: http/hardening: free the new profile on strdup() failure
- BUG/MEDIUM: stick-tables/cli: "set table" without key must not clear the table
- BUG/MEDIUM: peers: make the soft-stop "dont_stop" state per peers section
- BUG/MEDIUM: htx: never merge the next DATA block into the referenced one on defrag
- BUG/MEDIUM: flt-decomp: don't expose EOM before the end of decompression
- REGTESTS: decompression: test a large decompressed Content-Length response
- BUG/MEDIUM: mux-h2: don't abort a tunnel attempt on interim responses
- REGTESTS: http-messaging: check that 1xx don't abort H2 backend tunnels
- REGTESTS: decompression: don't use yes(1) in http_large_cl
- BUG/MEDIUM: dns: release the session slot of expired TCP queries
- BUG/MAJOR: buf: make the shift distance check less strict in b_move()
- BUG/MAJOR: mux-h2: fail on impossible data transfers in rcv_buf()
- BUG/MAJOR: h3: do not panic on HTX_FL_PARSING_ERROR after htx_xfer()
- BUG/MAJOR: mux-quic: fail on impossible data transfers in rcv_buf()
- Revert "BUG/MINOR: h3: fix missing EOM after trailers without FIN"
- CI: github: include WolfSSL version in job name
- CI: github: test WolfSSL with and without debugging
- Revert "MINOR: http: add <need_eot> to trailers parsing function"
- CI: github: restrict WolfSSL sanitizer flags to debug jobs
- BUG/MINOR: ssl: exclude wolfSSL from custom extension support
- BUG/MEDIUM: stream: keep channel_auto_close() on the request error path
- REGTESTS: http-messaging: send h1_big_chunk_size_line request at once
- BUG/MINOR: checks: only trigger a DNS resolution with the resolvers lock
- BUG/MINOR: dns: detect the server's shutdown on a partial TCP response
- SCRIPTS: vtest: allow overriding the Git repository URL
- BUG/MINOR: map: split "add map/acl" payload keys on line breaks
- CI: github: use haproxytech/VTest2 for regression tests
- BUG/MEDIUM: peers: bound stick-table update messages
- BUG/MEDIUM: peers: bound stick-table switch messages
- BUG/MINOR: peers: bound stick-table acknowledge messages
- CLEANUP: peers: remove the unused intencode()
- BUG/MINOR: quic/ssl: report SSL_CTX allocation failure
- MINOR: peers: move message length constants to peers-t.h
- BUG/MEDIUM: stick-table: fix the peers overhead in proto_size
- BUG/MEDIUM: peers: trim received string keys to fit in a buffer
Olivier Houchard [Wed, 18 Nov 2026 10:02:39 +0000 (11:02 +0100)]
BUG/MEDIUM: peers: trim received string keys to fit in a buffer
Commit b224f63c1 ("BUG/MEDIUM: stick-table: restrict key sizes to what
fits in a buffer") trims string keys in stksess_setkey() so that the
update message fits in a buffer, but string keys received from a peer
are copied directly and only bounded by the table's key size. A peer
with a larger bufsize, or a forged message, can thus store a key which
cannot be encoded when it is later taught to another peer. Since commit ef4405d67 ("BUG/MEDIUM: peers: bound stick-table update messages") this
does not overflow the trash buffer anymore, but the peer session is
closed and reopened in loop and the resync never completes, as reported
in GitHub issue #3576.
Let's apply the same trimming on the receive path. This must be
backported wherever b224f63c1 was.
Olivier Houchard [Wed, 18 Nov 2026 10:07:58 +0000 (11:07 +0100)]
BUG/MEDIUM: stick-table: fix the peers overhead in proto_size
proto_size accounts for 11 bytes of encapsulation, but update messages
are built in place with the header, room for the encoded length, the
update id and the expiration date, plus the string key length. String
keys trimmed to fit the estimate, such as a large header tracked on a
table whose len is close to or above bufsize, thus never fit an update
message, and neither do binary keys of a table accepted at the limit by
the config check. Since commit ef4405d67 ("BUG/MEDIUM: peers: bound
stick-table update messages") this does not overflow the trash buffer
anymore, but the peer session is closed and reopened in loop and the
resync never completes. See GitHub issue #3576.
Let's count the real overhead. This was brought by commit 858263591
("MINOR: stick-table: calculate the on-wire size of each key") and must
be backported wherever it was, along with previous commit "MINOR: peers:
move message length constants to peers-t.h".
Olivier Houchard [Wed, 18 Nov 2026 10:07:49 +0000 (11:07 +0100)]
MINOR: peers: move message length constants to peers-t.h
PEER_MSG_HEADER_LEN and PEER_MSG_ENC_LENGTH_MAXLEN are needed by the
stick-table code to estimate the size of update messages, so let's
move them out of peers.c.
This is needed by the next commit, so it must be backported along with
it.
ssl_quic_initial_ctx() stores the result of SSL_CTX_new() into
bind_conf->initial_ctx without checking it, unlike ssl_sock_initial_ctx()
which alerts and returns an error. On allocation failure the QUIC bind
therefore crashed without any diagnostic.
Report the failure the same way the TCP path does.
All peers message builders now use encode_varint(), which knows the end of
the destination buffer and can fail. intencode() has no caller left, and
its comment still advises callers to ensure the room left after the
pointer, which is exactly what the new code checks explicitly.
peer_prepare_ackmsg() was the last message builder of the peers code
still encoding without knowing the buffer end: lengths went through
intencode(), which cannot fail, and the last acknowledged update counter
was copied with a plain memcpy().
Its payload is a bounded varint plus a 32-bit counter, i.e. 9 bytes at
most, so it could not overflow. The bounds are added anyway, for
consistency with the update and switch message builders, and they make
intencode() unused: being defined without any prototype in a header, the
compiler cannot report it as unused, so it is removed here along with its
comment, otherwise it would have stayed in the binary silently.
peer_prepare_switchmsg() builds the table definition message in the
<size>-byte trash buffer but, like its update counterpart before commit 8e0f311ff, never checked that the encoded data fit. The table name was
copied with a plain memcpy() following an intencode() of its length, and
all other fields were encoded with intencode(), which cannot fail.
Unlike the update message, this one is mostly made of a variable-length
field, the table name: the peers section name, a '/', and the table name,
which gives a nid as large as the configuration line allows. The rest is
a fixed 33-byte overhead plus the data type parameters. Nothing accounts
for that name when validating the stick-table at configuration time, so
a table whose name is close to tune.bufsize is accepted and its copy runs
past the end of the trash buffer when the peer sessions start.
Let's check the room left before every copy and every varint encoding,
using the same peer_bufcpy() helper and the same single-exit error
convention as for the update message. The data type parameters are
staged in a trash chunk, not in <msg>, so their encoding is bounded by
the chunk itself through a distinct chunk_end pointer, while the varints
written to <msg>, the bitfield and the expiration are bounded by the
message end.
The payload length becomes a size_t for consistency with the update
message, though the definition message is inherently small.
Thank you to @h110hawk for having reported this issue in GH #3576.
This should be backported to all supported versions.
peer_prepare_updatemsg() builds a stick-table update in the <size>-byte
trash buffer but never checked that the encoded data actually fit, and
still carried its "TODO: check size" comment. Fixed-size fields were
copied with memcpy() and every length was encoded with intencode(),
which cannot fail and has no knowledge of the buffer end.
An entry learned from a peer may hold a string key up to key_size - 1,
which the peers protocol accepts in a full-size message. Re-encoding it
adds a 2-byte header, the update identifier and, for timed updates, an
expiration before the key, so the copy runs past the end of the trash
buffer. ASan reports a heap-buffer-overflow WRITE right after the
16384-byte trash region, and on a normal build the two overflowing bytes
land in the next chunk.
Let's check the room left before every copy and every varint encoding.
A new peer_bufcpy() helper copies at most what the buffer can take,
advances the cursor on success and leaves it untouched on failure, so
the success path is unchanged. Lengths are now encoded with
encode_varint(), whose bounds are those of the destination buffer, and
all failures return 0 through a single exit point that releases the
session lock.
The payload length becomes a size_t: as an unsigned short it silently
truncated messages larger than 65535 bytes, which tune.bufsize above 64k
makes reachable.
This should be backported to all supported versions.
CI: github: use haproxytech/VTest2 for regression tests
The official VTest2 repository frequently causes CI failures. Use the
haproxytech/VTest2 repository instead.
Point the shared VTest setup action and the FreeBSD workflow at the
haproxytech/VTest2 repository for both cache SHA lookups and builds.
Select the build source through VTEST_URL, leaving the script default
unchanged.
This could be backported together with the previous commit, 691e22fbbd ("SCRIPTS: vtest: allow overriding the Git repository URL").
Olivier Houchard [Wed, 18 Nov 2026 14:23:21 +0000 (15:23 +0100)]
BUG/MINOR: map: split "add map/acl" payload keys on line breaks
The payload of "add map" and "add acl" contains one entry per line, but
the key was only split on spaces and tabs. A map line without a value
was thus merged with the next line into a single bogus entry instead of
being reported as an error, as is done for the last line. For "add acl",
whose patterns contain no space, all the lines were merged into a single
pattern, and the parser then stepped past the end of the payload, where
it only reads the payload terminator line.
Let's also stop the key on line breaks, and consider that a line without
a space or tab after the key has no value.
This was introduced in 1.9 by commit 25650ce51 ("MINOR: map: Add payload
support to "add map"") and may be backported to all stable branches.
SCRIPTS: vtest: allow overriding the Git repository URL
Read the VTest repository URL from VTEST_URL so that builds can use
an alternate repository. Keep the current URL as the default when the
variable is unset or empty.
Olivier Houchard [Wed, 18 Nov 2026 13:53:37 +0000 (14:53 +0100)]
BUG/MINOR: dns: detect the server's shutdown on a partial TCP response
When a DNS response is only partially received over TCP, the session's
I/O handler reads the available data with applet_getblk() and waits for
more. When nothing new is available, the requested length is zero, and
applet_getblk() never reports the shutdown in this case since
applet_may_get() only checks it when more data than available is
requested. If the server closes after sending part of a response, the
session then waits for data that will never come, and queries assigned
to it are lost until it times out, about 20s later.
Let's check for the shutdown when the message is incomplete: the rest
cannot come anymore. This was brought in 3.3 by commit 217da087f
("MEDIUM: dns: Update the dns_session applet to use its own buffers").
It must be backported to 3.3.
Olivier Houchard [Wed, 18 Nov 2026 13:06:45 +0000 (14:06 +0100)]
BUG/MINOR: checks: only trigger a DNS resolution with the resolvers lock
When a health check fails to establish its L4 connection, the check code
calls resolv_trigger_resolution() on the server's requester to force a
new resolution. This function reads the resolution's status, step and
last_resolution, and writes last_resolution, while these fields are
otherwise only accessed under the resolvers' lock, possibly from another
thread processing a response. At worst a resolution is triggered again
too early, causing an extra DNS query. The resolution itself cannot be
freed in the meantime since the check holds the server's lock, which the
unlinking paths take before releasing the resolution.
The resolvers take the server's lock under their own lock, so we cannot
wait for the resolvers' lock here. The trigger being opportunistic, let's
just try to take it and skip the trigger when it is busy.
Olivier Houchard [Wed, 18 Nov 2026 12:44:29 +0000 (13:44 +0100)]
REGTESTS: http-messaging: send h1_big_chunk_size_line request at once
The test expects the headers and the chunk-size line to fill the buffer
on the first read, so that the request is rejected before being
forwarded. But they were sent as ~986 small writes, and when haproxy
received them in two parts (seen on FreeBSD CI), the first read did not
fill the buffer: the headers were forwarded and the server's 200 was
logged instead of the expected 400. Let's send the whole request in a
single write, with a chunk-size line longer than the buffer.
BUG/MEDIUM: stream: keep channel_auto_close() on the request error path
Commit 6c5df88d ("BUG/MEDIUM: stream: reset analyse_exp when analysers are
stripped on error") replaced channel_auto_close(req) with
req->analyse_exp = TICK_ETERNITY instead of adding the new statement, so
auto-close is no longer re-enabled on the client error/timeout path while
the remaining request analysers are stripped. The response path correctly
kept channel_auto_close(res) and got the analyse_exp reset in addition.
Restore channel_auto_close(req) so shutdowns are still forwarded when an
unhandled client error is caught, as fixed by b1368adc ("BUG/MEDIUM: stream:
Forward shutdowns when unhandled errors are caught"): without it the stream
may freeze when no analyser remains and no wakeup happens.
This patch must be backported with 6c5df88d to all stable versions.
BUG/MINOR: ssl: exclude wolfSSL from custom extension support
wolfSSL provides SSL_CTX_add_server_custom_ext() as a stub which always
returns zero. Do not advertise HAVE_SSL_CTX_ADD_SERVER_CUSTOM_EXT when
building with wolfSSL.
Since 8957622353 ("BUG/MEDIUM: ssl: fix an out-of-bounds read on SSL_CTX
switch with a .sctl file"), the extension is registered on every frontend
context. Calling the stub therefore makes certificate loading fail even
when no .sctl file is present.
Exclude wolfSSL from the capability guard while keeping the OpenSSL
registration unchanged.
Verified an ERR=1 build against wolfSSL 5.7.0, the verifyhost_san VTest,
and live TLS requests using all three certificates from that test.
This must be backported to all supported versions.
CI: github: restrict WolfSSL sanitizer flags to debug jobs
Only override WolfSSL CFLAGS and HAProxy ARCH_FLAGS when debug=1.
Keep WolfSSL debugging and AddressSanitizer enabled for that variant.
For debug=0, use the default WolfSSL compiler flags and HAProxy's
default ARCH_FLAGS=-g, matching the flags of the removed VTest job.
Leave the shared HAProxy debug defines unchanged.
CI: github: test WolfSSL with and without debugging
Add a debug matrix axis to run WolfSSL 5.7.0 with WOLFSSL_DEBUG=0 and
WOLFSSL_DEBUG=1 in parallel. Include the debug setting in each job name
and disable fail-fast so one variant cannot cancel the other.
Keep AddressSanitizer enabled for both variants and leave the HAProxy
build flags unchanged.
Define the WolfSSL version once in the job matrix and use it in both the
job display name and the WOLFSSL_VERSION build setting.
This makes the tested version visible in GitHub Actions without
duplicating the version string. The workflow still runs a single job
using WolfSSL 5.7.0.
This fix introduces a major regression as emitting trailers without EOT
is not supported by htx_xfer(). A BUG_ON() in this function is triggered
if rcv_buf runs between the trailers parsing and the FIN reception.
This may reveals deeper limitation which may requires a different
approach for the original issue. A revert is considered the most viable
solution for now until a decision is made the most viable as the
original issue is not a major one.
Several conflits were fixed as code changed multiple times in
H3/hq-interop due to other minor fixes introduced since the bug
introuction.
The faulty patch was not yet picked in stable releases as it was under
observation. As such, it must now be skipped and thus this revert is
only relevant for the current dev tree.
Willy Tarreau [Tue, 17 Nov 2026 16:55:22 +0000 (17:55 +0100)]
BUG/MAJOR: mux-quic: fail on impossible data transfers in rcv_buf()
When some data couldn't be transferred from the rxbuf to the channel,
leaving the channel empty (e.g. due to the reserve), we must not set
SE_FL_WANT_ROOM otherwise we cannot get out of this situation and
sc_conn_recv() detects it and panics. Let's just report a stream
error for non-fragmentable contents that exceed the maximum size
and stop here.
Willy Tarreau [Tue, 17 Nov 2026 16:41:01 +0000 (17:41 +0100)]
BUG/MAJOR: h3: do not panic on HTX_FL_PARSING_ERROR after htx_xfer()
After various tests and a long code analysis, it turns out that this
condition which was thought never to be triggerable can finally be
triggered if some data cannot be transferred to the channel due to
the reserve. The condition is rare but not impossible, so let's get
rid of it. This patch must be backported to all stable releases.
Willy Tarreau [Tue, 17 Nov 2026 17:27:58 +0000 (18:27 +0100)]
BUG/MAJOR: mux-h2: fail on impossible data transfers in rcv_buf()
When some data couldn't be transferred from the rxbuf to the channel,
leaving the channel empty (e.g. due to the reserve), we must not set
SE_FL_WANT_ROOM otherwise we cannot get out of this situation. There's
even already a BUG_ON() for this. However it turns out that in some
tricky circumstances it can be triggered. The test is thus not correct
and instead we should simply report a stream error.
This needs to be backported as far as 2.6.
Many thanks to Adam Crawford for reporting this issue along with a
repro and a candidate fix. In the end the current fix is different
as it addresses the root cause (WANT_ROOM + no-data) so it should
be more future-proof.
Willy Tarreau [Mon, 16 Nov 2026 15:21:26 +0000 (16:21 +0100)]
BUG/MAJOR: buf: make the shift distance check less strict in b_move()
Yuqi Qiu and Xiang Li from Nankai University (AOSP Lab) found during
code analysis that the check "BUG_ON(-shift > size)" in b_move() is
incorrect and can trigger too easily. The test as written like this
to only consider a one-byte minimum move, but the function could also
be called either with a larger move and a large offset, or with no data
and a larger move, typically the result of a full buffer deletion. What
matters is that the moved data plus the shift do not go larger than the
buffer.
Let's fix the test to consider both the length and the distance to save
it from triggering too easily.
The test was added in 2.6-dev3 with commit 8873b85bd9 ("DEBUG: buf: add
BUG_ON_HOT() to most buffer management functions") so this fix must be
backported to all stable versions.
Olivier Houchard [Tue, 17 Nov 2026 16:20:57 +0000 (17:20 +0100)]
BUG/MEDIUM: dns: release the session slot of expired TCP queries
A DNS-over-TCP session counts its pipelined queries in ds->nb_queries, up
to DNS_STREAM_MAX_PIPELINED_REQ (4), and only dns_recv_nameserver()
releases a slot, when a response is delivered. But when a query expires
without response, dns_process_query_exp() only decrements onfly_queries.
After 4 unanswered queries, the session is thus neither in the free nor in
the idle list anymore: it is never reused nor released and its connection
remains open forever, while new queries open new connections. With a TCP
nameserver not answering some names, one connection is leaked every 4
such queries, without limit.
Let's release the slot when a query expires, and move the session to the
free or idle list, under the stream server's lock, exactly as done when a
response is received.
This was introduced in 2.4 with commit fd647d5f5 ("MEDIUM: dns: adds code
to support pipelined DNS requests over TCP."), so this must be backported
to all stable branches.
Olivier Houchard [Tue, 17 Nov 2026 16:37:14 +0000 (17:37 +0100)]
REGTESTS: decompression: don't use yes(1) in http_large_cl
The body of http_large_cl.vtc was produced using "yes | head -c". But
vtest ignores SIGPIPE, which is inherited by the shell commands, and
BusyBox's yes never stops when its output is closed in this case. The test
then hangs until it is killed by vtest, as seen on the Alpine CI. GNU yes
is not affected because it exits on the write error.
Let's use awk instead to produce the same 24000 bytes. This test was added
by commit 68a8abcbe ("REGTESTS: decompression: test a large decompressed
Content-Length response"), no backport is needed.
Olivier Houchard [Tue, 17 Nov 2026 15:37:38 +0000 (16:37 +0100)]
REGTESTS: http-messaging: check that 1xx don't abort H2 backend tunnels
This test sends a CONNECT request, then an Extended CONNECT request (via
an H1 upgrade), through H2 backends whose servers answer with an interim
response then with a 200 response, and checks that data may then be
exchanged in the tunnel. It validates the previous fix.
Olivier Houchard [Tue, 17 Nov 2026 15:37:38 +0000 (16:37 +0100)]
BUG/MEDIUM: mux-h2: don't abort a tunnel attempt on interim responses
On the backend side, when a CONNECT or an Extended CONNECT request was
sent, h2c_dec_hdrs() aborts the tunnel attempt as soon as a response
without H2_MSGF_BODY_TUNNEL is received. But h2_make_htx_response() clears
this flag for any status other than 2xx and 101, including interim
responses (1xx) such as 100 Continue or 103 Early Hints. H2_SF_BODY_TUNNEL
is then removed and H2_SF_TUNNEL_ABRT set, so that the final 200 response
is processed as a regular response with a body. The client receives the
interim and the final responses, but the connection is closed as soon as
data are exchanged. This breaks CONNECT and WebSocket (Extended CONNECT)
through H2 servers emitting interim responses.
Let's only abort the tunnel attempt on final responses.
This has been there since 2.4 with commit d0db42326 ("MINOR: mux-h2: Add 2
flags to help to properly handle tunnel mode") and must be backported to
all stable versions.
Olivier Houchard [Tue, 17 Nov 2026 14:38:01 +0000 (15:38 +0100)]
REGTESTS: decompression: test a large decompressed Content-Length response
This test sends a small gzip-compressed body with a Content-Length header,
decompressing into more than a buffer, and checks that the whole
decompressed body is received. It is used to validate the previous fix.
Olivier Houchard [Tue, 17 Nov 2026 14:38:01 +0000 (15:38 +0100)]
BUG/MEDIUM: flt-decomp: don't expose EOM before the end of decompression
When the last DATA block carries the EOM flag, which is the case for
Content-Length messages, the decompression filter replaces its compressed
data with the decompressed ones, but the block keeps the EOM flag. If all
the input data were consumed but the decompressed output could not be fully
drained into the buffer, the message is already seen as ended. The filter
is then no longer called and the pending output is lost, silently
truncating the message. Chunked messages are not affected because the EOM
flag is carried by the EOT block, which is held while data are pending.
Let's remove the EOM flag from any DATA block processed by the filter, and
save it in the filter context, so that it is restored once the
decompression is finished, as it is already done when a block is removed.
This was introduced by commit 40e5dff61 ("MAJOR: tree-wide: No longer use
HTX_FL_HAS_EOM to detect end of message"): before it, the end of message was
hidden during the decompression, but since it is carried by the tail block,
it is only saved when the block is removed. No backport is needed.
Olivier Houchard [Tue, 17 Nov 2026 14:06:51 +0000 (15:06 +0100)]
BUG/MEDIUM: htx: never merge the next DATA block into the referenced one on defrag
When htx_defrag() is called with a referenced DATA block, this block is
copied as a new block to preserve it. But the DATA block following it, if
any, is then copied using __htx_add_data_type_atonce(), which appends it to
the tail block, i.e. to the referenced block itself. The returned block is
thus larger than requested by <blkinfo> and contains the next block's data.
The compression filter, which continues with the block following the one
it replaced with htx_replace_blk_value(), then skips these data and
forwards them uncompressed in the middle of the compressed stream.
This can be triggered with a Lua filter appending data at the end of a
response (HTTPMessage:append()) before the compression filter: the appended
data are added in a new DATA block, and when the compressed output of the
previous block is larger than the input and requires a defragmentation, the
appended data are emitted as-is and the response is corrupted.
Let's never merge a DATA block into the referenced block.
This was introduced by commit 0c6f2207f ("MEDIUM: htx: Refactor htx
defragmentation to merge data blocks"). It should be backported to 3.4.
Olivier Houchard [Tue, 17 Nov 2026 13:12:49 +0000 (14:12 +0100)]
BUG/MEDIUM: peers: make the soft-stop "dont_stop" state per peers section
Commit 608e23c49 ("MINOR: peers: Use a static variable to wait a resync on
reload") replaced the PEERS_F_DONOTSTOP flag with a static variable in
__process_stopping_peer_sync(), considering that it was only used in this
function. But this function is called by the sync task of each peers
section, so the variable is shared between all sections. With more than one
peers section, upon soft-stop, only the first section to process the signal
arms its resync timeout, requests the local reconnect and kills its
sessions; the other ones see dont_stop already set and skip this, so they
never push their tables to the new process. Then the first section which
completes (or times out) decrements jobs and resets the variable, letting
the old process leave without releasing the table refcounts of the other
sections. As a result, on each reload, the stick-tables of all sections but
one are lost.
Let's store this state in the peers section itself.
This fixes GitHub issue #3517. This must be backported to 3.0.
Olivier Houchard [Tue, 17 Nov 2026 12:48:25 +0000 (13:48 +0100)]
BUG/MEDIUM: stick-tables/cli: "set table" without key must not clear the table
cli_parse_table_req() accepts "set table <table>" without any "key" nor
"ptr" argument and returns 0, so that the table I/O handler runs with the
"set" action, which, like "clear", kills all unreferenced entries of the
table. So an operator mistyping "set table t" silently wipes the whole
table instead of getting an error (the doc's synopsis lists key/ptr as
required):
> set table t key 10.0.0.1 data.gpc0 1 (x4)
> show table t => used:4
> set table t => (no output)
> show table t => used:0
Let's return the usage message when "set" is used without key nor ptr.
This was introduced in 1.7 by commit f13ebdf28 ("REORG: cli: move table
dump/clear/set to stick_table.c") which made "set" use the table I/O
handler. Before that, it was a no-op. This should be backported to all
stable versions.
Olivier Houchard [Tue, 17 Nov 2026 10:14:57 +0000 (11:14 +0100)]
BUG/MINOR: http/hardening: free the new profile on strdup() failure
In cfg_parse_http_hardening(), when strdup() of the file name fails after
a new profile was allocated by http_hardening_new(), the profile is not
yet indexed and its only reference is lost on "goto out", leaking it and
its name. Let's release it with http_hardening_free(), which is safe for
the static profiles.
This was reported by Coverity (CID 1690184) in GitHub issue #3560, with
the analysis and fix provided by Alexandre Laroche. It was introduced by
commit fa70a47cb ("MINOR: cfgparse/http: add a simple parser for new
section "http-fingerprint"") in 3.5-dev11, so no backport is needed.
Willy Tarreau [Wed, 21 Oct 2026 20:43:44 +0000 (22:43 +0200)]
MINOR: sample: add a "tr" converter
This converter works like the unix "tr" utility: it translates or deletes
characters from the input sample. As on the command line, it takes 2 or 3
arguments:
- optional flags, which must start with '-': 'd' to delete characters
instead of translating them, 'c' to use the complement of the first
set ;
- the set of characters to match ;
- the replacement set, mandatory without 'd' and forbidden with it.
For example, tr('a-z','A-Z') upper-cases the input, and tr(-dc,'[:digit:]')
only keeps the digits. A set starting with '-' as the first argument must
be written with a backslash ('\-'), except for "-" alone, again as with the
unix utility.
Sets support ranges ("a-z"), the POSIX character classes ("[:alpha:]"
etc, ASCII only), and the usual escapes (\NNN octal, \n, \t, \\ etc).
When the replacement set is shorter than the first one, its last char is
repeated. When complemented, the chars are enumerated in ascending order.
The sets are resolved at config parsing time into a 256-byte table stored
in the second argument, and the flags are stored as an integer in the
first one, so that the runtime processing only consists in one table
lookup per byte. The deletion loop is branchless so that it remains fast
on large contents such as a request body. It relies on smp_prepare_out()
so that read-only inputs, which are the most common ones, are not
duplicated first but directly transformed into a trash chunk. The
converter works on binary contents and preserves the input sample's type.
The set parsing functions tr_set_init(), tr_read_char() and tr_set_next()
are exported, with struct tr_set_ctx in sample-t.h, so that other
converters may use the same set syntax.
Willy Tarreau [Wed, 21 Oct 2026 21:05:05 +0000 (23:05 +0200)]
OPTIM: sample: use smp_prepare_out() in the lower and upper converters
These converters used to call smp_make_rw() then convert the string in
place. Most of the time their input is read-only (e.g. a header), in
which case smp_dup() first copied it into a trash chunk before the
conversion performed a second pass over it. By relying on
smp_prepare_out() instead, the converted string is directly written into
the trash chunk while reading the input, saving one pass. Writable inputs
are still converted in place.
Willy Tarreau [Wed, 21 Oct 2026 21:01:06 +0000 (23:01 +0200)]
MINOR: sample: add smp_prepare_out() to prepare an output buffer
Converters that transform their input without making it grow (case
conversion, character deletion etc) usually call smp_make_rw() then work
in place. When the input is read-only, which is the most common case,
smp_dup() first copies the whole input into a trash chunk, and the
converter then performs a second pass over it.
smp_prepare_out() avoids this copy: for a R/W sample of type STR or BIN,
it leaves the sample as-is, otherwise it replaces the sample's buffer with
a new trash chunk at least as large as the input (with the same truncation
rules as smp_dup()) and clears the "const" flag. The caller saves the
input's area pointer before the call, then reads from it and writes into
the sample's area. Since both may alias when the sample was R/W, the
caller must never write ahead of where it reads.
Willy Tarreau [Tue, 17 Nov 2026 08:21:17 +0000 (09:21 +0100)]
IMPORT: slz-prv: work around lobotomized compilers' fallthrough diagnostics
When preprocessing and compilation run as separate phases (cpp then
cc, as often happens in distributed builds for example), comments are
stripped before compilation begins. Lobotomized compilers that decide
to emit warnings when they don't see "/* fall through */" comment
annotations that were dropped on the previous phase were just
misdesigned in a hurry and are causing harm.
We already had to do this in tables.h in the past but it's just lost at
the wrong place now. Let's just move that __fallthrough definition into
slz-prv.h where it's easier to locate, and use it in slz_rfc1951_flush()
to silence a compiler warning instead of modifying the code to work around
this absurdity.
Willy Tarreau [Mon, 12 Oct 2026 19:20:36 +0000 (19:20 +0000)]
REGTEST: ssl: test tune.h2.fe.enabled and h2_enabled on two instances
This test compares two haproxy instances, "hon" with the default setting
and "hoff" with "tune.h2.fe.enabled off", and sends them the same
requests. It verifies that on "hoff":
- "h2" is never negotiated via ALPN, whether it comes from the default
bind ALPN, an explicit "alpn" setting (even "h2" alone, which becomes
equivalent to "no-alpn") or a crt-list entry, while it is on "hon";
- an HTTP/1 frontend receiving the H2 preface responds a 405 instead of
being upgraded as it is on "hon";
- a "bind" line forcing "proto h2" closes its connections upon accept,
while it serves H2 on "hon";
- the h2_enabled sample fetch returns false, while it is true on "hon".
The upgrade is tested with haproxy itself as the H2 client because vtest
emits the preface again on the first "stream" block, and its "txpri" may
split it after the first empty line, which the H1 mux then parses as an
HTTP/1 request and rejects with a 400.
It should be backported with the "tune.h2.fe.enabled" setting and the
"h2_enabled" sample fetch.
Willy Tarreau [Mon, 12 Oct 2026 18:52:49 +0000 (18:52 +0000)]
MINOR: sample: add h2_enabled to report whether H2 may be used on frontends
With "tune.h2.fe.enabled" now able to disable HTTP/2 on frontends, users
may need to adapt some of their rules depending on whether or not HTTP/2
may be served to clients (filtering, headers, thresholds, redirects etc),
without having to keep them in sync by hand with the global setting.
This adds the "h2_enabled" sample fetch, which works like "quic_enabled":
it returns true only when HTTP/2 support was built in (USE_H2) and was not
disabled on frontends by "tune.h2.fe.enabled off".
This should be backported along with the "tune.h2.fe.enabled" setting.
Willy Tarreau [Mon, 12 Oct 2026 18:33:35 +0000 (18:33 +0000)]
MINOR: global: add tune.h2.fe.enabled to disable HTTP/2 on frontends
In case of trouble in the HTTP/2 stack, users currently have no simple way
to stop serving HTTP/2 to clients: the default ALPN of SSL "bind" lines
silently advertises "h2", explicit "alpn" settings have to be edited on
every "bind" line and crt-list entry, HTTP/1 connections starting with the
H2 preface are upgraded unless "option disable-h2-upgrade" is set
everywhere, and "proto h2" binds have to be found and changed.
This patch adds a new global setting, "tune.h2.fe.enabled", which defaults
to "on" and is stored as GTUNE2_DISABLE_H2_FE in tune.options2. When set
to "off", three layers are touched:
- h2 is prevented from being configured: "h2" is removed from explicit
alpn via alpn_remove_token() when proxies are finalized, as well as
from crt-list entries. The default ALPN (or the one derived from
"proto") is processed the same way in proxy_finalize(). If "h2" is
the only protocol, the string ends up empty, which is equivalent to
"no-alpn". Nothing changes on the data path: the SSL contexts are
created afterwards from the final strings.
- h1 is prevented from upgrading to h2 in proxy_finalize(), which sets
PR_O2_NO_H2_UPGRADE on HTTP frontends, so that the H1 mux responds
a 405 to the H2 preface as with "option disable-h2-upgrade",
indicating that method "PRI" is rejected;
- finally, h2_init() refuses frontend new connections, so anything that
cannot be fixed above (e.g. "proto h2" or NPN) is immediately closed.
The keyword is parsed in cfgparse-global.c so that it remains accepted
when building without USE_H2. Backend connections are not affected since
the main purpose it to provide an emergency switch to protect against an
exploitable flaw for example with limited impact. This may change later
with a new option if deemed useful.
One limitation is that the keyword must be seen before parsing "alpn"
keyword on "bind" lines, which is normally granted since "global" section
isn't supposed to appear after proxies. In any case, any residual case
would still be blocked by h2_init(), by closing the connection.
The goal is to offer an emergency kill-switch, so this is meant to be
backported to stable versions, along with the two preceding commits:
MINOR: ssl: add alpn_remove_token() to drop a protocol from an ALPN string
MINOR: global: add tune.options2 to host new GTUNE2_* flags
Willy Tarreau [Mon, 12 Oct 2026 18:31:38 +0000 (18:31 +0000)]
MINOR: global: add tune.options2 to host new GTUNE2_* flags
All 32 bits of global.tune.options are now in use, so new global tuning
flags cannot be added there anymore. Rather than widening this field,
which would require turning every GTUNE_* value into a 64-bit constant
(e.g. ~GTUNE_NO_TG_FD_SHARING would otherwise clear the upper bits),
let's add a second flags word, tune.options2, whose flags will be named
GTUNE2_*.
This is a preliminary step for the "tune.h2.fe.enabled" setting and may
have to be backported along with it.
Willy Tarreau [Mon, 12 Oct 2026 18:31:19 +0000 (18:31 +0000)]
MINOR: ssl: add alpn_remove_token() to drop a protocol from an ALPN string
This function removes all occurrences of a given protocol name from an
ALPN string in the binary form produced by ssl_sock_parse_alpn(), in
place, and updates its length. The string remains zero-terminated so that
the existing strstr() checks on it keep working, and it may end up empty,
which is then equivalent to "no-alpn". It returns the number of entries
removed.
It will be used by future patches to globally disable some protocols from
frontend ALPN strings at boot.
Willy Tarreau [Mon, 16 Nov 2026 14:56:55 +0000 (14:56 +0000)]
DEV: h2: mkhdr: support "--" as a delimiter between frame descriptions
Producing a sequence of different frames required one call per frame.
Now "--" may be used to delimit multiple frame descriptions on the same
command line. Each description is processed independently (options are
reset between them), and the resulting frames are emitted in the same
order. All descriptions are checked before anything is emitted, so that
an error in one of them doesn't produce a partial output. Empty
descriptions are rejected. Example:
$ dev/h2/mkhdr -t p -- -t s -- -t h -i 1-3 -f es,eh -e :method GET \
-- -t ping -R 0000000000000001 -n 2
Willy Tarreau [Mon, 16 Nov 2026 14:54:41 +0000 (14:54 +0000)]
DEV: h2: mkhdr: support stream ID ranges with -i
Opening many streams at once (e.g. to test the concurrent streams
limits) required one call per stream. Now "-i <first>-<last>" emits
the same frame(s) for each stream ID from <first> to <last> included,
in ascending order, only the stream ID differing between them. When
combined with -n, each stream's frame(s) are repeated <count> times
before switching to the next stream. All stream IDs of the range are
used, regardless of their parity.
Willy Tarreau [Mon, 16 Nov 2026 15:04:09 +0000 (15:04 +0000)]
DEV: h2: mkhdr: add -n to repeat the emitted frames
It's often needed to send the same frame many times (e.g. PING or
WINDOW_UPDATE floods, or many CONTINUATION frames), which used to
require calling the tool in a loop. The new "-n <count>" option emits
the resulting frame(s) <count> times in a row. The frame is built
only once and its output repeated. When used with -d, the whole
sequence of frames carrying the file is repeated. A count of zero
emits nothing. It's also accepted with the preface.
Willy Tarreau [Mon, 16 Nov 2026 14:53:44 +0000 (14:53 +0000)]
DEV: h2: add mkhdr.c, a C port of mkhdr.sh
mkhdr.sh forks several processes per frame, which makes it slow when
producing many frames (around 4ms per invocation here, vs 0.2ms for
the C version). This is a port of the script to C, accepting the same
options and producing byte-identical output for valid inputs, with a
few differences:
- the data file passed with -d is read in binary mode, so NUL bytes
are preserved (bash's "read" silently drops them);
- header names and values passed with -e may be longer than 127
bytes, as their lengths are now properly encoded as HPACK integers,
and backslash escapes are interpreted there as with -r, the length
being computed after unescaping;
- -r, -R and -e may be repeated and combined, their contents being
concatenated in their order of appearance to form the payload
(e.g. "-R 4 -r abcd" gives 04 61 62 63 64). An odd number of hex
digits in -R implies a leading zero;
- -e no longer forces the frame type to HEADERS, it only changes the
default type, so that -t always wins regardless of the option order
(the script would turn "-t c -e foo bar" into a HEADERS frame);
- -l always sets the frame's length field, which only defaults to the
payload's length (the script ignored -l when a payload was given).
This permits to emit a frame header alone and append its payload
separately, or to advertise a wrong length;
- options that would otherwise be silently ignored are rejected: any
option other than -e, -r or -R repeated, -t p with other options,
-d with -r/-R/-e;
- the "ACK" flag (0x01) is supported for SETTINGS and PING;
- unknown flags or invalid hex digits are reported as errors instead
of being silently ignored;
- the usage message describes each option on its own line, and is
sent to stderr on errors.
The output is emitted through a 64kB buffer so that frames are sent in
large blocks (stdio defaults to 4kB on pipes).
Willy Tarreau [Mon, 16 Nov 2026 14:53:27 +0000 (14:53 +0000)]
DEV: h2: add h2dec, a raw HTTP/2 frame decoder
mkhdr.sh produces raw HTTP/2 frames but nothing permits to decode them
back, nor to inspect a captured stream. h2dec reads a raw HTTP/2 byte
stream on stdin and prints one line per frame with the 9 header bytes
in hex followed by the decoded type, stream ID, length, flags and pad
length when present. An optional connection preface is detected.
For HEADERS, PUSH_PROMISE and CONTINUATION frames, the header block is
reassembled (padding, priority and promised stream ID are stripped),
and once END_HEADERS is seen, it is decoded with haproxy's own HPACK
decoder (as dev/hpack/decode does) and each field is printed indented
below the frame, in HTTP/1 form ("name: value"), pseudo-headers
appearing as ":name: value". Non-printable characters are escaped. A
single dynamic table is maintained for the whole input, whose size may
be changed with "-s".
Olivier Houchard [Tue, 17 Nov 2026 09:56:32 +0000 (10:56 +0100)]
BUG/MINOR: debug: Do not allocate context when we don't need one
In debug_parse_cli_sched(), when debug dev sched has been used with a
count of 0, do not bother allocating a context, as it will never be
used, and the memory will be leaked.
This is a minor problem that only affects a debug command used
incorrectly, and do not need any backport.
This was submitted by Alexandre Laroche, and should fix github issue
BUG/MINOR: quic: initialize the members read by quic_conn_release() first
qc_new_conn() allocates the CID tree before initializing ->flags, ->state
and ->prx_counters, while quic_conn_release(), called from its error path,
reads all three of them. On allocation failure, the release thus reads
uninitialized memory, and quic_conn_prx_cntrs_update() dereferences an
invalid ->prx_counters instead of returning early. This affects both
frontend and backend connections.
The backend ->prx_counters assignment has the same problem, as it is placed
after the RAND_bytes() call, which is another failure point.
This was introduced by commit b8cb8e1a6 ("BUG/MINOR: quic: fix counters
used on BE side"), which moved the assignment into the per-side branches,
after the first failure point. Move the CID tree allocation after these
initializations, and move the backend ->prx_counters assignment before
RAND_bytes().
BUG/MINOR: quic-be: do not register the connection before the quic_conn is initialized
qc_new_conn() stores the connection passed as argument in qc->conn before the
first failure points, while quic_conn_release(), called from its own error
path, BUG_ONs on a non-null ->conn. As the upper connection is still
allocated while qc_new_conn() runs, any failure after this point aborts the
whole process instead of returning an error. Only backend connections are
affected, as the frontend caller passes a NULL connection.
qc->conn cannot simply be removed from qc_new_conn(): it is dereferenced by
ssl_sock_srv_try_reuse_sess(), called from qc_alloc_ssl_sock_ctx() on the
backend side, to look up a reusable TLS session. The latter leaves
ctx->conn to NULL, unlike its non-QUIC counterpart ssl_sock_init(), which
forces ssl_sock_srv_try_reuse_sess() to fall back to qc->conn.
Pass the connection to qc_alloc_ssl_sock_ctx() so that ctx->conn is always
valid, and use it unconditionally in ssl_sock_srv_try_reuse_sess(). Then let
the caller register the connection, next to conn->handle.qc, once
qc_new_conn() has succeeded.
Commit ca5511f02 fixed this by setting ->conn only once the quic_conn was
fully initialized. Commit a83ed86b7, which reinstated the conn argument,
moved the assignment back into the initialization block and reintroduced
the bug.
BUG/MEDIUM: quic-be: keep the source port range of a closing backend connection
When a backend QUIC connection enters the closing state, qc_new_cc_conn()
moves its socket to a new quic_conn_closed instance. Since commit 02b768501
("MEDIUM: fd: Remove fdinfo"), the source port range used to bind that
socket is stored in qc->sport_range, but this member was not copied to the
closing connection, and the quic_conn_closed pool is not zeroed.
qc_release_fd() later installs qc->sport_range as the fd owner with
FD_OWNER_PR, so that fd_delete() gives the port back to its range. With an
uninitialized pointer, port_range_release_port() dereferences a wild address
and the process dies on a general protection fault; when the field happens
to be zero, the port is never released, so the range is exhausted after as
many connections and every new backend connection fails with
CO_ER_PORT_RANGE.
Copy the source port range to the closing connection, as is already done for
the other members it needs. It is always NULL on the frontend side.
This bug was introduced by commit 02b768501, so it only affects 3.5-dev4 and
later. No backport is needed.
BUG/MEDIUM: quic: do not keep 0-RTT packets which cannot be decrypted
On a listener with "allow-0rtt", a 0-RTT packet whose header protection
cannot be removed is queued in the 0-RTT encryption level pqpkts list and
its content is copied into the connection Rx buffer. That buffer is
reclaimed in order by quic_rx_pkts_del(), which stops at the first
referenced packet, so a queued 0-RTT packet pins all the data behind it.
Commit bba6baff3 ("BUG/MEDIUM: quic: prevent conn freeze on 0RTT
undeciphered content") addressed this by releasing these packets at
handshake completion, unconditionally. Commit b1af5dabf ("BUG/MEDIUM:
quic: avoid freezing 0RTT connections") then restricted that release to
the case where an address validation token was received: without a token,
the peer address is only validated by the handshake completion itself, so
the 0-RTT data are to be processed once the handshake is done.
That reasoning holds only if 0-RTT keys exist. When none were installed,
because the early data were rejected by the TLS stack or because the TLS
library does not support 0-RTT, the packets can never be decrypted, so
nothing releases them before the connection is freed. A 0-RTT packet
received after handshake completion is queued the same way, with even
less chance of ever being decrypted.
The Rx buffer then fills up and every packet of the connection is dropped
until the idle timeout, accounted as dropped_pkt_bufoverrun and shown as
dropbuff= in "show quic full". Since the buffer is reclaimed in order,
the whole connection stalls, not only the 0-RTT traffic.
Release the pending 0-RTT packets at handshake completion when there is
no 0-RTT RX secret, and drop 0-RTT packets received after handshake
completion without 0-RTT keys instead of queueing them.
This is a regression from b1af5dabf, so it must be backported to 2.9 and
above only.
REGTESTS: http-messaging: Properly handle WINDOW_UPDATEs with connect_tunnels
The last fix was incomplete. Depending on the timeout, with the third test,
two WINDOW_UPDATE frames can be receveid from the server instead of one
before receiving the response. Instead, explicitly wait for these two
WINDOW_UPDATE frames, the first one before sending tunneled data, and the
other one just after.
REGTESTS: http-messaging: Fix abortonclose issue with connect_tunnels
connect_tunnels.vtc script was fixed. The third test could be aborted before
the response was received if the connection to the server was not
synchronous. It appeared to be an issue, at least, on macOS. This happened
because C3 client was sending its tunneled data in a DATA frame carrying
END_STREAM, right after the CONNECT request. Depending on the timing, the
request could be aborted because "abortonclose" is now enabled by default.
To fix the issue, the END_STREAM flag is no longer set on the client DATA
frame. It is not mandatory for the test.
In addition, Barriers are now used instead of delay to make the frame
ordering deterministic.
Amaury Denoyelle [Mon, 16 Nov 2026 15:56:53 +0000 (16:56 +0100)]
BUG/MINOR: hq-interop: drop data after request
Strengthen hq-interop by silently draining any data following the
request. This ensures that a QCS instance won't be used to convey
multiple requests as this is undefined behavior.
This new check has been merged with the handling of a delayed standalone
FIN. This ensures that FIN is never forgotten, whether it is received
with or without extra data after the request.
This may be backported to stable releases if needed.
Amaury Denoyelle [Mon, 16 Nov 2026 14:15:29 +0000 (15:15 +0100)]
BUG/MINOR: hq-interop: skip zero-copy with large buffers
Large buffers were introduced in 3.4. They may be used in channels while
muxes continue to rely on normal-sized objects. In this case, zero-copy
must be disabled when sending data.
Most muxes were adapted but the hq-interop layer was forgotten. This
patch fixes this by adding a similar check to the one already present in
HTTP/3.
Olivier Houchard [Mon, 16 Nov 2026 16:27:00 +0000 (17:27 +0100)]
BUG/MEDIUM: stick-tables: compute the shard of string keys on the stored key
stksess_setkey_shard() hashes string keys on the raw sample length, while
the stored key is truncated to the table's "len" and stops at the first
NUL. Peers send and hash the stored key, so for longer keys the creating
node and its peers disagree on the shard, and entries are pushed to the
wrong peers.
Let's compute the shard on the stored key length. This was introduced in
2.7 by commit 36d156564 ("MINOR: peers: Support for peer shards") and
should be backported to all stable versions.
Gihyeon Ryu [Wed, 11 Nov 2026 10:00:12 +0000 (10:00 +0000)]
BUG/MINOR: mjson: bound the exponent in mystrtod()
The exponent is accumulated in an int without limit, so a long run of
exponent digits makes it wrap. Stop accumulating once it exceeds 100000:
the result is then already zero or infinite for a double.
This should be backported along with the previous patch.
Gihyeon Ryu [Wed, 11 Nov 2026 10:00:12 +0000 (10:00 +0000)]
BUG/MEDIUM: sample: parse json_query integers within the token length
For the "int" output type, sample_conv_json_query() converts the token
with strtoll(token, NULL, 0). The token points into the sample, which is
not NUL-terminated, and its length is ignored. When the input ends
inside a number (for example a truncated body '{"amount":1'), the
parsing goes on past the end of the sample, into the remaining bytes of
the buffer, which may hold digits left by a previous request, possibly
from another client. Those digits then become part of the returned
value, which may bypass a range check, or be reflected to the client.
Numbers using an exponent or a fraction are also misparsed ("1e5" gives
1).
The number is now parsed with mjson_get_number(), which stays within the
token, then range checked as a double before being converted. Truncation
of fractions is kept.
Amaury Denoyelle [Mon, 16 Nov 2026 08:52:34 +0000 (09:52 +0100)]
MINOR: h3: reject malformed push frames
MAX_PUSH_ID frames are ignored by haproxy, which does not support server
push and therefore never opens push streams. However, a legitimate
client may still emit such frames.
Implement minimal parsing via a new dedicated helper
h3_parse_push_frm(). If the frame is malformed, the connection is
immediately closed on error.
The same helper is also used for CANCEL_PUSH frames, although it is even
less useful here these frames are systematically rejected even if
well-formed because haproxy never initiates or allows push streams.
Amaury Denoyelle [Mon, 16 Nov 2026 09:23:02 +0000 (10:23 +0100)]
BUG/MINOR: h3: reject CANCEL_PUSH on backend side
CANCEL_PUSH frames are always rejected on the frontend side as haproxy
never emits PUSH_PROMISE frames.
Rejection must also be performed systematically on the backend side as
haproxy never emits MAX_PUSH_ID frames, hence any push IDs mentionned by
the server are invalid.
The outcome is the same on both sides: the connection is closed with
H3_ID_ERROR and a glitch is accounted.
Amaury Denoyelle [Mon, 16 Nov 2026 12:53:09 +0000 (13:53 +0100)]
BUG/MINOR: h3: skip content-length check on backend bodyless responses
Some specific HTTP responses are defined as having no content but with a
possible non-null content-length header value. This is the case for the
responses to HEAD requests or responses with status 204 or 304.
Prior to this patch, such responses were considered invalid due to
h3_check_body_size(), in opposition to the recommandation of RFC 9114.
This would result in a stream reset and an error reported to the client.
Fix this by detecting these bodyless responses and with the new stream
flag H3_SF_BODYLESS_RSP. This is performed during the request emission
in h3_req_headers_send() for HEAD method and during the response parsing
in h3_resp_headers_to_htx() for 204/304 status detection.
The final part of this change is to disable the check on body size in
h3_check_body_size() when the new flag is set.
Willy Tarreau [Mon, 16 Nov 2026 09:06:42 +0000 (10:06 +0100)]
MINOR: http-ana: also match text/event-stream with trailing parameters
Commit 5ff6ff1b7 ("MINOR: http-ana: automatically enable http-no-delay
for streaming events (SSE)") added detection for SSE, but as reported
in GH issue #3574, it fails when there's a parameter after the content
type because we're using an exact match. Let's instead use istmatchi()
that will check the beginning of the string (which is sufficient here).
Willy Tarreau [Mon, 16 Nov 2026 09:02:53 +0000 (10:02 +0100)]
DEV: sse-latency: add a parameter after the content-type
As reported in GH issue #3574, we're currently using an exact match for
text/event-stream, and it fails to match when a parameter is appended.
Let's add one here to trigger this problem.
Without the parameter:
=== gateway overhead (gateway minus loopback; negative = loopback noise) ===
emit->recv (1st token) mean +0.046ms p50 +0.046ms p95 +0.046ms p99 +0.046ms
emit->recv (tokens) mean +0.214ms p50 +0.234ms p95 +0.305ms p99 +0.322ms
TTFT (client) mean +0.493ms p50 +0.493ms p95 +0.493ms p99 +0.493ms
inter-token (client) mean -0.001ms p50 +0.230ms p95 +0.283ms p99 +0.299ms
With the parameter:
=== gateway overhead (gateway minus loopback; negative = loopback noise) ===
emit->recv (1st token) mean +214.379ms p50 +214.379ms p95 +214.379ms p99 +214.379ms
emit->recv (tokens) mean +303.484ms p50 +307.784ms p95 +405.797ms p99 +413.876ms
TTFT (client) mean +214.775ms p50 +214.775ms p95 +214.775ms p99 +214.775ms
inter-token (client) mean -0.026ms p50 -1.069ms p95 -1.260ms p99 -1.271ms
Let's backport this to 3.4 since sse-latency was backported there, and to
any version containing a backport of 345aa2b73 ("DEV: sse-latency: add a
latency measuring tool for SSE response streams")
Willy Tarreau [Mon, 16 Nov 2026 08:05:39 +0000 (09:05 +0100)]
MEDIUM: compression/slz: use the event content type for server-sent events
libslz's SLZ_CT_EVENT content type keeps the last 2 kB of a stream and its
reference table between calls, in a ring which the application allocates
(slz_ring_size bytes, zeroed) and sets in the stream. Server-sent events
now compress to ~4% instead of ~102% (inflating by ~2%).
A new pool "slz_ring" is created at boot with the size exported by
libslz, aligned on a cache line. The slz init functions allocate a zeroed
ring from it for COMP_CT_EVENT, unless "tune.comp.res.ring" is off, and
select SLZ_CT_EVENT, and comp_rfc195x_end() releases it. The pool is
created before the configuration is parsed, but stays empty when the
setting is off. If the pool or the ring can't be allocated, or the
compression level is 0, the default encoding is used, as the text tree
would have to send its header after each event. The support is detected
by the slz_ring_size macro, for older external versions of libslz.
Through haproxy, 942 events of a real capture from llama-server sent
10 ms apart, with gzip compression:
Content-Type output ratio
text/x-sse 265120 101.75% # previous default text compression
text/event-stream 10578 4.06%
Synthetic tests using the sse-latency tool shows this with 1000 tiny
messages:
bytes in bytes out ratio
before: 227584 199829 88%
after: 227584 20680 9%
Willy Tarreau [Sun, 15 Nov 2026 21:49:19 +0000 (22:49 +0100)]
MINOR: compression: add tune.comp.res.ring to disable the rings of responses
Some algorithms may need a ring to keep a history between flushes for
some responses, such as the upcoming support of server-sent events with
SLZ's event content type, which costs about 4 kB per stream. This new
global setting "tune.comp.res.ring" will allow to disable it ('off') to
save that memory, in which case these responses are compressed as if
their type were unknown. It is enabled by default ('on'). It's not used
yet, the next commit will make use of it.
The keyword is accepted whatever the algorithms and libraries, so that a
configuration doesn't depend on the build options.