From: Olivier Houchard Date: Tue, 17 Nov 2026 15:37:38 +0000 (+0100) Subject: BUG/MEDIUM: mux-h2: don't abort a tunnel attempt on interim responses X-Git-Tag: v3.5-dev13~29 X-Git-Url: https://git.kaiwu.me/web/%22data:,/doc/static/%7B@url%7D?a=commitdiff_plain;h=65ebeb19c3e7f354cc3b14485997c28b64a5325e;p=haproxy.git BUG/MEDIUM: mux-h2: don't abort a tunnel attempt on interim responses On the backend side, when a CONNECT or an Extended CONNECT request was sent, h2c_dec_hdrs() aborts the tunnel attempt as soon as a response without H2_MSGF_BODY_TUNNEL is received. But h2_make_htx_response() clears this flag for any status other than 2xx and 101, including interim responses (1xx) such as 100 Continue or 103 Early Hints. H2_SF_BODY_TUNNEL is then removed and H2_SF_TUNNEL_ABRT set, so that the final 200 response is processed as a regular response with a body. The client receives the interim and the final responses, but the connection is closed as soon as data are exchanged. This breaks CONNECT and WebSocket (Extended CONNECT) through H2 servers emitting interim responses. Let's only abort the tunnel attempt on final responses. This has been there since 2.4 with commit d0db42326 ("MINOR: mux-h2: Add 2 flags to help to properly handle tunnel mode") and must be backported to all stable versions. --- diff --git a/src/mux_h2.c b/src/mux_h2.c index 96207a16e..2e18eea3f 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -6547,8 +6547,8 @@ next_frame: if (msgf & H2_MSGF_BODY_TUNNEL) *flags |= H2_SF_BODY_TUNNEL; - else { - /* Abort the tunnel attempt, if any */ + else if (!(msgf & H2_MSGF_RSP_1XX)) { + /* Abort the tunnel attempt, if any, on a final response */ if (*flags & H2_SF_BODY_TUNNEL) *flags |= H2_SF_TUNNEL_ABRT; *flags &= ~H2_SF_BODY_TUNNEL;