MEDIUM: htx: Refactor htx_xfer_blks() to not rely on hdrs_bytes field
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 22 Apr 2021 07:45:18 +0000 (09:45 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 28 Apr 2021 08:51:08 +0000 (10:51 +0200)
commitc92ec0ba7102f93d91422c1d2edfb09f1eea2bd5
treeeb970cccba6cd8ac3c6b02a74c3b883943008c9a
parent5e9b24f4b4e31958d97ce445bb993feb7ebc1421
MEDIUM: htx: Refactor htx_xfer_blks() to not rely on hdrs_bytes field

It is the only function using the hdrs_bytes start-line field. Thus the
function has been refactored to no longer rely on it. To do so, we first
copy HTX blocks to the destination message, without removing them from the
source message. If the copy is interrupted on headers or trailers, we roll
back. Otherwise, data are drained from the source buffer.

Most of time, the copy will succeeds. So the roll back is only performed in
the worst but very rare case.
src/htx.c