From 12554368fee8105c809294841e6c1d9bbbe75769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=82ngela=20Igreja?= Date: Tue, 18 Mar 2014 23:50:30 +0000 Subject: [PATCH] Allow the user supplied tlsOptions to overridde the host name used for certification validation. --- lib/Connection.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Connection.js b/lib/Connection.js index b5315a8..78eccb3 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -1,4 +1,4 @@ -var tls = require('tls'), +§var tls = require('tls'), Socket = require('net').Socket, EventEmitter = require('events').EventEmitter, inherits = require('util').inherits, @@ -102,10 +102,11 @@ Connection.prototype.connect = function() { if (config.tls) { tlsOptions = {}; + tlsOptions.host = config.host; + // Host name may be overridden the tlsOptions for (var k in config.tlsOptions) tlsOptions[k] = config.tlsOptions[k]; tlsOptions.socket = socket; - tlsOptions.host = config.host; } if (config.tls) @@ -1631,10 +1632,11 @@ Connection.prototype._starttls = function() { var tlsOptions = {}; + tlsOptions.host = this._config.host; + // Host name may be overridden the tlsOptions for (var k in this._config.tlsOptions) tlsOptions[k] = this._config.tlsOptions[k]; tlsOptions.socket = self._sock; - tlsOptions.host = this._config.host; self._sock = tls.connect(tlsOptions, function() { self._login();