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.
This commit is contained in:
Christopher Faulet 2022-04-29 13:56:12 +02:00
parent 534645d6c0
commit 6b4f1f64a8

View 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 */