]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: httpclient-cli: Don't try to dump raw headers in HTX mode
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 22 Jul 2025 13:17:50 +0000 (15:17 +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, we must not try to
push raw headers in HTX mode, because there is no raw data in this
mode. This prevent the HTX dump at the end of the I/O handle.

It is a 3.3-specific issue. No backport needed.

src/httpclient_cli.c

index 1b41c9214ceaccc52e5fa6b8021dfa186614e592..1f96c836986e88ab852c11ae4b4dd84583a22647 100644 (file)
@@ -197,8 +197,8 @@ static int hc_cli_io_handler(struct appctx *appctx)
        }
 
        if (ctx->flags & HC_F_RES_HDR) {
-               chunk_reset(&trash);
                if (!ctx->is_htx) {
+                       chunk_reset(&trash);
                        hdrs = hc->res.hdrs;
                        for (hdr = hdrs; isttest(hdr->v); hdr++) {
                                if (!h1_format_htx_hdr(hdr->n, hdr->v, &trash))
@@ -206,9 +206,9 @@ static int hc_cli_io_handler(struct appctx *appctx)
                        }
                        if (!chunk_memcat(&trash, "\r\n", 2))
                                goto too_many_hdrs;
+                       if (applet_putchk(appctx, &trash) == -1)
+                               goto more;
                }
-               if (applet_putchk(appctx, &trash) == -1)
-                       goto more;
                ctx->flags &= ~HC_F_RES_HDR;
        }