]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: connection: don't use the cached ALPN if SSL_NO_CACHED_INFO
authorOlivier Houchard <ohouchard@haproxy.com>
Fri, 27 Nov 2026 13:12:13 +0000 (14:12 +0100)
committerOlivier Houchard <cognet@ci0.org>
Fri, 27 Nov 2026 13:05:55 +0000 (14:05 +0100)
conn_select_mux_be() and conn_install_mux_be() fall back to the ALPN
cached in the server when the connection has none, even when the
connection has CO_FL_SSL_NO_CACHED_INFO. A websocket connection that
only offers http/1.1 to a server which then selects no ALPN gets an H2
mux if the regular connections negotiated h2, and the request ends in a
502.

Let's not use the cache for those connections. This should help with
github issue #3473, and must be backported to 3.3.

src/connection.c

index 2090087a591dd6fd3eeff6018aa08b57b2101549..e2ac22eddcdfa0d189a55695cc3ca93986a8a4d9 100644 (file)
@@ -425,7 +425,8 @@ const struct mux_proto_list *conn_select_mux_be(const struct connection *conn)
                        return srv->mux_proto;
 
                if (!conn_get_alpn(conn, &alpn_str, &alpn_len)) {
-                       if (srv && srv->path_params.nego_alpn[0]) {
+                       if (srv && !(conn->flags & CO_FL_SSL_NO_CACHED_INFO) &&
+                           srv->path_params.nego_alpn[0]) {
                                alpn_str = srv->path_params.nego_alpn;
                                alpn_len = strlen(alpn_str);
                        }
@@ -466,7 +467,8 @@ int conn_install_mux_be(struct connection *conn, void *ctx, struct session *sess
                int mode = conn_pr_mode_to_proto_mode(srv->proxy->mode);
 
                if (!conn_get_alpn(conn, &alpn_str, &alpn_len)) {
-                       if (srv && srv->path_params.srv_hash == conn->hash_node.key && srv->path_params.nego_alpn[0]) {
+                       if (srv && !(conn->flags & CO_FL_SSL_NO_CACHED_INFO) &&
+                           srv->path_params.srv_hash == conn->hash_node.key && srv->path_params.nego_alpn[0]) {
                                alpn_str = srv->path_params.nego_alpn;
                                alpn_len = strlen(alpn_str);
                        }