diff --git a/lib/securepair.js b/lib/securepair.js index 0a1e5655d4..d4b1d4181d 100644 --- a/lib/securepair.js +++ b/lib/securepair.js @@ -19,9 +19,9 @@ var SecureStream = null; * Provides a pair of streams to do encrypted communication. */ -function SecurePair(credentials, isServer) { +function SecurePair(credentials, isServer, shouldVerifyPeer) { if (!(this instanceof SecurePair)) { - return new SecurePair(credentials, isServer); + return new SecurePair(credentials, isServer, shouldVerifyPeer); } var self = this; @@ -51,7 +51,7 @@ function SecurePair(credentials, isServer) { if (!this._isServer) { /* For clients, we will always have either a given ca list or be using default one */ - this.credentials.shouldVerify = true; + shouldVerifyPeer = true; } this._secureEstablished = false; @@ -60,7 +60,7 @@ function SecurePair(credentials, isServer) { this._ssl = new SecureStream(this.credentials.context, this._isServer ? true : false, - this.credentials.shouldVerify); + shouldVerifyPeer ? true : false); /* Acts as a r/w stream to the cleartext side of the stream. */ @@ -175,8 +175,8 @@ function SecurePair(credentials, isServer) { util.inherits(SecurePair, events.EventEmitter); -exports.createSecurePair = function (credentials, isServer) { - var pair = new SecurePair(credentials, isServer); +exports.createSecurePair = function (credentials, isServer, shouldVerifyPeer) { + var pair = new SecurePair(credentials, isServer, shouldVerifyPeer); return pair; };