diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index dd3c11b..eb68bfe 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -870,17 +870,17 @@ ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg) clcf = ngx_http_get_module_loc_conf(hc->conf_ctx, ngx_http_core_module); + if (c->ssl->handshaked) { + *ad = SSL_AD_NO_RENEGOTIATION; + return SSL_TLSEXT_ERR_ALERT_FATAL; + } + servername = SSL_get_servername(ssl_conn, TLSEXT_NAMETYPE_host_name); if (servername == NULL) { return (clcf->strict_sni) ? SSL_TLSEXT_ERR_ALERT_FATAL : SSL_TLSEXT_ERR_OK; } - if (c->ssl->handshaked) { - *ad = SSL_AD_NO_RENEGOTIATION; - return SSL_TLSEXT_ERR_ALERT_FATAL; - } - ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, "SSL server name: \"%s\"", servername);