BUG/MEDIUM: http-client: Fix the test on the response start-line

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.
This commit is contained in:
Christopher Faulet 2025-09-19 14:51:32 +02:00
parent 5c299dee5a
commit 331689d216

View 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);