]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: server: Make use of the stored ALPN stored in the server
authorOlivier Houchard <ohouchard@haproxy.com>
Mon, 8 Sep 2025 21:35:17 +0000 (23:35 +0200)
committerOlivier Houchard <cognet@ci0.org>
Tue, 9 Sep 2025 17:01:24 +0000 (19:01 +0200)
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.

src/backend.c
src/connection.c

index 7ca91231a5902e718d15506ef4df3da5a9f00a6f..e54a101dad0d43e93dac13afff9d5a7345c26858 100644 (file)
@@ -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
 
index 8acf04c9dd4a089dc1514eafd1bc1fb2c162edf9..39e2eb3c838006bd47ad355221019ceba116c417 100644 (file)
@@ -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);