]> git.kaiwu.me - haproxy.git/commit
MEDIUM: htx: Allow tunneled data to be added in a message already ended
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 15 Sep 2026 11:59:32 +0000 (13:59 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 18 Sep 2026 15:05:19 +0000 (17:05 +0200)
commit78b41149b7842b81ca12b3ce49d6b278759f4f18
tree50990d54936b8f0273a123f1b525a77578d07baf
parent7115ab11b1f24af0209c30147b4d9e0d2626e74f
MEDIUM: htx: Allow tunneled data to be added in a message already ended

For a tunneled stream, the end of the HTTP message is reported just after
the headers. It is an "early" EOM: from the HTTP point of view the message
is finished and only tunneled data may be exchanged then. But nothing may be
added in a message already ended, otherwise the end of the message would no
longer be reported on the tail block.

Now tunneled data have their own block type, they can be added in a message
already ended without breaking this rule. htx_add_raw_data() was added for
that purpose. It is the only function able to add a block in such message,
and the corresponding BUG_ON() were relaxed accordingly.

htx_msg_ended() was updated to also report the end of the message when the
tail block is a RAW_DATA block. Indeed, tunneled data may only be found
after the end of the message. So, if there are some, the end of the message
was necessarily seen. Either the block carrying the flag is still in the HTX
message, or it was already consumed. In this last case, it is the consumer
responsibility to remember it.

Finally, the test on the end of the message was removed from htx_xfer()
because blocks are transferred one by one, using the safe functions. So
invalid additions are detected there, with a better accuracy.
include/haproxy/htx.h
src/htx.c