forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
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: nodejs#12839 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
- 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); | ||
}); | ||
} |