]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: http-fetch: only defrag HTX message with payload when fetching body
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 26 Nov 2026 19:36:17 +0000 (20:36 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 27 Nov 2026 11:01:36 +0000 (12:01 +0100)
commit63935e2fed495756911b0e034eacb848ec989beb
treee8361ad7d8ba2cc429add048fec5caa6e092b345
parent47521745280e2570f68b8a1ef1153a26acc5cb81
BUG/MINOR: http-fetch: only defrag HTX message with payload when fetching body

In smp_fetch_body() and smp_fetch_body_param(), the defragmentation was
performed as soon as the HTX message was fragmented or unordered, or when
its free space was wrapping, without checking if the message had a payload.
In practice, it means a full HTX defragmentation was done for any bodyless
request or response when the HTX message was fragmented, which may happen
for instance after a header removal.

Now, the defragmentation is only performed if the message contains payload,
i.e. if the tail block type is higher than or equal to HTX_BLK_DATA. It is
not a strict check, but it is a cheap one, and messages with a single DATA
block never require a defragmentation anyway, since a single DATA block is
always contiguous.

This bug was introduced in 3.4 with the commit ee309bafc ("MINOR:
http-fetch: Use pointer to HTX DATA block when retrieving HTX body"). It
must be backported as far as 3.4.
src/http_fetch.c