From 37f379265428dd1e06186f8fef0056fc5b91eb34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Sat, 21 May 2022 20:30:01 +0200 Subject: [PATCH] src: reuse GetServerName PR-URL: https://github.com/nodejs/node/pull/43168 Reviewed-By: Antoine du Hamel Reviewed-By: Colin Ihrig --- src/crypto/crypto_tls.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/crypto/crypto_tls.cc b/src/crypto/crypto_tls.cc index 2d0f0c4e735..83dee0be121 100644 --- a/src/crypto/crypto_tls.cc +++ b/src/crypto/crypto_tls.cc @@ -1250,8 +1250,7 @@ void TLSWrap::GetServername(const FunctionCallbackInfo& args) { CHECK_NOT_NULL(wrap->ssl_); - const char* servername = SSL_get_servername(wrap->ssl_.get(), - TLSEXT_NAMETYPE_host_name); + const char* servername = GetServerName(wrap->ssl_.get()); if (servername != nullptr) { args.GetReturnValue().Set(OneByteString(env->isolate(), servername)); } else { @@ -1282,7 +1281,7 @@ int TLSWrap::SelectSNIContextCallback(SSL* s, int* ad, void* arg) { HandleScope handle_scope(env->isolate()); Context::Scope context_scope(env->context()); - const char* servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); + const char* servername = GetServerName(s); if (!Set(env, p->GetOwner(), env->servername_string(), servername)) return SSL_TLSEXT_ERR_NOACK;