Skip to content

Commit

Permalink
src: reuse GetServerName
Browse files Browse the repository at this point in the history
PR-URL: #43168
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
tniessen committed May 21, 2022
1 parent 5cb2579 commit 5ba30d8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/crypto/crypto_tls.cc
Expand Up @@ -1250,8 +1250,7 @@ void TLSWrap::GetServername(const FunctionCallbackInfo<Value>& 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 {
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 5ba30d8

Please sign in to comment.