]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: cache: report the end of message via HTX after a zero-copy forwarding
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 2 Dec 2026 16:53:30 +0000 (17:53 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 3 Dec 2026 12:41:06 +0000 (13:41 +0100)
commiteeda000416d2dfe9a570f1f77ec06fec26830d77
tree1d89483e60c7b75e03bb746beac147aba41ec52a
parent678fbe8200c569f5e333d8c5f781624266180b67
BUG/MEDIUM: cache: report the end of message via HTX after a zero-copy forwarding

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

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

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

This patch must be backported as far as 3.0.
reg-tests/cache/zero_copy_eom.vtc [new file with mode: 0644]
src/cache.c