]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: httpclient: Count metadata in size to transfer via htx_xfer_blks()
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 29 Apr 2022 11:56:12 +0000 (13:56 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 29 Apr 2022 12:12:42 +0000 (14:12 +0200)
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

index 6cc61b21afdeb1a726144136d7e11f444c690492..f99bdae8a30f0a6d7acb04055ab7ed18e6bcfbf2 100644 (file)
@@ -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 */