]> git.kaiwu.me - haproxy.git/commit
MINOR: htx: Add a noop block to carry the EOM flag on an empty message
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 20 Nov 2026 16:02:29 +0000 (17:02 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 23 Nov 2026 13:33:30 +0000 (14:33 +0100)
commit221c40bbf857ef0ba1feb7771e7aad4ea4a86bb9
tree1cebb7bc35b0d8f801cdcade7dfaae3fd37d5abb
parent0ddd6a4b278a9af2be0c219226475eabe2545efe
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.
include/haproxy/htx-t.h
include/haproxy/htx.h
src/flt_http_comp.c
src/h3.c
src/mux_fcgi.c
src/mux_h1.c
src/mux_h2.c