From: Christopher Faulet Date: Fri, 29 Apr 2022 11:56:12 +0000 (+0200) Subject: BUG/MINOR: httpclient: Count metadata in size to transfer via htx_xfer_blks() X-Git-Tag: v2.6-dev8~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6b4f1f64a8641a02be8565c324cb355ef578162c;p=thirdparty%2Fhaproxy.git BUG/MINOR: httpclient: Count metadata in size to transfer via htx_xfer_blks() When HTX blocks are transfer from the HTTP client context to the request channel, via htx_xfer_blks() function, the metadata must also be counted, in addition to the data size. Otherwise, expected payload size will not be copied because the metadata of an HTX block (8 bytes) will be reserved. And if the payload size is lower than 8 bytes, nothing will be copied. Thus only a zero-copy will be able to copy the payload. This issue is 2.6-specific, no backport is needed. --- diff --git a/src/http_client.c b/src/http_client.c index 6cc61b21af..f99bdae8a3 100644 --- a/src/http_client.c +++ b/src/http_client.c @@ -716,7 +716,7 @@ static void httpclient_applet_io_handler(struct appctx *appctx) } else { struct htx_ret ret; - ret = htx_xfer_blks(htx, hc_htx, hc_htx->data, HTX_BLK_UNUSED); + ret = htx_xfer_blks(htx, hc_htx, htx_used_space(hc_htx), HTX_BLK_UNUSED); channel_add_input(req, ret.ret); /* we must copy the EOM if we empty the buffer */