Amaury Denoyelle [Tue, 24 Nov 2026 14:43:22 +0000 (15:43 +0100)]
BUG/MINOR: h3: extend coverage for duplicate SETTINGS ids
RFC 9114 forbids the emission of duplicate settings IDs in the same
frame. The receiver may report an error when this occurs.
Settings IDs are expressed as QUIC varint and their range is thus quite
large. As a convenience, only the smallest IDs set is checked, which
matches the most frequent usage.
A mistake in the previous code restricts unnecessarily the check to IDs
less than sizeof long, so typically only IDs from 0 to 7 are really
checked on a 64-bit platform. Fix this by multiplying sizeof() by 8,
covering all IDs up to 63 (31 on a 32-bit platform).
This should be backported up to 2.6 after a period of observation.
Amaury Denoyelle [Tue, 24 Nov 2026 15:30:55 +0000 (16:30 +0100)]
REGTESTS: tcp-check-ssl: also support errno reporting on second test
The following patch adjusts the regexp pattern tested against health
check reported info, as newer OpenSSL now also provides an additional
errno status.
This new check is fine, but the fix is not sufficient as a similar
pattern is reused later. Adjust it as well to ensure the test does not
fail anymore.
REGTESTS: tcp-check-ssl: tolerate an errno info in the SSL handshake failure
With some recent SSL libraries, the info reported by the health check on
server be3/srv may include an errno info after the "SSL handshake failure"
message (e.g. "SSL handshake failure (broken pipe)"), making the S3 syslog
expectation fail to match. The pattern now tolerates any suffix inside the
info quotes, after the two known messages.
DOC: config: Properly align table at begining of 7.5
The HTML rendering of tables does not seem to be performed if there is an
indentation. So let's remove it in the section 7.5 ("Secure filtering of
HTTP requests").
BUG/MEDIUM: mux-h1: Don't shortcut h1_process() while a stream is attached
Commit 8fc09da21 ("BUG/MEDIUM: mux-h1: don't drop pending output on a short
content-length") generalized the condition in h1_process() that releases an
H1 connection ASAP from delayed silent shutdowns to any connection in
CLOSING state with an empty output buffer. But it also caught connections
still in CLOSING with an H1 stream attached, which is exactly what
h1_close() leaves behind when the shutdown is performed while the stream is
not detached yet.
On the backend side of a tunnel after a 101 Switching Protocols, this is
fatal: when the stream forwards the client's half-close, h1_close() sets the
h1c to CLOSING but keeps the h1s attached. On the next wakeup, h1_process()
enters the release block, and, because the state is not RUNNING, it calls
h1_close() (a no-op) and jumps to the end, skipping the final
h1_wake_stream_for_recv() call. With H1C_F_WANT_FASTFWD set the mux does not
read the transport itself and never re-subscribes, so the server's data and
FIN are not seen until the shut timeout fires (timeout server). Websocket
sessions half-closed by clients then stall for timeout server and end with
SD--/sD-- instead of ending promptly with ----.
Now, the release block is only entered when no H1 stream is attached, or
when a silent shutdown was requested. This preserves the short
content-length fix (in that case h1s_destroy() has already set h1c->h1s to
NULL when h1_close() leaves the h1c in CLOSING) while restoring the
pre-8fc09da21 behavior for connections with an attached stream.
H1C_F_SILENT_SHUT must remain part of the condition because it is the only
case where an H1C in CLOSING state with an attached stream must still be
released as soon as its output buffer is drained: a silent (dirty) shutdown
means we never send a clean FIN to the peer (conn_sock_shutw() skips
shutdown(SHUT_WR)), so nothing can happen on the connection anymore and the
stream will never have data to fast-forward. It is set on aborted/torn-down
streams and on delayed dirty shutdowns, where the peer will never
acknowledge the close. Dropping it from the condition would resurrect the
bug fixed by 753083041 ("BUG/MEDIUM: mux-h1: Handle delayed silent shut in
h1_process() to release H1C", issues #1448/#1453): such connections would
linger until the client or server timeout instead of being released once the
last pending bytes are sent.
This patch should fix issues #3579 and #3601. It must be backported wherever 8fc09da21 was backported, so at least as far as 2.8.
MINOR: stream: use regular TRACE_* macros for stream traces
The stream trace messages are only emitted when HAProxy is compiled in
DEBUG mode, because they rely on the DBG_TRACE_* macros that are no-ops
unless DEBUG_DEV or DEBUG_FULL is defined.
Now the stream traces are enabled in any build with USE_TRACE, all the
DBG_TRACE_* macros in the stream trace sources were replaced by the
regular TRACE_* macros:
Willy Tarreau [Tue, 24 Nov 2026 14:22:06 +0000 (15:22 +0100)]
BUG/MINOR: startup: also disable strict limits with -d
With commit 62c0c84b81 ("MINOR: init: automatically turn
"set-dumpable" on when using "-d""), an interesting issue arrived:
if started as an unprivileged user with ulimit -c forced to zero,
then an error is reported saying it's not possible to raise the
limit, and the process fails to start. This is ridiculous but logical
and can easily be dealt with because this only happens when the
strict-limits are set. Let's have -d also turn the strict limits off.
I.e. everything looks like we'llb be able to chroot but we fail to. And
that's pretty annoying because it reports a warning after that, speaking
about starting as root while it is not the case.
A first approach would consist in relaxing the rules around "auto" but
that's not good because users writing "chroot auto" *want* a chroot to
be performed (and it's actually the safest one since it has no "." nor
"..").
This patch clarifies the situation by introducing a new "opportunistic"
mode, that noone needs to type since it's the default. In this mode, no
error is reported during the attempt to chroot. However on failure, if
the user was root, a warning is reported to indicate that it's strange,
and suggests to use chroot / instead if needed.
In this case the conditions producing the trace above will no longer
display any irritating message on a config without chroot directive,
but users of "chroot auto" will still be told what's wrong.
Willy Tarreau [Tue, 24 Nov 2026 10:12:19 +0000 (11:12 +0100)]
MINOR: http: add -dH at boot to dump HTTP specific settings
The new -dH option will dump HTTP specific settings is supported is
-dHall (alias for -dH and lists all info), -dHhelp (which lists all
available settings), and -dHharden (which dumps HTTP hardening
profiles and their default values).
The doc was clarified on where the default values come from, and how
to get such information.
This should address github issue #3606. Thanks to Nick Ramirez for
bringing this topic.
Amaury Denoyelle [Tue, 24 Nov 2026 09:29:04 +0000 (10:29 +0100)]
BUG/MINOR: h3: support unknown frames of any length
Extension frames, when unknown, must be ignored as required by RFC
9114. This is already implemented in the HTTP/3 parser.
Improve the handling of extension frames so that payloads larger than
the buffer size are allowed. This only requires relaxing the frame type
test for streaming parsing. The re-entrancy mechanism relying on the
<demux_frame_type> and <demux_frame_len> members is already implemented
for DATA handling.
Previously, such frames caused a connection closure with the error code
H3_EXCESSIVE_LOAD.
This must be backported up to 2.6 after a period of observation.
Amaury Denoyelle [Tue, 24 Nov 2026 09:56:15 +0000 (10:56 +0100)]
BUG/MINOR: h3: reject reserved HTTP/2 frame types
RFC 9114 defines HTTP/2 frame types with no correspondence in HTTP/3 as
reserved. They must not be sent. Upon receipt, the connection must be
closed with an H3_FRAME_UNEXPECTED error.
Enum h3_ft has been extended to cover these reserved values. Implement
the proper rejection of these types in h3_check_frame_valid().
Willy Tarreau [Tue, 24 Nov 2026 08:46:37 +0000 (08:46 +0000)]
OPTIM: h1: use memcpy_opt_small() to copy chunks in the contiguous parser
The contiguous chunks parser copies each chunk's payload into the HTX
block using memcpy(). With tiny chunks, the call to the libc's memcpy()
for a copy of unknown size costs much more than the copy itself, about
20% of the time spent on a stream of 1-byte chunks. Let's use the new
memcpy_opt_small() instead, which copies chunks of up to 32 bytes inline.
The transferred data rates were measured for various chunk sizes
on a Zen4 CPU core at 5 GHz (256 MB block):
Willy Tarreau [Tue, 24 Nov 2026 08:46:37 +0000 (08:46 +0000)]
MINOR: tools: add memcpy_opt_small() for ultra-small copies
Some parsers need to copy many tiny objects of variable size (e.g. HTTP/1
chunks of a few bytes), for which calling the libc's memcpy() costs much
more than the copy itself, because the compiler cannot inline a copy
whose size it does not know.
memcpy_opt_small() copies sizes from 1 to 32 inline after two to four
tests, using at most two possibly overlapping fixed-size copies that the
compiler turns into simple loads and stores: one byte then 2 bytes at the
end for 1 to 3 bytes, then 4, 8 or 16 bytes at each end for 4 to 7, 8 to
16 and 17 to 32 bytes respectively. Larger sizes fall back to memcpy(). A
size of zero is not supported since one byte is always copied.
Willy Tarreau [Mon, 23 Nov 2026 19:12:36 +0000 (19:12 +0000)]
REGTESTS: http-messaging: also test chunk extensions on chunks larger than the buffer
The contiguous chunks parser leaves a chunk larger than the room left
in the HTX to h1_parse_chunk_size(), which parses its size line on its
own. Let's replay the regular chunk cases with a 16kB chunk to cover
this path as well: valid ones must be forwarded with their data, and
invalid ones rejected on the size line without reaching the server
(a mistakenly accepted request would wait for its data and time out,
also with a 400, hence the dedicated server that must never be
reached).
Willy Tarreau [Mon, 23 Nov 2026 21:14:28 +0000 (21:14 +0000)]
MEDIUM: h1: make h1_parse_chunk_size() rely on h1_parse_chunk_ext()
h1_parse_chunk_size() is used for chunks larger than the room left in
the HTX and for lines wrapping at the buffer's end. It still had its own
lax extensions parser, which only rejected CTLs and mismatched quotes,
so that the strict syntax enforced by the contiguous parser could be
bypassed by sending a chunk larger than the buffer.
It now parses the whole line (size, extensions, CRLF) with the same
reverse index on the contiguous part of the buffer, and relies on
h1_parse_chunk_ext() for the extensions. When the line crosses the
buffer's end, the buffer is realigned in place, as is already done for
headers and trailers, and the parsing restarts. This removes the
per-byte wrapping checks of this slow path.
Willy Tarreau [Mon, 23 Nov 2026 22:23:17 +0000 (22:23 +0000)]
REORG: h1: move chunk extensions parsing to a dedicated inline function
The chunk extensions parser of the contiguous chunks parser is moved as-is
to h1_parse_chunk_ext() in h1.h so that it can be shared with the generic
chunk-size parser instead of being duplicated and maintained twice. It
works on contiguous memory with the reverse index convention of the
contiguous parser (end[ridx], ridx < 0 reaching zero at the end of the
input) and returns the new index of the final CR, 0 if more data are
needed, or the opposite of the faulty char's index. It is force-inlined
since streams of tiny chunks each carrying an extension (e.g.
"1;1\r\n1\r\n") must not cost a function call per chunk.
Only the exits were adapted: on the CR, the function returns its index
after checking the pending BWS/equal/quote states, and the CRLF is now
checked by the caller. Running out of data returns 0, and errors return
the opposite of the faulty char's index.
Willy Tarreau [Mon, 23 Nov 2026 18:20:43 +0000 (18:20 +0000)]
REGTESTS: http-messaging: test the strict parsing of HTTP/1 chunk extensions
Chunk extensions must exactly follow the BNF from RFC9112#7.1.1. This
sends 20 valid and 37 invalid chunk-size lines (on regular and last
chunks) in requests, and a few of them in responses, and checks that
valid ones are forwarded with their body while invalid ones are
rejected with a 400 (or a 502 for responses) without reaching the
server.
Each message is sent in a single write so that it is parsed by the
contiguous chunks parser (h1_parse_full_contig_chunks()). The generic
h1_parse_chunk_size() is only used when the buffer wraps or the HTX is
full, which cannot reliably be reproduced here.
Willy Tarreau [Thu, 5 Nov 2026 17:44:09 +0000 (18:44 +0100)]
BUG/MINOR: h1: restrict a bit more the syntax of chunk extensions
This is a complement of commit 35d63cc3c7 ("MEDIUM: h1: strictly verify
quoting in chunk extensions") in 3.4-dev4, which focused on better
dealing with quotes in chunk extensions due to some agents being
confused by the quotes there. The exact syntax of chunk extensions is:
BWS stands for "bad whitespace", a WS that might be received from legacy
senders but that new ones must not send.
There were a few aspects above that we didn't check:
- no space is permitted before the CRLF
- the value may not be empty
- name must exclusively be a token
- value must exclusively be a token if not a quoted string
This is important because bad parsers have been caught in the past
swalloing the CRLF at wrong places (inside quotes mainly), and we must
make sure that we're not receiving a mis-quoted extension that could
have fooled an upstream reverse-proxy that got its framing wrong.
This commit improves the state machine to take care ofthe equal sign,
check for BWS around and non-empty value, and make sure that <name>
is a token. It looks like a big change but actually it's a linear
parsing of simple elements and it simplifies the previous parser
that was relying on multiple states in a loop and was wrong.
This is marked minor because most of the sensitive job was in the
commit above, this one only slightly tightens it (and anyway nobody
uses chunk extensions). It could make sense to backport this where
the commit above was backported, after a period of observation.
Willy Tarreau [Tue, 24 Nov 2026 08:19:00 +0000 (09:19 +0100)]
IMPORT: slz: update slz to v1.4.0 (commit 197db002f1)
This fixes a bug that doesn't affect haproxy (in case USLZ_FAST_BITS
is set higher than 9 bits), cleans up the code by moving all tables to
slz-tables.h, improves uslz's performance on dynamic tables (which we
now use a lot with text) by not interrupting their decoding when they
alternate with matches (+15% perf on web with 16 kB buffers). This is
now a tagged version, fixes will be picked from branch stable-1.4.
BUG/MEDIUM: acme: match DNS challenges against all TXT records
A certificate covering a domain and its wildcard requires two dns-01 TXT
values at the same _acme-challenge name. The DNS parser retains both
records, but the ACME resolver callback only copied the first one. With
challenge-ready dns, one authorization could therefore never match its
expected value and renewal would time out.
Copy all TXT records into an owned singly linked list in one response-tree
traversal, using istdup() for each value. Match each challenge against any
entry and free the complete list on replacement, allocation failure, and
resolver teardown. Keep successful empty-list responses valid as before
and leave CLI readiness unchanged.
This should be backported to 3.4, where the DNS propagation pre-check was
introduced by 631fd5f99b.
Willy Tarreau [Mon, 23 Nov 2026 16:53:32 +0000 (17:53 +0100)]
MINOR: http: add a new violation rule "trace-with-content" for TRACE methods
The TRACE method must not be used with a content according to the latest
specifications, as it can be used to build smuggling attacks depending on
server implementations. This is blocked as a violation, and can be released
via "trace-with-content" if there is a compelling reason (there should not
be any).
Willy Tarreau [Mon, 23 Nov 2026 15:32:46 +0000 (16:32 +0100)]
MEDIUM: http/hardening: filter out-of-range status codes from untrusted servers
The new rule "reject-out-of-range-status" is used to reject status codes
below 100 or above 599. They are never used except in local deployments,
and are handled differently by different implementations, so let's block
them by default on untrusted connections.
Willy Tarreau [Mon, 23 Nov 2026 12:39:03 +0000 (13:39 +0100)]
MEDIUM: http/hardening: reject forbidden payload on 1xx/204 responses
When a content-length greater than zero or a transfer-encoding header
are presented with responses that may not contain any body, the new
hardening rule "reject-forbidden-payload" will block them to limit the
risk of attacks (e.g. cache poisonning). It is enabled by default on
untrusted connections.
For h2 and h3 it's not easy to test. haproxy was used with an
http-request return action for this, along with a code modification
in http_parse_http_reply() to disable the 204+CL check.
Willy Tarreau [Mon, 23 Nov 2026 10:46:27 +0000 (11:46 +0100)]
MEDIUM: http/hardening: default to rejecting untrusted duplicate C-L
We're currently doing great efforts trying to detect abnormal
content-length headers and even normalize duplicates, but it's still
possible for upstream agents to be fooled by them (e.g. sum them) and
pass them, so let's add "reject-duplicate-content-length", a new
hardening option to reject them, and enable it by default on public-
facing connections since this is really not something that is seen
outside of attacks.
Willy Tarreau [Mon, 23 Nov 2026 08:56:17 +0000 (09:56 +0100)]
MEDIUM: http/hardening: delete untrusted headers/trailers with underscore
No standard header/trailer name exists with underscores, and these are
sometimes converted to the same variable name as the ones with a dash by
some application frameworks or CGI/FCGI, causing confusion. Let's just
drop them by default from untrusted peers (we don't deny these requests
nor responses though).
Willy Tarreau [Mon, 23 Nov 2026 08:47:23 +0000 (09:47 +0100)]
MINOR: http_ana: always drop the Expect header in HTTP/1.0
The Expect header wasn't specified in HTTP/1.0, and its only known
value 100-continue isn't usable there. Yet it continues to fool various
servers and reverse-proxies. Let's just drop it when seen in 1.0 requests
to be sure not to respond.
Willy Tarreau [Mon, 23 Nov 2026 07:53:30 +0000 (08:53 +0100)]
MEDIUM: http_ana: control acceptance of 1xx status on HTTP/1.0
HTTP/1.0 doesn't define status codes 1xx and these ones are not uniformly
handled across agents. These must never be emitted, neither by an 1.0
server nor to an 1.0 client, or there is a risk of smuggling. Let's
block them by default, and subject them to the "http-1.0-status-1xx"
response violation rule.
Willy Tarreau [Mon, 23 Nov 2026 14:46:22 +0000 (15:46 +0100)]
MINOR: http: Add support for HTTP 411 status code
411-Length-Required is now part of supported status codes that
can be defined as error files. The hash table defined in
http_get_status_idx() was updated accordingly (the factor 406 did
not change).
Willy Tarreau [Mon, 23 Nov 2026 14:42:14 +0000 (15:42 +0100)]
DEV: phash: improve the output to permit an easier copy-paste
The output had to be recopied manually. Let's print it as an array like
it is in the code so that it's now possible to simply copy-paste it
there and avoid mistakes.
Amaury Denoyelle [Mon, 23 Nov 2026 15:55:11 +0000 (16:55 +0100)]
MINOR: mux-quic: remove error trace on transport failure
An error trace is reported by MUX-QUIC when the transport layer detects
a connection closure. However, most of the time this occurs because the
client has closed the connection after finishing its transfer via a
NO_ERROR code.
This termination is expected and should not be considered as an error.
For this reason, remove the trace from the MUX-QUIC layer.
Olivier Houchard [Mon, 23 Nov 2026 15:13:02 +0000 (16:13 +0100)]
BUG/MEDIUM: mux-h2: reject non-101 2xx responses to Extended CONNECT
An Extended CONNECT (RFC8441) is converted to an upgrade request for an
H1 server, and a 101 response is converted to a 200, meaning that the
tunnel is established. But if the server ignores the upgrade and returns
a regular 2xx, it was forwarded as-is, so the client considered the
tunnel as established and took the payload for tunneled data.
Let's handle such a response as an error, as is already done for a 101
without Extended CONNECT.
This was introduced in 2.4 by commit efe2276a9 ("MEDIUM: mux_h2:
generate Extended CONNECT response") and must be backported to all
supported versions.
Amaury Denoyelle [Mon, 23 Nov 2026 13:22:54 +0000 (14:22 +0100)]
MINOR: server: lookup defaults section on "from be:"
This patch is similar to the previous one. As an alternative to a
backend name, "from be:" may now also reference a named defaults section
to reuse its unnamed default-server.
Amaury Denoyelle [Mon, 23 Nov 2026 08:53:09 +0000 (09:53 +0100)]
MINOR: server: lookup defaults section on "from srv:"
When defining a server, notation 'from srv:<bename>/<srvname>' can be
specified to inherit from a server or default-server defined in another
backend instance.
Extend this to also look up in defaults sections. This is safe as
proxies and defaults sections cannot have the same name since 3.3.
Without this patch, a named default-server in a named defaults section
is unusable as it cannot be referenced by the existing syntax.
Amaury Denoyelle [Mon, 23 Nov 2026 10:04:24 +0000 (11:04 +0100)]
MINOR: server: report incorrect usage of "from" keyword
Define a parser for the "from" server keyword. It always returns an
error reporting its invalid position as any "from" setting has already
been parsed during _srv_parse_from().
Also, this prevents a later keyword list from overriding this name.
Amaury Denoyelle [Tue, 17 Nov 2026 15:15:48 +0000 (16:15 +0100)]
BUG/MINOR: qmux: prevent pacing BUG_ON() on send syscall zero return
Previously, qcc_qmux_send_frames() would return 1 in case a send failed
on a transient error while nothing was emitted. However, this may
trigger a BUG_ON() in qcc_io_send() as this return value is reserved for
QUIC pacing support, not relevant with QMux.
Fix this by converting the return value to a negative value, which is
already used for fatal errors.
The caller is responsible for re-emitting the new the frame later. As
such, the prepared record is cleared from the send buffer to avoid a
duplicate emission on initial flush.
Note that this patch does not implement full support for QMux partial
emission if the send syscall accepts some but not all bytes, resulting
in a partially delivered frame. This must be implemented in a future
patch. Once this is the case, all code related to the handling of send
zero return can probably be removed.
CLEANUP: tcpcheck: Stop to export most of custom expect functions
The custom expect functions, for instance tcpcheck_ldap_expect_bindrsp(),
are only used by tcpcheck rules. No reason to export them. The only
exception is the one parsing agent-check response because the parsing of
this option is performed in check.c.
Note also tcpcheck_spop_expect_agenthello() was removed during SPOE
refactoring, so there is no function definition.
REGTESTS: mysql-check: refresh the regtest for the auth switch support
The mock servers no longer expect a COM_QUIT command pipelined with
the handshake response for the post-80 and post-80-sha2 modes, and
new servers exercise an auth switch request, with a success and
failures, including a full authentication request and an access
denied error. Two servers also send an invalid auth switch request,
with an empty payload or a plugin name not terminated by a NUL byte,
to make sure the packet is validated before being handled.
MEDIUM: tcpcheck: handle MySQL AuthSwitchRequest in mysql-check post-80 modes
With the post-80 and post-80-sha2 modes, when the authentication
plugin of the check user differs from the announced one, the server
replies to the handshake response with an AuthSwitchRequest. The
check now answers with an empty password for the requested plugin,
then concludes on the authentication result: an OK packet marks the
server as UP, an ERR packet as DOWN, and a full authentication
request fails cleanly as it requires the password.
The AuthSwitchRequest packet is validated before being handled: a
packet with an empty payload or with a plugin name not terminated by
a NUL byte is reported as an invalid response. Otherwise the plugin
name would be searched outside the packet bounds.
To do so, the COM_QUIT command is no longer pipelined right after
the handshake response. It is now sent once the authentication
result is known, packed with the auth switch reply when there is
one, so the session is cleanly closed in every case and no
connection error is recorded on the server. The legacy pre-41 and
post-41 modes keep the pipelined COM_QUIT, they cannot receive an
auth switch request.
MINOR: tcpcheck: evaluate custom expect rules on empty response when allowed
The custom expect functions are not evaluated when the response
buffer is empty. When the TCPCHK_EXPT_FL_ALLOW_EMPTY flag is set
on the rule, the function is now called with an empty buffer, on
the condition it properly handles this situation. It is useful
when the connection closure by the server is itself a valid
result.
MINOR: tcpcheck: add TCPCHK_EXPT_FL_ALLOW_EMPTY flag on expect rules
Custom expect functions are not evaluated when the response buffer is
empty. With the new TCPCHK_EXPT_FL_ALLOW_EMPTY flag, a custom expect
rule can be evaluated with an empty response, on the condition the
custom function properly handles this situation. It is useful when
the connection closure by the server is itself a valid result.
MEDIUM: stconn: Forward kip hint right before the endpoint callback
sc_ep_fwd_kip_when_committed() forwards the <kip> hint of the producer to
the <kop> hint of the consumer, so the latter may use it as an optimization
(the H1 mux announcing a chunk covering the whole payload at once).
It is currently called at the entry of sc_conn_send() and sc_applet_send(),
and in task_run_applet() before checking the applet was not shut. Thus the
hint may be forwarded while no endpoint callback is invoked, or while the
applet is not called at all. This leaves a pending guarantee on the
consumer side for data that may never be emitted by this call.
Move the call right before the callbacks which may consume <kop>
(resume_fastfwd() and snd_buf() for a connection, appctx_snd_buf() for an
applet), and inside the applet shutdown check, so the hint is forwarded
only when a callback is really invoked. resume_fastfwd() does not use <kop>
for now, but it is not the stconn's business to know which callback consumes
it. The recv side already works this way, before fastfwd() and
appctx_fastfwd().
This is not a fix and there is nothing to backport.
BUG/MEDIUM: mux-h1: never forward more data than announced in a chunk
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:
<kop> is the known output payload length, and by contract it is a minimal
guarantee: at least this size will be forwarded. When it is set, the H1 mux
announces it as the size of the chunk and consumes it. 0 means the output
payload length is unknown, and in this case only the size of the data block
is announced.
But nothing checked that the data sent with the chunk did not exceed the
announced size: h1m->curr_len was blindly decremented, possibly wrapping,
and the remaining bytes of the block were emitted without any chunk framing.
Such a violation could be observed when a data filter was used on the
request, before the previous patch fixed its root: the <kip> hint was
forwarded to <kop> on a stream not committed to forward its data, and a
stale value could then be announced for a data block, possibly smaller than
the block itself.
The copy path already reported an error for messages with a content-length
when more data than announced was met. The same check is now done in the
zero-copy path, for chunked messages: report an error and close the stream
instead of silently emitting an unframed payload. This is a guard for extra
safety, on top of the previous patch which fixes the issue at its root, in
the stream connectors.
Both patches must be backported as far as 3.3. On the stable branches, this
one must be applied on top of the other one, otherwise valid messages may be
rejected when a data filter alters the payload size and a stale <kip> hint
was moved to <kop>.
BUG/MEDIUM: stconn: Only forward kip hint on streams committed to forward data
The <kip> hint of a sedesc is the payload length the producer endpoint
estimates it will emit. It is forwarded to the <kop> hint of the opposite
sedesc by sc_ep_fwd_kip(), so the consumer endpoint can use it as an
optimization, for instance the H1 mux to announce a chunk size covering the
whole payload at once.
But <kip> could be set by the producer on the data it demultiplexes, before
the app layer has a chance to see it. In particular, when data filters are
registered on the channel, flt_http_payload() resets <kip> after each pass,
because the filters may alter or drop any part of the payload. But in the
meantime, an I/O callback may already have moved the hint to the opposite
side: the consumer then uses a stale <kop> value, and the data it emits may
not match what this value announces.
This is how the H1 mux could be led to announce a chunk smaller than the
data sent with it, and to emit the remaining bytes without any chunk
framing, making an HTTP/1 server process a part of the request payload as
another request (request smuggling).
The root of the issue is that <kip>/<kop> are hints on data which were
not evaluated by the app layer yet, but they may be consumed as if they
were. <kop> is a minimal guarantee on the output payload: when it is
set, at least this size will be forwarded. It is only safe to feed it
with <kip> once the app layer committed to forward the data as-is.
This patch introduced a safe version of sc_ep_fwd_kip(),
sc_ep_fwd_kip_when_committed(), which only forwards the hint when the
producer channel is configured to forward data indefinitely (to_forward ==
CHN_INFINITE_FORWARD). This is the only case where the app layer committed
to forward everything, without any alteration: http_wait_request_body() and
http_wait_for_response_body() set the infinite forwarding only when no data
filter is registered on the channel. Otherwise <kop> stays null and the
consumer endpoints fall back to their conservative behavior (the H1 mux
announces the size of the data it emits).
When the app layer is not committed yet, <kip> is reset instead of being
kept for later. Until the infinite forwarding is reached, data may be
forwarded and emitted by the consumer with a null <kop>, while <kip> still
accounts for them, because it is only decremented when forwarded. Moving
it later would then set <kop> higher than the remaining payload, and the
H1 mux would announce a chunk bigger than the data left to send. Resetting
it keeps <kop> conservative: lower than the remaining payload, never
higher.
BUG/MEDIUM: applets: do not wake up applets before the end of the request analysis
The applet is woken up as soon as it is created by sc_applet_create(). But
the request analysis is not over at this point and it may still be paused,
typically by a "http-request wait-for-body" rule, while the applet is
already attached to the back stream connector (the cache after a
cache-use hit, for instance). Thus, the applet could start to consume the
request and to produce its response before the end of the request
analysis, and the response analysers were evaluated in the same time. It
is unexpected and it could lead to weird issues.
To fix the issue, the way the applets are created is changed.
sc_applet_create() no longer schedules the applet and it no longer
switches the stream connector to the ready state. The applet remains in
SC_ST_INI state, in a dormant state, and the request analysis can
continue, undisturbed. The applet is woken up by back_handle_st_req(),
when the request analysis is over and the stream connector switches from
SC_ST_INI to SC_ST_REQ and then to SC_ST_RDY.
Thus, process_use_service() was reviewed accordingly. Because the
use-service action is terminal and it never yields, there is no re-entry
in this function, so the re-entry branch was removed. And the applet is
not woken up by the action anymore. It will be done by
back_handle_st_req(). Note that a re-entry would now fail in
sc_applet_create(), because the SE_FL_DETACHED flag is cleared once an
applet is attached.
Note this design change reverts, in intent, the commit a33ff7a8a
("BUG/MEDIUM: conn-stream: Set back CS to RDY state when the appctx is
created"). Here, the stream connector is set to the ready state when the
applet is woken up, not when the appctx is created, so the ambiguity
discussed in this commit remains solved: there is no target installed on
a stream connector in SC_ST_INI state, and the stream connector is
switched to SC_ST_RDY state before the applet starts to work.
This patch could be backported to all supported versions. But because it is
a design change, it is probably better to not backport it lower than the
3.2, and only after a period of observation. It relies on "BUG/MEDIUM:
stconn: Do not install an applet on a busy stream connector"
BUG/MEDIUM: stconn: Do not install an applet on a busy stream connector
It is possible to install an applet on a stream connector with an applet
already attached. This could happen with a "http-request cache-use" rule
followed by a matching "http-request use-service" rule, when the
cache-use rule hits. The use-service rule installs a second applet on the
same stream connector, replacing the cache one, which is leaked with its
retained cache row. The commit a72de1022 ("BUG/MEDIUM: cache: do not
create a second applet when two cache-use rules hit") only fixed the case
of two cache-use rules. The use-service rules are still vulnerable.
To fix the issue, sc_applet_create() now checks the SE_FL_DETACHED flag
and fails if it is not set. This flag is set when the stream connector is
created and it is cleared when an endpoint is attached, a mux or an
applet, and it is set again by sc_reset_endp() when the endpoint is
reset, to be able to retry a connection. Thus, it is not possible to
install an applet on a stream connector with an applet already attached
anymore.
This patch should be backported to all supported versions. The commit a72de1022 is not present in the stable branches and the same weakness
exists there since sc_applet_create() was introduced in 2.6.
DOC: htx: add the NOOP block to the HTX API documentation
Update the htx-api internals documentation for the HTX_BLK_NOOP block
introduced by the "MINOR: htx: Add a noop block to carry the EOM flag on an
empty message" commit:
- Add the no-op block to the marker kinds, the supported types list and
the typical composition of an HTX message.
- Document that a NOOP block may carry the EOM flag and that htx_set_eom()
now relies on it, and no longer on an EOT block, to report the end of
an empty message.
- Document that an EOT block without the EOM flag is a valid state: the
end of the trailers was reached but the message is not ended, more data
may follow. Consumers must check the EOM flag, not the block type.
- Mention NOOP for htx_add_endof() and the new htx_add_noop() shortcut,
for htx_get_blk_value() which returns an empty string for it, and fix
the htx_skip_msg_payload() description which may now add a NOOP block
when the message becomes empty.
MINOR: htx: Add a noop block to carry the EOM flag on an empty message
A new HTX block type, HTX_BLK_NOOP, is added. It has the same traits as
the EOH and EOT blocks: a size of 1, to be able to wake the endpoint up
when it is emitted alone, but nothing is sent when a consumer encounters
it. It may carry the EOM flag and it is allowed anywhere in the message.
It is used by htx_set_eom() to report the end of an empty message: the
EOM flag was previously carried by an EOT block in this case, which was
misleading, an end-of-trailers block carrying no data. As a consequence,
an EOT block without the EOM flag is now a valid state, the message is
simply not ended. This must be handled by all the consumers, especially
the muxes:
- The H1 mux skips the NOOP blocks and, when one carries the EOM flag,
it reports the end of the message exactly like a last DATA block. An
EOT block without the EOM flag still ends the message framing, as
before: on the wire, the trailers terminate a chunked message, there
is nothing to add after them.
- The H2 mux skips the NOOP blocks and, when one carries the EOM flag,
it emits an empty DATA frame with the END_STREAM flag and closes the
stream. For a trailers frame, the END_STREAM flag is now only set
when the EOT block carries the EOM flag, and the stream is only
closed in this case. An EOT block without the EOM flag means the
message is not finished and more data may follow.
- The H3 mux skips the NOOP blocks and, when one carries the EOM flag,
it sets the fin flag on the stream. Like the H2 mux, the fin flag is
only reported for an EOT block carrying the EOM flag.
- The FCGI mux skips the NOOP blocks and, when one carries the EOM
flag, it emits an empty STDIN record to signal the end of the request.
All the other consumers, the filters, the applets, the sample fetches and
the health-checks, were audited: they either ignore the unknown block
types or stop their walk on the block carrying the EOM flag, so a NOOP
block is properly handled by all of them.
There is no need to backport this patch, it is an enabler for future uses.
MINOR: filters: Register a dedicated trace source for the filters
The filters were traced using the stream trace source, with the
STRM_EV_FLT_ANA and STRM_EV_FLT_ERR events. It was convenient but it
mixed the filters with the stream analysers, and the events were not
detailed enough to know which filter callback was called, nor on which
channel.
Now a dedicated "filter" trace source is registered. The first argument is
always the stream, the second one is the filter instance and the third one
is the channel, so that the lock-on may be performed on a specific filter.
The events are split by callback: start_ana, pre_ana, post_ana, end_ana,
http_hdrs, http_payload, http_end, http_reset, http_reply, tcp_payload and
xfer_data. Two other events are reported when a filter is attached to or
detached from a stream. The wait and err events are reported when the
filter analysis is paused waiting for data or when it fails.
The decoding function reports the stream and the channel states, the
filter id and its flags, the filter offsets, and the channels' buffers
when the verbosity is high enough. This way it is possible to follow a
filter instance through the analysis of a request or a response, which was
not possible with the stream trace source alone.
The STRM_EV_FLT_ANA and STRM_EV_FLT_ERR events are removed, along with
their entries in the stream trace source, since they are not used
anymore.
A client request can make the FastCGI path copy exactly fill its
scratch buffer. b_tail() then wraps to the start, so subtracting the
path length points before the buffer. URL decoding reads and writes
there instead of reading the copied path.
Require one free byte for ist0()'s terminator. The request then
follows the existing error path; ordinary paths keep working.
Commit a01ba66bc2 rejected oversized copies but missed exact fits.
This should be backported to affected stable branches.
Signed-off-by: Kelly Kane <kelly@hawknetworks.com>
BUG/MEDIUM: acme: take the resolvers lock when linking/unlinking DNS requesters
The dns-01 pre-check links an ACME requester to a resolution in
acme_rslv_start() and unlinks it in acme_rslv_free(), both called from
the ACME task, which runs on any thread. But resolv_link_resolution() and
resolv_unlink_resolution() manipulate the resolvers' resolution lists and
the resolutions' requester lists, which are also manipulated by the
resolvers task and the response handlers on the resolvers' thread under
resolvers->lock. Other requesters (do-resolve in streams, stream_free(),
CLI actions on servers) always take this lock around these calls, but
the ACME code never does.
Among the possible consequences, the requester callbacks are called on
the resolvers' thread while it iterates over the resolution's requesters
under the lock. The last callback wakes the ACME task up, which may then
immediately call acme_rslv_free() on another thread and unlink the last
requester, which aborts and frees the resolution in leave_resolver_code(),
while the resolvers' thread continues to use it (resolv_reset_resolution(),
LIST_DEL_INIT() etc). Concurrent insertions into the resolutions lists
with process_resolvers() may also corrupt them.
This requires an ACME dns-01 challenge with a multi-threaded process and
was only found by code review: there is currently no way to test ACME
here, but the rules are the same as for all other requesters.
Let's take the lock around the link+trigger and the unlink operations.
This was introduced in 3.4 with commit 631fd5f99 ("MEDIUM: acme: add dns-01
DNS propagation pre-check"), so this must be backported to 3.4.
Willy Tarreau [Sat, 21 Nov 2026 08:04:40 +0000 (09:04 +0100)]
CLEANUP: pattern: don't even run string-based matches on empty strings
None of our matching patterns supports matching an empty string, so let's
just not even try to call them for empty strings. This may even speed up
suboptimal configs that unconditionally search for certain things in empty
fields.
Willy Tarreau [Sat, 21 Nov 2026 07:59:56 +0000 (08:59 +0100)]
BUG/MEDIUM: pattern: check for non-empty string before matching regexes
Zübeyir Eser reported in github issue #3602 that passing req.body to the
default regex engine crashes when there is no body. This is because the
body returns an empty sample while the default regex engine demands at
least one byte available to write a trailing zero.
Let's make sure that regex matches don't even run when subject to empty
strings.
Willy Tarreau [Fri, 20 Nov 2026 18:23:26 +0000 (19:23 +0100)]
MEDIUM: config: emit warnings when changing bufsize after other sections
Long ago we emitted a diag when a global section is placed after some
non-global sections, but that's not sufficient because it's even possible
to change tune.bufsize (even shrink it) and face problems such as return
directives or errorfiles loaded with a larger value not being able to be
delivered.
Let's now emit warnings when the value changes, explaining the risks,
discourage from doing so, and do that as well for tune.maxrewrite and
tune.http.maxhdr, which also impacts the ability to build HTTP replies
on the fly.
BUG/MINOR: payload: distcc_body must not sample unreceived buffer bytes
When the declared body of a distcc token is longer than the data actually
received but still fits within the channel's receive limit,
smp_fetch_distcc_body() truncates the sample to channel_recv_limit() instead
of ci_data(). The sample then covers a range of the buffer that has not been
filled by the current connection, exposing stale bytes left by a previous
connection using the same pooled buffer, e.g. via ACLs, set-var, log-format
or header insertion.
In addition, the incomplete-body check mixed reference frames: ofs is
relative to the input head, but was compared against ci_head() - b_orig() +
ci_data(), which is only equivalent when the input head sits at the buffer
origin. With bytes already forwarded, a body extending past the received
data could be considered complete.
Both issues are fixed by comparing and truncating against ci_data(), the
amount of input data actually received, and by always setting
SMP_F_MAY_CHANGE on truncated bodies so the rules are re-evaluated once more
data arrives.
This patch should fix the issue #3583. It must be backported to all
supported versions.
BUG/MINOR: quic: fix uninitialized read of pkt->rs.delivered in ACK processing (BBR)
In qc_notify_cc_of_newly_acked_pkts() the ->rs.delivered field of a TX
packet is unconditionally read for each newly acknowledged packet. But
->rs is filled in at TX time by quic_cc_drs_on_pkt_sent() (called from
drs_on_transmit() under QUIC_FL_TX_PACKET_ACK_ELICITING guard) for
ack-eliciting packets only. For a non ack-eliciting packet, e.g. a pure
ACK packet, which can be acknowledged by a peer, ->rs has never been
written and this read returns an indeterminate value.
This value is consumed by quic_cc_drs_on_ack_recv() and on_ack_rcvd()
which may corrupt the delivery rate sampling round counting
(drs->round_count, drs->next_round_delivered): a stale value from a
previously recycled packet freezes the round detection, a null one
spuriously increments round_count. Only BBR is affected: cubic neither
provides get_drs() nor on_ack_rcvd().
Fix this by reading ->rs.delivered for ack-eliciting packets only, as
already done for the call to quic_cc_drs_update_rate_sample() just
below, and for on_pkt_lost() in quic_loss.c. Also document in
quic_tx_packet_init() that ->rs is deliberately left uninitialized and
must never be read for a non ack-eliciting packet.
Thank you to @brhenc for having reported this bug in GH #3587.
This bug was introduced by 44af88d85 ("MINOR: quic: RX part
modifications to support BBR") with the delivery rate sampling support.
This must be backported up to v3.2.
BUG/MINOR: lua: channel: append() must insert data at the end, not at the start
hlua_channel_append() inserts the string at the offset of the start of the
input data, like hlua_channel_prepend() does, instead of after the existing
input data. The offset+len expression is computed and passed through
hlua_channel_filter() but never used. The function is otherwise identical to
hlua_channel_prepend(), it seems to be a copy-paste mistake when the
filter-aware insert path was introduced; hlua_http_msg_append() correctly
inserts at offset+len for the same operation.
As a result, Channel.append() behaved exactly like Channel.prepend(),
placing the string in front of the channel's input data instead of at its
end, in contradiction with its documentation ("Same as
Channel.insert(channel, string, channel:input())").
This patch should fix the issue #3598. It must be backported to all
supported versions.
BUG/MINOR: vars: fix missing string termination in get var on too long values
vars_parse_cli_get_var() builds the output for the CLI's "get var" in the
shared trash chunk using b_putchr(), which silently drops bytes once the
buffer is full. For a value long enough to exhaust trash mid-loop, the
trailing '>' and the terminating NUL were dropped, leaving trash.area
without any NUL within its bounds. cli_msg() only stores the pointer and the
string is later read with ist() (i.e. strlen) in cli_output_msg(), reading
past the buffer.
Now the loop stops before the last byte, and the terminating NUL is always
written within bounds, truncating the output if needed.
This patch should fix the issue #3592. It could be backported to all
supported versions.
BUG/MINOR: tcpcheck: fix out-of-bounds read on the MySQL server version
On success, the MySQL health-check stores the server version, read at offset
5 of the received buffer, as the check description. The version is a
NUL-terminated string, but nothing guarantees the string is terminated,
neither inside the received data nor past its end. And the version pointer
is directly passed to set_server_check_status(), which copies it with
strncpy() up to 127 bytes, stopping at the first NUL byte. With a
non-compliant server sending a handshake with an unterminated version and no
NUL byte in the rest of the received data, the copy reads past the received
data, into the remaining content of the buffer chunk, and the stale bytes
are disclosed in the check status, visible in the logs, the stats page and
'show servers state'.
To fix it, the version is bounded to the received data before being copied
into the check status, like the plugin name of an auth switch request. This
is a rework of the out-of-bounds reads fixed by 3bbfc3bd7 ('BUG/MINOR:
tcpcheck: fix out-of-bounds reads on short MySQL error packets'), which
covered the error packets but not the success path.
This is a read past the received data, so it requires a non-compliant
server, which is out of the threat model (servers are trusted). Thus there
is no security impact here, only a potential information leak in the check
status.
This patch should fix the issue #3596. It should be backported to all
supported versions.
Olivier Houchard [Fri, 20 Nov 2026 14:33:44 +0000 (15:33 +0100)]
BUG/MEDIUM: mux-spop: let the buffer callback allocate despite the queue
spop_buf_available() is called by offer_buffers() while the spop_conn is
still in the buffer wait queue. Since commit d1eb48a12 ("MEDIUM: dynbuf:
refrain from offering a buffer if more critical ones are waiting"),
b_alloc() refuses to allocate when the queue of the same or of a more
critical level is not empty, unless DB_F_NOQUEUE is passed. As the spop_conn
is queued with DB_MUX_RX, the demux buffer allocation always fails from
the callback, and the connection remains blocked until it times out.
This was reproduced by faking a failed demux buffer allocation when
receiving the agent's reply: the SPOE processing times out.
Let's pass DB_F_NOQUEUE to the allocations made from the callback, as
was done for mux-h2 in commit d7192a667 ("BUG/MEDIUM: mux-h2: permit the
buffer callback to allocate despite the queue").
The issue comes from the commit above, and mux-spop is affected since
it was introduced in 3.1. This must be backported to 3.1.
Olivier Houchard [Fri, 20 Nov 2026 14:33:44 +0000 (15:33 +0100)]
BUG/MEDIUM: mux-fcgi: let the buffer callback allocate despite the queue
fcgi_buf_available() is called by offer_buffers() while the fconn is
still in the buffer wait queue. Since commit d1eb48a12 ("MEDIUM: dynbuf:
refrain from offering a buffer if more critical ones are waiting"),
b_alloc() refuses to allocate when the queue of the same or of a more
critical level is not empty, unless DB_F_NOQUEUE is passed. As the fconn
is queued with DB_MUX_RX, the demux buffer allocation always fails from
the callback, and the connection remains blocked until it times out.
This was reproduced by faking a failed demux buffer allocation when
receiving the response: the request ends with a 504.
Let's pass DB_F_NOQUEUE to the allocations made from the callback, as
was done for mux-h2 in commit d7192a667 ("BUG/MEDIUM: mux-h2: permit the
buffer callback to allocate despite the queue").
This was introduced in 3.0 by the commit above and must be backported
to 3.0.
Olivier Houchard [Fri, 20 Nov 2026 13:29:45 +0000 (14:29 +0100)]
BUG/MEDIUM: mux-h2: don't stall on a failed rxbuf alloc without stream
When h2c_dec_hdrs() fails to allocate the temporary buffer used to
decode the HEADERS frame of a new request, it sets H2_CF_DEM_SALLOC and
the connection is queued in the buffer wait list. But h2_buf_available()
only serves H2_CF_DEM_SALLOC for a stream which has a stream connector,
which is not the case yet, so it never succeeds: the demux remains
blocked and the request is not processed until the connection times
out. This can be reproduced by faking a failed allocation there on the
first request of a connection.
There is no buffer the callback could allocate in this case, so let's
clear the flag and restart the demux, which will retry by itself. Since
b_alloc() refuses to allocate when other entries are queued, the retry
would be queued again and the offered buffer would be lost for
everyone, so a new flag H2_CF_DEM_MAYALLOC is set to let the next
h2_get_buf() allocate with DB_F_NOQUEUE, as mux-h1 does with
H1C_F_IN_MAYALLOC.
This was introduced in 2.0 by commit 5c8cafae3 ("MEDIUM: mux-h2: decode
HEADERS frames before allocating the stream"). It must be backported to
all supported versions. Before 3.0 there is no DB_F_NOQUEUE and the new
flag is not needed, clearing H2_CF_DEM_SALLOC and restarting the demux
is enough.
Willy Tarreau [Fri, 20 Nov 2026 14:01:46 +0000 (15:01 +0100)]
MINOR: http: use fuzzy-match for the "return" action keywords
The "http-request return" action supports ~10 keywords whose spelling
is never well-known for the least common ones and requires one to check
the doc. Let's just leverage find_word_index_in_array() to locate the
keyword or suggest a close match.
Willy Tarreau [Fri, 20 Nov 2026 13:15:11 +0000 (14:15 +0100)]
MINOR: init: automatically turn "set-dumpable" on when using "-d"
Since we started to automatically chroot for unprivileged users, it
has become really annoying for developers to get a core file during
their testing. Let's always turn "set-dumpable" on when debug mode
is forced on via "-d".
Willy Tarreau [Fri, 20 Nov 2026 12:43:39 +0000 (13:43 +0100)]
CLEANUP: mux-h2: get rid of the redundant h2_parse_int() function
This one was brought by commiy 8475b372c ("BUG/MINOR: mux-h2: reject
non-numeric values in the tune.h2 keywords") but is no longer needed
with the recent intops additions, let's get rid of it.
The 'jwt_verify' converter was built with the idea of being easy to use
for all JWT tokens and its second parameter needied to be interpreted
totally differently depending on the first parameter (HMAC vs pubkey
path). This comes with a potential security risk if a user did not check
the algorithm type before calling the converter. If an HMAC-signed token
was tested in a jwt_verify call that provided a certificate as second
parameter, an attacker could try to guess the certificate path and forge
HMAC tokens that validate against the certificate path.
In order to get rid of this potential risk, a new jwt_verify_secret
converter was introduced, and paired with the already existing
jwt_verify_cert one, we can fully get rid of this risk since no
parameter gets treated differently based off client-provided
information.
The 'jwt_verify' converter interprets its second parameter differently
depending on its first one: for HMAC algorithms it is used as a shared
secret, while for asymmetric ones it holds the path to a certificate or
a public key. Letting client-provided data decide how a configuration
parameter is interpreted is risky.
Splitting this logic into two converters removes the ambiguity. The new
'jwt_verify_secret' converter only accepts HMAC algorithms and always
interprets its second parameter as a secret, while the existing
'jwt_verify_cert' converter only accepts asymmetric algorithms and
always interprets it as a certificate or public key path.
The historical 'jwt_verify' converter, which keeps both behaviors for
backward compatibility, is left untouched for now, but it is the
converter that should eventually disappear once users migrated to the
two new ones.
BUG/MINOR: tcpcheck: fix out-of-bounds reads on truncated SPOP hello frames
The SPOP health-check parser reads the frame header, then dispatches on the
frame type with a read right after the 11-byte header, and decodes the K/V
items of the payload. Nothing prevents these reads to go past the received
data:
- With a frame announcing no payload (flen == 0) and a received data
exactly covering the header, the frame type is read one byte past
the received data. It is fully deterministic and does not even
require the connection to be closed by the server.
- When a K/V item key name ends exactly at the end of the received
data, the type byte of the item value is read one byte past it.
- The frame length check may also overflow: it is computed as
4 + flen on a 32-bit value read from the wire, which wraps for a
length close to UINT32_MAX.
The bytes past the received data are stale buffer content: the parsing and
the check result are then driven by bytes never sent by the server.
The SPOP parser now validates the received data itself: a frame with no
payload is invalid (both the AGENT-HELLO and AGENT-DISCONNECT frames carry
at least one K/V item), the length comparison is made overflow-safe, and the
type byte of every K/V item value is only read when the payload is not fully
consumed. Truncated frames are reported as invalid instead of being parsed
from bytes never received.
It is a read past the received data, inside the check buffer, so it requires
a non-compliant agent, which is out of the threat model (servers are
trusted). There is no security impact, only a check status that depends on
stale data.
It should be backported to all supported versions.
BUG/MINOR: tcpcheck: fix out-of-bounds reads on truncated LDAP bind responses
The LDAP health-check relies on the min-recv parameter of the expect rule
matching the first byte of the bind response to guarantee enough data are
received before parsing the message. But this parameter is only honored
while data are still expected: on a FIN or a connection error, the last read
is already reached and the rule is evaluated on the received data only. A
truncated response may thus be parsed with fewer bytes than the parser
assumes:
- With a single byte received, the message size is read one byte past
the received data.
- With a message announcing a size lower than 4, the 4-byte comparison
on the message ID and the bindResponse tag reads up to 3 bytes past
the received data.
The bytes past the received data are stale buffer content: the parsing and
the check result are then driven by bytes never sent by the server.
The LDAP parser now validates the received data itself: the message size
must be received, and the message must be at least 5 bytes to cover the
message ID, the bindResponse tag and its length. Shorter responses are
reported as truncated.
It is a read past the received data, inside the check buffer, so it requires
a non-compliant server, which is out of the threat model (servers are
trusted). There is no security impact, only a check status that depends on
stale data.
It should be backported to all supported versions.
REGTEST: spoe: add large-frame tests for the applet and the mux
Two tests exercising a near-max-size SPOP frame (a 14000-byte
binary argument) through the SPOE applet and the SPOP mux:
- largeframe.vtc, on-frontend-tcp-request event carrying
req.payload(0,14000) sampled from a buffered 30KB request;
- groupframe.vtc, http-request send-spoe-group carrying req.body,
the rule yielding until the request is complete so args are
encoded from the fully buffered body.
Both rely on a protocol-correct python agent (spoa_largeframe.py),
mirroring encode_varint()/decode_varint() from
include/haproxy/intops.h. largeframe.vtc also uses a small raw
TCP client (lf_client.py) for the 30KB request.
REGTEST: spoe: fix the SPOP varint encoding in the mock agent
The mock agent implemented a LEB128-style variable-length
integer instead of the SPOP one: the continuation shift was
off by 16 on encode and the decode masked the continuation
bytes where the reference implementation adds their full
value. The echoed max-frame-size was thus wrong (14076 instead
of 16380 with the default tune.bufsize) and only passed the
negotiation because it stayed within the accepted range. With
a smaller tune.bufsize the test would fail.
Mirror encode_varint()/decode_varint() from
include/haproxy/intops.h. Validated against the C
implementation for all values below 2000 plus larger
boundaries.
Olivier Houchard [Thu, 19 Nov 2026 18:16:31 +0000 (19:16 +0100)]
BUG/MEDIUM: stick-tables: update the bucket's next_exp before releasing its lock
process_tables_expire() computes the next expiration date of a table's
bucket under the bucket's lock, but releases the lock (and frees the
expired entries) before replacing the bucket's next_exp with this date. In
this window, another thread may insert a new entry (under the bucket's
lock) and call stktable_requeue_exp() for it. If next_exp still holds the
old (past) date, stktable_requeue_exp() considers the table as already
queued early enough and does nothing. Then the expiration task replaces
next_exp with the later date it computed, possibly TICK_ETERNITY, and
repositions or removes the table from its tree accordingly. The new entry
then doesn't expire until some other activity on this table requeues it.
The window was widened by commit 3e25104a9 ("MEDIUM: stick-tables: Avoid
freeing elements while holding a lock") which moved the freeing of expired
entries there.
Let's set next_exp before releasing the bucket's lock, so that any
insertion performed after it sees the new value. Since entries are
inserted under this lock, the computed date covers every entry present
in the bucket, so a concurrent stktable_requeue_exp() may safely be
overwritten and a plain store is enough, the CAS is not needed anymore.
This was introduced in 3.3 by commit 8bc8a21b2 ("MEDIUM: stick-tables: Use
a per-shard expiration task") and must be backported to 3.3.
Willy Tarreau [Fri, 20 Nov 2026 10:47:43 +0000 (11:47 +0100)]
CLEANUP: tree-wide: remove unneeded dependencies on tools.h
110 files were including tools.h without needing it, despite this file
being large and coming itself with many dependencies. This patch removes
these includes or replaces them with smaller ones when appropriate. All
these files were successfully built.
This reduces the total preprocessed size by ~1%:
- before: 8643090 lines, 260047208 total bytes
- after: 8562136 lines, 258459721 total bytes
Willy Tarreau [Fri, 20 Nov 2026 10:25:29 +0000 (11:25 +0100)]
REORG: tools/intops: move the int-to-str conversion functions to intops as well
These functions come with statically allocated thread-local arrays that
are used to store the output values during conversions. But they're used
just like the str-to-int ones, so let's place them here. This comes with
the creation of intops-t.h for a few macro definitions used to define the
array sizes.
Willy Tarreau [Fri, 20 Nov 2026 10:06:27 +0000 (11:06 +0100)]
REORG: tools/intops: move the integer-specific functions from tools to intops
This was already the case for their declaration in intops.h instead of
tools.h, but we were still lacking an intops.c file, so everything
remained stuffed anywhere in tools.c, difficult to find.
This moves all the functions mentioned in intops.h from tools.c to a new
intops.c file. That's roughly 450 less lines in tools.c and a slightly
better organized file where it should be easier in the future to locate
the function one needs.
Willy Tarreau [Thu, 19 Nov 2026 16:26:44 +0000 (17:26 +0100)]
MINOR: tools: add some of the missing null-terminated integer parsers
We have a number of integer parsers depending on what delimits the
integer, but the null-terminated ones were still fairly limited,
especially when range checks were expected. This commit adds the
following parsers:
int str2irc(const char *str, int *ret);
int str2uirc(const char *str, uint *ret);
int str2lrc(const char *str, long *ret);
int str2ulrc(const char *str, ulong *ret);
int str2llrc(const char *str, llong *ret);
int str2ullrc(const char *str, ullong *ret);
The all return an error status like their equivalent length-defined
ones, with the returned value via a pointer. They stop on a null
character and return parsing error when non-digit chars appear in the
string, or when too large a number is being produced for the range.
Note that for now they're in tools.c and defined in intops.h because
other ones were done similarly, but all of these should move to a new
intops.c file.
Martin Mirchev [Wed, 18 Nov 2026 12:36:59 +0000 (20:36 +0800)]
BUG/MINOR: mux-h2: reject non-numeric values in the tune.h2 keywords
The tune.h2 numeric keywords are parsed with atoi(), so trailing garbage
and non-numeric values are silently accepted: "tune.h2.max-frame-size
16384x" sets 16384, "tune.h2.fe.max-total-streams x" and
"tune.h2.fe.glitches-threshold x" set 0, which means "unlimited" for both,
"tune.h2.header-table-size 8192k" sets 8192 and a missing glitches value
is taken as 0. The same applies to initial-window-size,
max-concurrent-streams (including its "rq-load" and "min" values) and the
max-{frames,rst}-at-once keywords, where a negative value is also silently
turned into a huge unsigned limit.
Parse these values with strtol() and reject empty values, trailing
characters and values that do not fit in an int, keeping the existing
range checks and error messages. max-{frames,rst}-at-once now also reject
negative values.
mqtt_is_valid() and the mqtt_field_value() converter accept several
messages the specifications forbid:
- a CONNECT with the Will QoS set to 3. The only check rejected the
case where both QoS bits are set without the Will flag, so neither
"Will QoS 3 with Will" nor "Will QoS 1 or Will Retain without Will"
was caught (MQTT 3.1.1 3.1.2.6/3.1.2.7, MQTT 5.0 3.1.2.6/3.1.2.7);
- an MQTT 3.1.1 CONNECT with the Password flag but not the User Name
flag (MQTT 3.1.1 3.1.2.9; MQTT 5.0 allows it, so only 3.1.1 is
checked);
- an MQTT 3.1.1 CONNACK with a return code above 5, e.g. 200 (MQTT
3.1.1 3.2.2.3 only defines 0 to 5).
For example mqtt_is_valid returns 1 for a 3.1.1 CONNECT with flags 0x1c
or 0x40, and for a 3.1.1 CONNACK "20 02 00 c8". Reject these messages.
Martin Mirchev [Wed, 18 Nov 2026 12:34:24 +0000 (20:34 +0800)]
BUG/MINOR: mux-spop: match the AGENT-HELLO and AGENT-DISCONNECT keys exactly
The K/V keys of the AGENT-HELLO and AGENT-DISCONNECT frames are compared
with "sz >= strlen(KEY) && !memcmp(str, KEY, strlen(KEY))", which is a
prefix match: an agent sending "max-frame-size-bogus" (or "versionX",
"capabilitiesX", "status-codeX") has the item treated as the mandatory
one. With an invalid value under "max-frame-size-bogus", haproxy closes the
connection with "max-frame-size too big or too small", exactly as for the
real key, while a key sharing no prefix is ignored as it should be.
Compare the whole key instead. The commented-out "message" check is
updated the same way.
This should be backported to all versions with mux-spop (3.1+).
Willy Tarreau [Thu, 19 Nov 2026 14:57:15 +0000 (15:57 +0100)]
BUG/MINOR: intops: reject varints that do not fit in 64 bits in decode_varint()
decode_varint() accepts any number of continuation bytes. From the 11th
byte on, the shift count exceeds 63, which is undefined behaviour (UBSan:
"shift exponent 67 is too large for 64-bit type"), and a 10-byte varint
whose last byte is above 15 silently wraps: a value >= 2^64 is decoded
modulo 2^64. For example an SPOP agent sending the AGENT-HELLO
max-frame-size as f0 ff ff ff ff ff ff ff ff 7f has it decoded as 2314921131297212640 instead of being rejected.
In order to avoid adding costly checks in the inner loop, let's only
process the first 9 bytes as usual in the current loop and make a
special case of the 10th byte where we add an overflow check if ever
met.
This should be backported to all stable versions.
Reported-by: Martin Mirchev <mirchevmartin2203@gmail.com> Co-authored-by: Martin Mirchev <mirchevmartin2203@gmail.com>
Martin Mirchev [Wed, 18 Nov 2026 03:33:04 +0000 (11:33 +0800)]
BUG/MINOR: resolvers: reject DNS messages without the QR bit
resolv_validate_dns_response() checks the query ID, the RCODE, the
question and the records, but not the QR bit, which tells a response
(1) from a query (0). A message with QR=0 is thus processed as a
response: one carrying the same answer as a valid response is accepted,
and the query itself, if it comes back from the nameserver's address
(e.g. through an echo or a forwarding loop), is processed as a response
without any answer.
The sender still has to match the nameserver address, the query ID and
the question, so this does not make spoofing easier, but such a message
is not a response and should be treated as invalid, as RFC 1035 defines
the QR bit for this purpose.
This patch adds DNS_FLAG_RESPONSE and makes such messages invalid. The
new reg-test reg-tests/resolvers/response_flag.vtc uses a small DNS
fixture that sends the same A answer with and without the QR bit, and
checks that only the former resolves and that the latter is counted as
invalid.
Martin Mirchev [Wed, 18 Nov 2026 03:25:34 +0000 (11:25 +0800)]
BUG/MINOR: net_helper: accept an Ethernet header ending with the protocol
The eth.data, eth.hdr, eth.proto and eth.vlan converters walk the
Ethernet header with "idx + 2 < data", which requires at least one byte
after the 2-byte protocol field. An input that ends exactly with the
header is thus reported as incomplete, so eth.proto and eth.vlan return
nothing on the output of eth.hdr: "eth.hdr,eth.proto" never works, and
neither does any frame truncated right after the protocol field.
The protocol field is complete when idx + 2 <= data, so let's use this
condition in the 4 loops. Frames that carry data after the header are
not affected. The net_helper reg-test now checks eth.hdr followed by
eth.proto and eth.vlan.
Martin Mirchev [Wed, 18 Nov 2026 03:25:19 +0000 (11:25 +0800)]
BUG/MINOR: net_helper: check the TCP option length before reading its value
tcp_fullhdr_find_opt() only checks that an option fits in the TCP header
and has a length of at least 2, so the tcp.options.mss, tcp.options.tsval
and tcp.options.wscale converters read their value from the bytes that
follow the option when its length field is too small. With a 24-byte
header ending with "NOP NOP 02 02" followed by the payload 0x12 0x34,
tcp.options.mss returns 4660, and with "NOP NOP 03 02" followed by 0xaa,
tcp.options.wscale returns 170. When the option is the last one and
nothing follows the header, the value is read past the end of the input
sample (by up to 4 bytes for tsval).
This patch makes these 3 converters ignore the option when its length is
not the one defined for it (4 for MSS, 10 for TimeStamp, 3 for Window
Scale), as when the option is absent, so that they return 0 in this case. A new
reg-test, reg-tests/converter/net_helper.vtc, checks these cases.
BUG/MINOR: ocsp: fix NULL dereference when the OCSP responder sends no header
Both OCSP response handlers look for a "Content-Type" header in the
response received from the responder by iterating over hc->res.hdrs
until they reach the end-of-array marker. But this array is only
allocated when the response contains at least one header so the array
may be NULL.
This is reachable in production as soon as the OCSP auto-update is
enabled. Any responder which answers with a header-less HTTP/1.0
response (a plain error page, a minimal embedded server, a proxy that
strips the headers) crashes the worker. The same issue applies to the
client-certificate OCSP check used by the "do-ocsp-request" action,
where the request is sent to the URI found in the client certificate.
BUG/MINOR: httpclient/cli: fix NULL dereference when the response has no header
The CLI "httpclient" command (expert mode) displays the response status
line, then its headers, then its body. The httpclient applet only
allocates the response headers array when the response contains at least
one header.
A response without any header is perfectly legal for HTTP/1.0, so any
server which answers a header-less response crashes the process when the
"httpclient" command is used against it. Only an admin can run this
command, so it cannot be triggered by untrusted input and stays MEDIUM,
but a crash remains a crash for users who rely on this command to probe
their backends.
Amaury Denoyelle [Thu, 19 Nov 2026 15:19:14 +0000 (16:19 +0100)]
MINOR: ssl/quic: mark hq-interop QUIC ALPN as experimental
hq-interop in ALPN corresponds to HTTP/0.9 layer. This protocol is
reserved for QUIC interop testing and must not be active in production.
Introduces a new global keyword 'tune.quic.interop'. It may be set to
either 'fe' or 'off', anticipating a future 'be' value for backend
support. The keyword parsing forces users to activate experimental
directives.
The second part of this patch is in ALPN keyword parsing. If hq-interop
is found but 'tune.quic.interop fe' is not set, an error is reported.
This parser may also run at runtime for dynamic crt-list loading. In
this case, 'hq-interop' token is silently removed if present.
For now, nothing is performed on the server-side. This is because QUIC
backend is still incomplete and is itself experimental.
Amaury Denoyelle [Fri, 20 Nov 2026 08:42:24 +0000 (09:42 +0100)]
MINOR: ssl: allow prefix lookup for alpn_remove_token()
Extend alpn_remove_token() by adding an extra boolean argument <prefix>.
This changes how ALPN entries are compared, so that strings are
considered as matching if they begin with the specified value.
This will allow clearing ALPNs which may take various suffixes, for
example for hq-interop/h3 with an IETF draft version.
BUG/MINOR: ssl/cli: use the right list member in "add ssl crt-list" release
cli_release_add_crtlist() walks the crtlist_entry's list of ckch_inst with
the "by_ckchs" list member instead of "by_crtlist_entry". Since
list_for_each_entry_safe() re-bases each node with the offset of the given
member, walking a list whose elements are chained through
"by_crtlist_entry" using the offset of "by_ckchs" produces a bogus struct
ckch_inst pointer, which is then passed to ckch_inst_free(). The latter
writes through it (LIST_DELETE on both members and free()), so this is
not just a wild read but real memory corruption.
This happens when "add ssl crt-list" fails after at least one ckch_inst
was already generated and appended to the entry being added (e.g. a later
bind_conf failing to instantiate), in which case the worker dies with a
SIGSEGV during the cleanup of the discarded entry. This requires ADMIN
CLI access so it stays out of the threat model, but it is a crash of the
worker triggered by a legitimate command.
Use "by_crtlist_entry" like every other walk of this list in the same
file (crtlist_entry_free() and both loops of the delete handler). The bug
is present since the introduction of the command in 2.2 (e67c80be7f
"MEDIUM: ssl/cli: 'add ssl crt-list' command"), so every maintained
branch is affected, but the fix applies cleanly everywhere as this code
never changed since.
This should be backported in every stable branches.
BUG/MINOR: ech: keep CLI success messages alive until printed
The add, set and del ssl ech parsers build their success messages in local
stack buffers and pass them to cli_msg(). This helper only stores the
pointer: the CLI applet prints it after the parser returns, when the
buffer is already out of scope. The success response is therefore read
through a dangling pointer.
Allocate these messages with memprintf() and transfer ownership to
cli_dynmsg(), which frees them after printing or on connection teardown.
Remove the now-unused fixed message size.
Reported by Bruno Henc (@brhenc) in issue #3589.
Fixes issue #3589.
This should be backported to 3.3 and 3.4.
BUG/MEDIUM: jwt: Use JWT cert tree for jwt_decrypt
The jwt_decrypt converters have the same issue as the jwt_verify one,
they were taking the ckch_lock during runtime processing which could
fail in case the lock was already taken by a CLI operation.
We now make use of the already existing jwt tree to store the private
keys used in the decrypt operations. The only lock taken during runtime
is the jwt tree one which also gets locked in write mode while updating
certificates via the CLI or changing the jwt mode ("add/del ssl jwt").
This patch is a continuation of "BUG/MEDIUM: jwt: Use only JWT cert tree
for jwt_verify", it helps fix for good the issue decribed in GitHub
issue #3526. It relies on "MINOR: jwt: Add rwlock to jwt_cert_tree" as
well.
BUG/MEDIUM: jwt: Use only JWT cert tree for jwt_verify
The jwt_verify converter can either used a public key that was already
stored in a dedicated tree built during init that did not require any
lock, or use a certificate loaded in the ckch_store tree. The main issue
in this second case is that we needed to take the ckch_lock during
runtime but this spinlock is also taken during all CLI commands that
modify the certificates (and can last a long time when a lot of chck
instances are rebuilt for instance).
We now store the public keys used by jwt_verify in the JWT certificate
tree for all code paths instead of looking them up in the CKCH tree. We
keep the tree entry in sync when certificates are loaded, replaced,
removed, or when the "jwt" option is toggled through the CLI. In those
cases, the lock on the JWT tree in only taken while the tree gets
updated, during the ckch_store_replace call.
A keyless entry is also created for certificates whose "jwt" option is
disabled so that jwt_verify can still report JWT_VRFY_UNAVAIL_CERT (-7)
instead of JWT_VRFY_UNKNOWN_CERT (-5).
This patch relies on "MINOR: jwt: Add rwlock to jwt_cert_tree". It
fixes the issue described in GitHub #3526 (and raised by some IA models
as well).
The jwt_cert_tree that stores pure public keys loaded during init and is
used by the jwt_verify converter was never locked since we only appended
entries during init and never modified them during runtime.
In future commits its usage will be extended so it will need a locking
mechanism. The tree will only change following CLI updates so a rwlock
should do the job since mos of the work will be done under a read lock
only.
BUG/MEDIUM: log/tools: fix cbor binary integer encoding regression with x86_64 systems
A regression was introduced in commit c1abbb11f ("OPTIM: log/tools:
switch from function pointer design to dual mode HEX/BIN design for
CBOR encoding").
Indeed, it was assumed that for x86_64 systems that the byte order
for uint64_t was already correct and that the value could be written
as-is. This is totally wrong, because x86_64 is little endian while
CBOR is big endian. Because of this mistake, values greater than 24
were written in reverse/incorrect order when using
cbor_encode_uint64_prefix_bin().
To fix the issue, instead of completely ditching the fast-path,
let's leverage htons, htonl and my_htonll for 2, 4 and 8 bytes
value respectively (since the value length is known under the
function), as they are less expensive than writing the value 1
byte at a time.
Many thanks to Dragan Dosen and Martin Mirchev for having reported the
issue.
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.