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 <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
tniessen authored and targos committed Jul 12, 2022
1 parent 7719b3c commit ffa74dd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/crypto/crypto_tls.cc
Original file line number Diff line number Diff line change
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 ffa74dd

Please sign in to comment.