-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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 <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
- 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 | ||
}); |