This repository has been archived by the owner on Oct 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
meta: merge node/master into node-chakracore/master
Merge 291ff72 as of 2017-11-04 This commit was automatically generated. For any problems, please contact jackhorton Reviewed-By: Jack Horton <jahorto@microsoft.com>
- Loading branch information
Showing
15 changed files
with
183 additions
and
23 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
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
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
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
78 changes: 78 additions & 0 deletions
78
test/parallel/test-tls-socket-constructor-alpn-npn-options-parsing.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,78 @@ | ||
'use strict'; | ||
|
||
// Test that TLSSocket can take arrays of strings for ALPNProtocols and | ||
// NPNProtocols. | ||
|
||
const common = require('../common'); | ||
|
||
if (!common.hasCrypto) | ||
common.skip('missing crypto'); | ||
|
||
const tls = require('tls'); | ||
|
||
new tls.TLSSocket(null, { | ||
ALPNProtocols: ['http/1.1'], | ||
NPNProtocols: ['http/1.1'] | ||
}); | ||
|
||
if (!process.features.tls_npn) | ||
common.skip('node compiled without NPN feature of OpenSSL'); | ||
|
||
if (!process.features.tls_alpn) | ||
common.skip('node compiled without ALPN feature of OpenSSL'); | ||
|
||
const assert = require('assert'); | ||
const net = require('net'); | ||
const fixtures = require('../common/fixtures'); | ||
|
||
const key = fixtures.readKey('agent1-key.pem'); | ||
const cert = fixtures.readKey('agent1-cert.pem'); | ||
|
||
const protocols = []; | ||
|
||
const server = net.createServer(common.mustCall((s) => { | ||
const tlsSocket = new tls.TLSSocket(s, { | ||
isServer: true, | ||
server, | ||
key, | ||
cert, | ||
ALPNProtocols: ['http/1.1'], | ||
NPNProtocols: ['http/1.1'] | ||
}); | ||
|
||
tlsSocket.on('secure', common.mustCall(() => { | ||
protocols.push({ | ||
alpnProtocol: tlsSocket.alpnProtocol, | ||
npnProtocol: tlsSocket.npnProtocol | ||
}); | ||
tlsSocket.end(); | ||
})); | ||
}, 2)); | ||
|
||
server.listen(0, common.mustCall(() => { | ||
const alpnOpts = { | ||
port: server.address().port, | ||
rejectUnauthorized: false, | ||
ALPNProtocols: ['h2', 'http/1.1'] | ||
}; | ||
const npnOpts = { | ||
port: server.address().port, | ||
rejectUnauthorized: false, | ||
NPNProtocols: ['h2', 'http/1.1'] | ||
}; | ||
|
||
tls.connect(alpnOpts, function() { | ||
this.end(); | ||
|
||
tls.connect(npnOpts, function() { | ||
this.end(); | ||
|
||
server.close(); | ||
|
||
assert.deepStrictEqual(protocols, [ | ||
{ alpnProtocol: 'http/1.1', npnProtocol: false }, | ||
{ alpnProtocol: false, npnProtocol: 'http/1.1' } | ||
]); | ||
}); | ||
}); | ||
})); |
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