From c865cba45632fc8e48c3b2fa9ecc7982b02cf5f8 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Thu, 30 Jul 2020 09:10:36 +0200 Subject: [PATCH] MINOR: connection: Preinstall the mux for non-ssl connect In the connect_server() function, there is an optim to install the mux as soon as possible. It is possible if we can determine the mux to use from the configuration only. For instance if the mux is explicitly specified or if no ALPN is set. This patch adds a new condition to preinstall the mux for non-ssl connection. In this case, by default, we always use the mux_pt for raw connections and the mux-h1 for HTTP ones. This patch is related to the issue #762. It may be backported to 2.2 (and possibly as far as 1.9 if necessary). (cherry picked from commit b4de4204721fc2fb9a0781efc45b957b76ece065) Signed-off-by: Christopher Faulet (cherry picked from commit cbe1c43508f42fc129ab9766fc321a92220fd375) Signed-off-by: Christopher Faulet --- src/backend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend.c b/src/backend.c index 03751a5..3264422 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1450,8 +1450,8 @@ int connect_server(struct stream *s) #if defined(USE_OPENSSL) && defined(TLSEXT_TYPE_application_layer_protocol_negotiation) if (!srv || - ((!(srv->ssl_ctx.alpn_str) && !(srv->ssl_ctx.npn_str)) || - srv->mux_proto || s->be->mode != PR_MODE_HTTP)) + (srv->use_ssl != 1 || (!(srv->ssl_ctx.alpn_str) && !(srv->ssl_ctx.npn_str)) || + srv->mux_proto || s->be->mode != PR_MODE_HTTP)) #endif { srv_cs = objt_cs(s->si[1].end); -- 1.7.10.4