From ba7c9ce9649886edf77d01cdcec216c8a0c76f48 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Mon, 28 Oct 2013 16:10:10 +0400 Subject: [PATCH] tls: do not default to 'localhost' servername --- lib/_tls_wrap.js | 3 +-- src/node_crypto.cc | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index a09b5aa..98768eb 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -685,8 +685,7 @@ exports.connect = function(/* [port, host], options, cb */) { var hostname = options.servername || options.host || - options.socket && options.socket._host || - 'localhost', + options.socket && options.socket._host, NPN = {}, credentials = crypto.createCredentials(options); tls.convertNPNProtocols(options.NPNProtocols, NPN); diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 46e6a92..c885cb8 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -1710,7 +1710,7 @@ void Connection::New(const FunctionCallbackInfo& args) { #ifdef SSL_CTRL_SET_TLSEXT_SERVERNAME_CB if (is_server) { SSL_CTX_set_tlsext_servername_callback(sc->ctx_, SelectSNIContextCallback_); - } else { + } else if (args[2]->IsString()) { const String::Utf8Value servername(args[2]); SSL_set_tlsext_host_name(conn->ssl_, *servername); } -- 2.7.4