BUG/MEDIUM: http-client: Properly inc input data when HTX blocks are xferred
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 8 Jul 2025 06:04:01 +0000 (08:04 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 1 Oct 2025 13:42:17 +0000 (15:42 +0200)
commit55b5cad454d66f09833a30f2531d8bb9e175dc48
tree1350ff9a12b3994f75a43ab0d7b516ec1a91fe32
parentc85b1408d222682d04fa7432904f248b4a66232f
BUG/MEDIUM: http-client: Properly inc input data when HTX blocks are xferred

When HTX blocks from the requests are transferred into the channel buffer,
the return value of htx_xfer_blks() function must not be used to increment
the channel input value because meta data are counted here while they are
not part of input data. Because of this bug, it is possible to forward more
data than these present in the channel buffer.

Instead, we look at the input data before and after the transfer and the
difference is added.

It is only an issue with large POSTs, when the payload is streamed.

This patch must be backported as far as 2.6.

(cherry picked from commit d9ca8f6b71cd17bae0718f0b1e9da919fc00264d)
Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com>
(cherry picked from commit 208ef1d7aebc11133e8c64966be475a521da5409)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 90167928a38f05680852fd0943b86ef66496ee18)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/http_client.c