[nginx] Stream ssl_preread: fixed $ssl_preread_server_name variable.

Sergey Kandaurov pluknet at nginx.com
Wed Oct 5 15:12:45 UTC 2016


details:   http://hg.nginx.org/nginx/rev/8f75d9883730
branches:  
changeset: 6728:8f75d9883730
user:      Sergey Kandaurov <pluknet at nginx.com>
date:      Wed Oct 05 18:11:39 2016 +0300
description:
Stream ssl_preread: fixed $ssl_preread_server_name variable.

Made sure to set the variable length only after successful SNI parsing.

diffstat:

 src/stream/ngx_stream_ssl_preread_module.c |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (17 lines):

diff -r ca709bca4b77 -r 8f75d9883730 src/stream/ngx_stream_ssl_preread_module.c
--- a/src/stream/ngx_stream_ssl_preread_module.c	Wed Oct 05 14:22:30 2016 +0300
+++ b/src/stream/ngx_stream_ssl_preread_module.c	Wed Oct 05 18:11:39 2016 +0300
@@ -333,11 +333,12 @@ ngx_stream_ssl_preread_parse_record(ngx_
                 return NGX_ERROR;
             }
 
-            ctx->host.len = size;
             dst = ctx->host.data;
             break;
 
         case sw_sni_host:
+            ctx->host.len = (p[1] << 8) + p[2];
+
             ngx_log_debug1(NGX_LOG_DEBUG_STREAM, ctx->log, 0,
                            "ssl preread: SNI hostname \"%V\"", &ctx->host);
             return NGX_OK;



More information about the nginx-devel mailing list