Skip to content

Commit

Permalink
Support additional tls.connect() options (#1996)
Browse files Browse the repository at this point in the history
* Support additional tls.connect() options

* Pass-through all ssl options to tls.connect()

* Fix lint error

* Remove tls.checkServerIdentity explicit option
  • Loading branch information
jgeurts authored and brianc committed Nov 19, 2019
1 parent ced31dd commit bf029c8
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,9 @@ Connection.prototype.connect = function (port, host) {
return self.emit('error', new Error('There was an error establishing an SSL connection'))
}
var tls = require('tls')
const options = {
socket: self.stream,
checkServerIdentity: self.ssl.checkServerIdentity || tls.checkServerIdentity,
rejectUnauthorized: self.ssl.rejectUnauthorized,
ca: self.ssl.ca,
pfx: self.ssl.pfx,
key: self.ssl.key,
passphrase: self.ssl.passphrase,
cert: self.ssl.cert,
secureOptions: self.ssl.secureOptions,
NPNProtocols: self.ssl.NPNProtocols
}
const options = Object.assign({
socket: self.stream
}, self.ssl)
if (net.isIP(host) === 0) {
options.servername = host
}
Expand Down

0 comments on commit bf029c8

Please sign in to comment.