An Extended CONNECT (RFC8441) is converted to an upgrade request for an
H1 server, and a 101 response is converted to a 200, meaning that the
tunnel is established. But if the server ignores the upgrade and returns
a regular 2xx, it was forwarded as-is, so the client considered the
tunnel as established and took the payload for tunneled data.
Let's handle such a response as an error, as is already done for a 101
without Extended CONNECT.
This was introduced in 2.4 by commit
efe2276a9 ("MEDIUM: mux_h2:
generate Extended CONNECT response") and must be backported to all
supported versions.
goto fail;
}
}
+ else if (unlikely(h2s->flags & H2_SF_EXT_CONNECT_RCVD) &&
+ h2s->status >= 200 && h2s->status < 300) {
+ /* no 101 from the server: a 2xx would mean the tunnel is established */
+ TRACE_ERROR("upgrade not performed by the server, reject the 2xx response to Extended CONNECT", H2_EV_TX_FRAME|H2_EV_TX_HDR|H2_EV_H2S_ERR, h2c->conn, h2s);
+ goto fail;
+ }
else if ((h2s->flags & H2_SF_BODY_TUNNEL) && h2s->status >= 300) {
/* Abort the tunnel attempt */
h2s->flags &= ~H2_SF_BODY_TUNNEL;