From: Olivier Houchard Date: Mon, 8 Sep 2025 21:35:17 +0000 (+0200) Subject: MEDIUM: server: Make use of the stored ALPN stored in the server X-Git-Tag: v3.3-dev9~162 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d4c51a4f57fd965c2681e3a64c4bfe1611cf0867;p=thirdparty%2Fhaproxy.git MEDIUM: server: Make use of the stored ALPN stored in the server Now that which ALPN gets negociated for a given server, use that to decide if we can create the mux right away in connect_server(), and use it in conn_install_mux_be(). That way, we may create the mux soon enough for early data to be sent, before the handshake has been completed. This commit depends on several previous commits, and it has not been deemed important enough to backport. --- diff --git a/src/backend.c b/src/backend.c index 7ca91231a..e54a101da 100644 --- a/src/backend.c +++ b/src/backend.c @@ -2057,7 +2057,8 @@ int connect_server(struct stream *s) * anyway. */ if (IS_HTX_STRM(s) && srv && srv->use_ssl && - (srv->ssl_ctx.alpn_str || srv->ssl_ctx.npn_str)) + (srv->ssl_ctx.alpn_str || srv->ssl_ctx.npn_str) && + srv->path_params.nego_alpn[0] == 0) may_start_mux_now = 0; #endif diff --git a/src/connection.c b/src/connection.c index 8acf04c9d..39e2eb3c8 100644 --- a/src/connection.c +++ b/src/connection.c @@ -355,7 +355,12 @@ int conn_install_mux_be(struct connection *conn, void *ctx, struct session *sess int alpn_len = 0; int mode = conn_pr_mode_to_proto_mode(prx->mode); - conn_get_alpn(conn, &alpn_str, &alpn_len); + if (!conn_get_alpn(conn, &alpn_str, &alpn_len)) { + if (srv && srv->path_params.nego_alpn[0]) { + alpn_str = srv->path_params.nego_alpn; + alpn_len = strlen(alpn_str); + } + } mux_proto = ist2(alpn_str, alpn_len); mux_ops = conn_get_best_mux(conn, mux_proto, PROTO_SIDE_BE, mode);