]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: http-client: Fix the test on the response start-line
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 19 Sep 2025 12:51:32 +0000 (14:51 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 19 Sep 2025 12:59:28 +0000 (14:59 +0200)
The commit 88aa7a780 ("MINOR: http-client: Trigger an error if first
response block isn't a start-line") introduced a bug. From an endpoint, an
applet or a mux, the <first> index must never be used. It is reserved to the
HTTP analyzers. From endpoint, this value may be undefined or just point on
any other block that the first one. Instead we must always get the head
block.

In taht case, to be sure the first HTX block in a response is a start-line,
we must use htx_get_head_type() function instead of htx_get_first_type().
Otherwise, we can trigger an error while the response is in fact properly
formatted.

It is a 3.3-speific issue. cNo backport needed.

src/http_client.c

index d72d75ba34a65dd581e5c298a7790c55a0c78853..7e6c805e5fd921a557e9136e91e04754547156a4 100644 (file)
@@ -653,7 +653,7 @@ void httpclient_applet_io_handler(struct appctx *appctx)
 
                                /* copy the start line in the hc structure,then remove the htx block */
                                htx = htxbuf(inbuf);
-                               if (htx_get_first_type(htx) != HTX_BLK_RES_SL)
+                               if (htx_get_head_type(htx) != HTX_BLK_RES_SL)
                                        goto error;
                                blk = DISGUISE(htx_get_head_blk(htx));
                                sl = htx_get_blk_ptr(htx, blk);