-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tls: accept
lookup
option for tls.connect()
`net.connect()` and consequently `http.Agent` support custom DNS `lookup` option. However, as we move to `https.Agent` - this option no longer works because it is not proxied by `tls.connect`. Fix this inconsistency by passing it down to `net.connect`. PR-URL: #12839 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
- Loading branch information
Showing
3 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const tls = require('tls'); | ||
|
||
const expectedError = /^TypeError: "lookup" option should be a function$/; | ||
|
||
['foobar', 1, {}, []].forEach(function connectThrows(input) { | ||
const opts = { | ||
host: 'localhost', | ||
port: common.PORT, | ||
lookup: input | ||
}; | ||
|
||
assert.throws(function() { | ||
tls.connect(opts); | ||
}, expectedError); | ||
}); | ||
|
||
connectDoesNotThrow(common.mustCall(() => {})); | ||
|
||
function connectDoesNotThrow(input) { | ||
const opts = { | ||
host: 'localhost', | ||
port: common.PORT, | ||
lookup: input | ||
}; | ||
|
||
assert.doesNotThrow(function() { | ||
tls.connect(opts); | ||
}); | ||
} |