]> git.kaiwu.me - haproxy.git/commit
MINOR: htx: Add the block type as argument of the data insertion functions
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 15 Sep 2026 11:58:52 +0000 (13:58 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 18 Sep 2026 15:05:18 +0000 (17:05 +0200)
commit375ff02bdac6095d211f4579b488e6fee9bf391b
tree660bb682c6bdcad469b2c919895d06cf470e64ea
parentcfb8f949cbc01e03976bcd546cf3b3b50a3e59a2
MINOR: htx: Add the block type as argument of the data insertion functions

htx_add_data() was renamed into htx_add_data_type() and takes the block type
as extra argument. htx_add_data() is now a thin wrapper on it, passing
HTX_BLK_DATA. The tests on the tail block type were changed accordingly to
be performed against the type of the block to add, instead of hardcoding
HTX_BLK_DATA.

The same was done for the "atonce" version. __htx_add_data_atonce() was
renamed into __htx_add_data_type_atonce() and also takes the block type as
extra argument. A public and guarded version, htx_add_data_type_atonce(), was
added on top of it and htx_add_data_atonce() is now a thin wrapper on this
one, passing HTX_BLK_DATA. Note htx_add_last_data() still relies on the
private and unguarded version because it must be able to insert a block after
the one carrying the end of the message, before moving it at the right
place. It remains dedicated to regular DATA blocks.

Finally, htx_defrag() was updated to pass the block type. This way, RAW_DATA
blocks are merged when a message is defragmented, exactly like DATA blocks.
Otherwise they would be copied one by one, keeping a block per received
chunk.

This way, RAW_DATA blocks will be able to be inserted using the same
functions, and thus the same logic to append data to the tail block or to
deal with the free space in the message.

There is no change of behavior. Only HTTP data can be added for now.
include/haproxy/htx.h
src/htx.c