-
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.
tls: fix SNICallback without .server option
`options.server` only needs to be set when its contents are actually being inspected. PR-URL: #17835 Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
- Loading branch information
1 parent
a329cf6
commit e69ea78
Showing
2 changed files
with
27 additions
and
2 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
26 changes: 26 additions & 0 deletions
26
test/parallel/test-tls-socket-snicallback-without-server.js
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'; | ||
|
||
// This is based on test-tls-securepair-fiftharg.js | ||
// for the deprecated `tls.createSecurePair()` variant. | ||
|
||
const common = require('../common'); | ||
if (!common.hasCrypto) | ||
common.skip('missing crypto'); | ||
|
||
const assert = require('assert'); | ||
const tls = require('tls'); | ||
const fixtures = require('../common/fixtures'); | ||
const makeDuplexPair = require('../common/duplexpair'); | ||
|
||
const { clientSide, serverSide } = makeDuplexPair(); | ||
new tls.TLSSocket(serverSide, { | ||
isServer: true, | ||
SNICallback: common.mustCall((servername, cb) => { | ||
assert.strictEqual(servername, 'www.google.com'); | ||
}) | ||
}); | ||
|
||
// captured traffic from browser's request to https://www.google.com | ||
const sslHello = fixtures.readSync('google_ssl_hello.bin'); | ||
|
||
clientSide.write(sslHello); |