Skip to content

Commit

Permalink
Honor the .strictSSL option when using proxies (tunnel-agent)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhs committed Apr 8, 2013
1 parent 9bc28bf commit f724810
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ Request.prototype.init = function (options) {
if (typeof self.uri == "string") self.uri = url.parse(self.uri)
}

if (self.strictSSL === false) {
self.rejectUnauthorized = false
}

if (self.proxy) {
if (typeof self.proxy == 'string') self.proxy = url.parse(self.proxy)

Expand All @@ -171,6 +175,7 @@ Request.prototype.init = function (options) {
, proxyAuth: self.proxy.auth
, headers: { Host: self.uri.hostname + ':' +
(self.uri.port || self.uri.protocol === 'https:' ? 443 : 80) }}
, rejectUnauthorized: self.rejectUnauthorized
, ca: this.ca }

self.agent = tunnelFn(tunnelOptions)
Expand Down Expand Up @@ -355,10 +360,6 @@ Request.prototype.init = function (options) {
}
}

if (self.strictSSL === false) {
self.rejectUnauthorized = false
}

if (self.pool === false) {
self.agent = false
} else {
Expand Down Expand Up @@ -445,6 +446,7 @@ Request.prototype._updateProtocol = function () {
var tunnelOptions = { proxy: { host: self.proxy.hostname
, port: +self.proxy.port
, proxyAuth: self.proxy.auth }
, rejectUnauthorized: self.rejectUnauthorized
, ca: self.ca }
self.agent = tunnelFn(tunnelOptions)
return
Expand Down

0 comments on commit f724810

Please sign in to comment.