From: Christopher Faulet Date: Tue, 8 Jul 2025 06:57:16 +0000 (+0200) Subject: BUG/MINOR: http-client: Reject any 101-switching-protocols response X-Git-Tag: v3.0.12~83 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=7847ff21b075392279104e09840294d093b368bf;p=haproxy-3.0.git BUG/MINOR: http-client: Reject any 101-switching-protocols response Protocol updages are not supported by the http-client. So report an error is a 101-switching-protocols response is received. Of course, it is unexpected because the API is not designed to support upgrades. But it is better to properly handle this case. This patch could be backported as far as 2.6. It depends on the commit "BUG/MINOR: http-client: Ignore 1XX interim responses in non-HTX mode". (cherry picked from commit 8ba754108d70d25d796e3dc166155503aab180b2) Signed-off-by: Amaury Denoyelle (cherry picked from commit 0bfaef56d630a355d85fcdf2b733e479fee8595b) Signed-off-by: Christopher Faulet (cherry picked from commit 31ff75c23d25eb6b10dbe9f1af09e63083428df2) Signed-off-by: Christopher Faulet --- diff --git a/src/http_client.c b/src/http_client.c index d8d33bf..3a239a8 100644 --- a/src/http_client.c +++ b/src/http_client.c @@ -835,8 +835,11 @@ void httpclient_applet_io_handler(struct appctx *appctx) goto out; /* Skipp any 1XX interim responses */ - if (sl->info.res.status < 200 && - (sl->info.res.status == 100 || sl->info.res.status >= 102)) { + if (sl->info.res.status < 200) { + /* Upgrade are not supported. Report an error */ + if (sl->info.res.status == 101) + goto error; + while (blk) { enum htx_blk_type type = htx_get_blk_type(blk); uint32_t sz = htx_get_blksz(blk);