]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
OPTIM: proto_rhttp: Don't set SNI for non-ssl connections
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 3 Sep 2025 14:47:00 +0000 (16:47 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 5 Sep 2025 13:56:42 +0000 (15:56 +0200)
There is no reason to set the SNI for non-ssl connections. It is not really
an issue because ssl_sock_set_servername() function will do nothing. But
there is no reason to uselessly evaluate an expression.

No backport needed, because there is no bug.

src/proto_rhttp.c

index 362d674da968ea7bd47da796aafd88a526fc864d..f94b4a67e6a213f1f3904eed7282189b62f3f7e8 100644 (file)
@@ -98,7 +98,7 @@ static struct connection *new_reverse_conn(struct listener *l, struct server *sr
                goto err;
 
 #ifdef USE_OPENSSL
-       if (srv->ssl_ctx.sni) {
+       if (conn_is_ssl(conn) && srv->ssl_ctx.sni) {
                struct sample *sni_smp = NULL;
                /* TODO remove NULL session which can cause crash depending on the SNI sample expr used. */
                sni_smp = sample_fetch_as_type(srv->proxy, sess, NULL,