From: Christopher Faulet Date: Fri, 29 Apr 2022 12:09:03 +0000 (+0200) Subject: MINOR: httpclient: Don't use co_set_data() to decrement output X-Git-Tag: v2.6-dev8~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0055d5693e8ba1c21bae7a231506945cdf8b81d9;p=thirdparty%2Fhaproxy.git MINOR: httpclient: Don't use co_set_data() to decrement output The use of co_set_data() should be strictly limited to setting the amount of existing data to be transmitted. It ought not be used to decrement the output after the data have left the buffer, because doing so involves performing incorrect calculations using co_data() that still comprises data that are not in the buffer anymore. Let's use c_rew() for this, which is made exactly for this purpose, i.e. decrement c->output by as much as requested. --- diff --git a/src/http_client.c b/src/http_client.c index f99bdae8a3..e12d556e0f 100644 --- a/src/http_client.c +++ b/src/http_client.c @@ -765,7 +765,7 @@ static void httpclient_applet_io_handler(struct appctx *appctx) hc->res.vsn = istdup(htx_sl_res_vsn(sl)); hc->res.reason = istdup(htx_sl_res_reason(sl)); sz = htx_get_blksz(blk); - co_set_data(res, co_data(res) - sz); + c_rew(res, sz); htx_remove_blk(htx, blk); /* caller callback */ if (hc->ops.res_stline)