diff options
Diffstat (limited to 'lib/_tls_wrap.js')
-rw-r--r-- | lib/_tls_wrap.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index c6b0a3cee9..bdba9cff0e 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -207,7 +207,7 @@ TLSSocket.prototype.setServername = function(name) { }; TLSSocket.prototype.setSession = function(session) { - if (typeof session === 'string') + if (IS_STRING(session)) session = new Buffer(session, 'binary'); this.ssl.setSession(session); }; @@ -319,10 +319,10 @@ TLSSocket.prototype.getCipher = function(err) { // function Server(/* [options], listener */) { var options, listener; - if (typeof arguments[0] == 'object') { + if (IS_OBJECT(arguments[0])) { options = arguments[0]; listener = arguments[1]; - } else if (typeof arguments[0] == 'function') { + } else if (IS_FUNCTION(arguments[0])) { options = {}; listener = arguments[0]; } @@ -355,7 +355,7 @@ function Server(/* [options], listener */) { var timeout = options.handshakeTimeout || (120 * 1000); - if (typeof timeout !== 'number') { + if (!IS_NUMBER(timeout)) { throw new TypeError('handshakeTimeout must be a number'); } @@ -423,13 +423,13 @@ exports.createServer = function(options, listener) { Server.prototype.setOptions = function(options) { - if (typeof options.requestCert == 'boolean') { + if (IS_BOOLEAN(options.requestCert)) { this.requestCert = options.requestCert; } else { this.requestCert = false; } - if (typeof options.rejectUnauthorized == 'boolean') { + if (IS_BOOLEAN(options.rejectUnauthorized)) { this.rejectUnauthorized = options.rejectUnauthorized; } else { this.rejectUnauthorized = false; @@ -481,7 +481,7 @@ Server.prototype.SNICallback = function(servername) { var ctx; this._contexts.some(function(elem) { - if (servername.match(elem[0]) !== null) { + if (!IS_NULL(servername.match(elem[0]))) { ctx = elem[1]; return true; } @@ -510,9 +510,9 @@ function normalizeConnectArgs(listArgs) { var options = args[0]; var cb = args[1]; - if (typeof listArgs[1] === 'object') { + if (IS_OBJECT(listArgs[1])) { options = util._extend(options, listArgs[1]); - } else if (typeof listArgs[2] === 'object') { + } else if (IS_OBJECT(listArgs[2])) { options = util._extend(options, listArgs[2]); } |