-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make `tls.connect()` support the `hints` option for feature parity with `net.connect()`. PR-URL: #27816 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Rich Trott <[email protected]>
- Loading branch information
Showing
3 changed files
with
33 additions
and
19 deletions.
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,26 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
|
||
// This test verifies that `tls.connect()` honors the `hints` option. | ||
|
||
if (!common.hasCrypto) | ||
common.skip('missing crypto'); | ||
|
||
const assert = require('assert'); | ||
const dns = require('dns'); | ||
const tls = require('tls'); | ||
|
||
const hints = 512; | ||
|
||
assert.notStrictEqual(hints, dns.ADDRCONFIG); | ||
assert.notStrictEqual(hints, dns.V4MAPPED); | ||
assert.notStrictEqual(hints, dns.ADDRCONFIG | dns.V4MAPPED); | ||
|
||
tls.connect({ | ||
lookup: common.mustCall((host, options) => { | ||
assert.strictEqual(host, 'localhost'); | ||
assert.deepStrictEqual(options, { family: undefined, hints }); | ||
}), | ||
hints | ||
}); |