summaryrefslogtreecommitdiff
path: root/test/parallel/test-http2-create-client-secure-session.js
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2018-01-01 11:13:29 -0800
committerJames M Snell <jasnell@gmail.com>2018-01-03 11:29:43 -0800
commit060babd66524b6a3e4757bb2fe5b87ad567cdb40 (patch)
tree22a4d99a5f91fd9b976e8b2e293ecf7420f9a697 /test/parallel/test-http2-create-client-secure-session.js
parentb25b1efa0a6801cdf3faea199a36e0e2cc489395 (diff)
downloadandroid-node-v8-060babd66524b6a3e4757bb2fe5b87ad567cdb40.tar.gz
android-node-v8-060babd66524b6a3e4757bb2fe5b87ad567cdb40.tar.bz2
android-node-v8-060babd66524b6a3e4757bb2fe5b87ad567cdb40.zip
http2: add initial support for originSet
Add new properties to `Http2Session` to identify alpnProtocol, and indicator about whether the session is TLS or not, and initial support for origin set (preparinng for `ORIGIN` frame support and the client-side `Pool` implementation. The `originSet` is the set of origins for which an `Http2Session` may be considered authoritative. Per the `ORIGIN` frame spec, the originSet is only valid on TLS connections, so this is only exposed when using a `TLSSocket`. PR-URL: https://github.com/nodejs/node/pull/17935 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Sebastiaan Deckers <sebdeckers83@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Diffstat (limited to 'test/parallel/test-http2-create-client-secure-session.js')
-rw-r--r--test/parallel/test-http2-create-client-secure-session.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/parallel/test-http2-create-client-secure-session.js b/test/parallel/test-http2-create-client-secure-session.js
index 811ef772d5..6120a58602 100644
--- a/test/parallel/test-http2-create-client-secure-session.js
+++ b/test/parallel/test-http2-create-client-secure-session.js
@@ -19,6 +19,14 @@ function loadKey(keyname) {
function onStream(stream, headers) {
const socket = stream.session[kSocket];
+
+ assert(stream.session.encrypted);
+ assert(stream.session.alpnProtocol, 'h2');
+ const originSet = stream.session.originSet;
+ assert(Array.isArray(originSet));
+ assert.strictEqual(originSet[0],
+ `https://${socket.servername}:${socket.remotePort}`);
+
assert(headers[':authority'].startsWith(socket.servername));
stream.respond({ 'content-type': 'application/json' });
stream.end(JSON.stringify({
@@ -39,6 +47,17 @@ function verifySecureSession(key, cert, ca, opts) {
assert.strictEqual(client.socket.listenerCount('secureConnect'), 1);
const req = client.request();
+ client.on('connect', common.mustCall(() => {
+ assert(client.encrypted);
+ assert.strictEqual(client.alpnProtocol, 'h2');
+ const originSet = client.originSet;
+ assert(Array.isArray(originSet));
+ assert.strictEqual(originSet.length, 1);
+ assert.strictEqual(
+ originSet[0],
+ `https://${opts.servername || 'localhost'}:${server.address().port}`);
+ }));
+
req.on('response', common.mustCall((headers) => {
assert.strictEqual(headers[':status'], 200);
assert.strictEqual(headers['content-type'], 'application/json');