]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: mux-h1: don't lose the end of the previous chunk in h1_make_chunk()
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 7 Oct 2026 09:24:06 +0000 (11:24 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 16 Oct 2026 17:10:27 +0000 (19:10 +0200)
commit990ae4d6addbee27369f2feb788e84695f2c6879
tree5ff31d131423a9b8aa699dff631f972cfc2b00d1
parent87112fdea2050e41902d8d1b2f9608e12f7c3a21
BUG/MEDIUM: mux-h1: don't lose the end of the previous chunk in h1_make_chunk()

h1_make_chunk() is used during zero-copy forwarding to emit the chunk size
line of the next chunk, preceded by the CRLF ending the previous chunk when
the message is in H1_MSG_CHUNK_CRLF state. Both are written into a temporary
view of the output buffer which is only committed on success. But the state
was switched to H1_MSG_CHUNK_SIZE as soon as the CRLF was written into this
view. So if the chunk size line itself did not fit, the function returned on
the "full" path without committing anything, while the state indicated that
the CRLF was already emitted.  On the next attempt, the chunk size was
emitted directly after the previous chunk's data, without the CRLF,
producing an invalid chunked message.

Now the state is only changed once both the CRLF and the chunk size were
successfully written.

This was introduced by commit 6dff013fa ("MINOR: mux-h1: Add function to add
size of a chunk to an outgoind message") in 2.9. It must be backported as
far as 3.0.
src/mux_h1.c