[PATCH 2 of 2] Stream: do not reallocate a parsed SNI host

Sergey Kandaurov pluknet at nginx.com
Mon May 27 10:21:44 UTC 2024


# HG changeset patch
# User Sergey Kandaurov <pluknet at nginx.com>
# Date 1716805288 -14400
#      Mon May 27 14:21:28 2024 +0400
# Node ID 88fa18a0f05f7dead38a127bb24e5cf861f3d66d
# Parent  e82a7318ed48fdbc1273771bc96357e9dc232975
Stream: do not reallocate a parsed SNI host.

Unlike in http SNI callback, it doesn't need to be saved here.

diff --git a/src/stream/ngx_stream_ssl_module.c b/src/stream/ngx_stream_ssl_module.c
--- a/src/stream/ngx_stream_ssl_module.c
+++ b/src/stream/ngx_stream_ssl_module.c
@@ -501,7 +501,7 @@ ngx_stream_ssl_servername(ngx_ssl_conn_t
 
     host.data = (u_char *) servername;
 
-    rc = ngx_stream_validate_host(&host, c->pool, 1);
+    rc = ngx_stream_validate_host(&host, c->pool, 0);
 
     if (rc == NGX_ERROR) {
         goto error;
diff --git a/src/stream/ngx_stream_ssl_preread_module.c b/src/stream/ngx_stream_ssl_preread_module.c
--- a/src/stream/ngx_stream_ssl_preread_module.c
+++ b/src/stream/ngx_stream_ssl_preread_module.c
@@ -519,7 +519,7 @@ ngx_stream_ssl_preread_servername(ngx_st
 
     host = *servername;
 
-    rc = ngx_stream_validate_host(&host, c->pool, 1);
+    rc = ngx_stream_validate_host(&host, c->pool, 0);
 
     if (rc == NGX_ERROR) {
         return NGX_ERROR;


More information about the nginx-devel mailing list