]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: httpclient-cli: Reset httpclient HTX buffer instead of removing blocks
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 22 Jul 2025 13:18:46 +0000 (15:18 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 24 Jul 2025 10:06:48 +0000 (12:06 +0200)
In the CLI I/O handler interacting with the HTTP client, in HTX mode, after
a dump of the HTX message, data must be removed. Instead of removng all
blocks one by one, we can call htx_reset() because all the message must be
flushed.

src/httpclient_cli.c

index 1f96c836986e88ab852c11ae4b4dd84583a22647..16a851dd172e8387a409fc442dc372bbe960777a 100644 (file)
@@ -223,15 +223,11 @@ static int hc_cli_io_handler(struct appctx *appctx)
        }
 
        if (ctx->is_htx && hc_htx) {
-               struct htx_blk *blk = NULL;
-
                chunk_reset(&trash);
                htx_dump(&trash, hc_htx, 1);
                if (applet_putchk(appctx, &trash) == -1)
                        goto more;
-               blk = htx_get_head_blk(hc_htx);
-               while (blk)
-                       blk = htx_remove_blk(hc_htx, blk);
+               htx_reset(hc_htx);
                htx_to_buf(hc_htx, &hc->res.buf);
 
        }