From 6b4f1f64a8641a02be8565c324cb355ef578162c Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Fri, 29 Apr 2022 13:56:12 +0200 Subject: [PATCH] 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. --- src/http_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/http_client.c b/src/http_client.c index 6cc61b21a..f99bdae8a 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 */