Stream ssl_preread: fixed $ssl_preread_server_name variable.

Made sure to set the variable length only after successful SNI parsing.
This commit is contained in:
Sergey Kandaurov 2016-10-05 18:11:39 +03:00
parent 87555e1215
commit e2cb434777

View file

@ -333,11 +333,12 @@ ngx_stream_ssl_preread_parse_record(ngx_stream_ssl_preread_ctx_t *ctx,
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;