]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: connection: Preinstall the mux for non-ssl connect
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 30 Jul 2020 07:10:36 +0000 (09:10 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 30 Jul 2020 07:31:09 +0000 (09:31 +0200)
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).

src/backend.c

index 4d47c943052320a750fb9dcbd9bea19b53de2068..d431920d56d5c14f7f1a119aaf8dc5cceb1db836 100644 (file)
@@ -1412,8 +1412,8 @@ int connect_server(struct stream *s)
                srv_conn->ctx = srv_cs;
 #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
                        init_mux = 1;