From dd8afa3e7d6c4a5a3f42fadb7e25b670e0443ce8 Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Tue, 15 Sep 2020 06:29:31 +0800 Subject: [PATCH 01/17] Update compat.js --- lib/internal/http2/compat.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index ec86be1ceaab45..ca45a0fe548e78 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -188,6 +188,15 @@ function resumeStream(stream) { } const proxySocketHandler = { + has(stream, prop){ + + const ref = stream.session !== undefined ? + stream.session[kSocket] : stream; + + return Reflect.has(stream, prop)||Reflect.has(ref, prop) + + + }, get(stream, prop) { switch (prop) { case 'on': From fad3ea41714ca0a809b1d96bca4783b751d44c06 Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Tue, 15 Sep 2020 07:01:47 +0800 Subject: [PATCH 02/17] Create test-for-pull-35197.js --- test/parallel/test-for-pull-35197.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 test/parallel/test-for-pull-35197.js diff --git a/test/parallel/test-for-pull-35197.js b/test/parallel/test-for-pull-35197.js new file mode 100644 index 00000000000000..593252c8837af2 --- /dev/null +++ b/test/parallel/test-for-pull-35197.js @@ -0,0 +1 @@ +//todo From 4ef108ced802e414d2ce7a01b25deefd2d488066 Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Tue, 15 Sep 2020 07:06:13 +0800 Subject: [PATCH 03/17] Update compat.js --- lib/internal/http2/compat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index ca45a0fe548e78..07ba1ecb056062 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -10,7 +10,7 @@ const { ReflectGetPrototypeOf, Symbol, } = primordials; - +const { Reflect } = primordials; const assert = require('internal/assert'); const Stream = require('stream'); const { Readable } = Stream; From 33d14d210d64dd0c9900d3e4767373a66ac2a366 Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Tue, 15 Sep 2020 07:12:55 +0800 Subject: [PATCH 04/17] Update test-for-pull-35197.js --- test/parallel/test-for-pull-35197.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/parallel/test-for-pull-35197.js b/test/parallel/test-for-pull-35197.js index 593252c8837af2..80e9985e1f6fe4 100644 --- a/test/parallel/test-for-pull-35197.js +++ b/test/parallel/test-for-pull-35197.js @@ -1 +1,9 @@ //todo + +'use strict'; +const common = require('../common'); +const fixtures = require('../common/fixtures'); + +function loadPEM(n) { + return fixtures.readKey(`${n}.pem`); +} From f8db9cd97bba7cf699d2c1e1527d27e49b24698e Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Tue, 15 Sep 2020 07:14:00 +0800 Subject: [PATCH 05/17] Update test-for-pull-35197.js --- test/parallel/test-for-pull-35197.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-for-pull-35197.js b/test/parallel/test-for-pull-35197.js index 80e9985e1f6fe4..57cf34bb632733 100644 --- a/test/parallel/test-for-pull-35197.js +++ b/test/parallel/test-for-pull-35197.js @@ -3,7 +3,7 @@ 'use strict'; const common = require('../common'); const fixtures = require('../common/fixtures'); - +const assert = require('assert'); function loadPEM(n) { return fixtures.readKey(`${n}.pem`); } From 40e47a723f5c5c4450ccfa636b66858e70bba789 Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Tue, 15 Sep 2020 07:50:09 +0800 Subject: [PATCH 06/17] Update test-for-pull-35197.js --- test/parallel/test-for-pull-35197.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-for-pull-35197.js b/test/parallel/test-for-pull-35197.js index 57cf34bb632733..4f9ace52a59e28 100644 --- a/test/parallel/test-for-pull-35197.js +++ b/test/parallel/test-for-pull-35197.js @@ -4,6 +4,11 @@ const common = require('../common'); const fixtures = require('../common/fixtures'); const assert = require('assert'); -function loadPEM(n) { - return fixtures.readKey(`${n}.pem`); -} + +if (!common.hasCrypto) + common.skip('missing crypto'); + +const serverOptions = { + key: fixtures.readKey('agent1-key.pem'), + cert: fixtures.readKey('agent1-cert.pem') +}; From 4def2449e73644f644594458f2d95f736cb7025c Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Tue, 15 Sep 2020 09:44:14 +0800 Subject: [PATCH 07/17] Update compat.js --- lib/internal/http2/compat.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index 07ba1ecb056062..8fe3c2f703880a 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -188,15 +188,13 @@ function resumeStream(stream) { } const proxySocketHandler = { - has(stream, prop){ - - const ref = stream.session !== undefined ? - stream.session[kSocket] : stream; - - return Reflect.has(stream, prop)||Reflect.has(ref, prop) - - + + + has(stream, prop) { + const ref = stream.session !== undefined ? stream.session[kSocket] : stream; + return Reflect.has(stream, prop) || Reflect.has(ref, prop); }, + get(stream, prop) { switch (prop) { case 'on': From 4f0b74a10b6e423c1dab26fbbd53cf1cd35fe983 Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Tue, 15 Sep 2020 09:51:14 +0800 Subject: [PATCH 08/17] Update test-for-pull-35197.js --- test/parallel/test-for-pull-35197.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-for-pull-35197.js b/test/parallel/test-for-pull-35197.js index 4f9ace52a59e28..0893f352e2c3d4 100644 --- a/test/parallel/test-for-pull-35197.js +++ b/test/parallel/test-for-pull-35197.js @@ -1,10 +1,10 @@ -//todo +// todo 'use strict'; const common = require('../common'); const fixtures = require('../common/fixtures'); const assert = require('assert'); - +const http2 = require('http2'); if (!common.hasCrypto) common.skip('missing crypto'); @@ -12,3 +12,11 @@ const serverOptions = { key: fixtures.readKey('agent1-key.pem'), cert: fixtures.readKey('agent1-cert.pem') }; +const server = http2.createSecureServer( + serverOptions, + common.mustCall((req, res) => { +const request=req + assert(true===request.socket.encrypted) + assert("encrypted" in request.socket) + + })); From 832d616fc57329c29ee86c0ecf595143a570d123 Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Tue, 15 Sep 2020 10:03:02 +0800 Subject: [PATCH 09/17] Update test-for-pull-35197.js --- test/parallel/test-for-pull-35197.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-for-pull-35197.js b/test/parallel/test-for-pull-35197.js index 0893f352e2c3d4..b926b64488d7e9 100644 --- a/test/parallel/test-for-pull-35197.js +++ b/test/parallel/test-for-pull-35197.js @@ -18,5 +18,25 @@ const server = http2.createSecureServer( const request=req assert(true===request.socket.encrypted) assert("encrypted" in request.socket) - +res.end() })); +server.listen(common.mustCall(() => { +const port=server.address().port + +const client = http2.connect('https://localhost:'+port, { + ca: fixtures.readKey('agent1-cert.pem'), +rejectUnauthorized: false +}); + const req = client.request({ + + + + }); + req.on('response',common.mustCall( (headers, flags) => { + console.log(headers) + +server.close(common.mustCall(()=>{})) +})); + req.end(); + + })); From 68268bf33d9e1c7d629e987d3aee2f66976ac4ff Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Tue, 15 Sep 2020 10:07:10 +0800 Subject: [PATCH 10/17] Update test-for-pull-35197.js --- test/parallel/test-for-pull-35197.js | 56 ++++++++++++---------------- 1 file changed, 24 insertions(+), 32 deletions(-) diff --git a/test/parallel/test-for-pull-35197.js b/test/parallel/test-for-pull-35197.js index b926b64488d7e9..33eb9fbbb86c76 100644 --- a/test/parallel/test-for-pull-35197.js +++ b/test/parallel/test-for-pull-35197.js @@ -1,42 +1,34 @@ -// todo - -'use strict'; + 'use strict'; const common = require('../common'); const fixtures = require('../common/fixtures'); const assert = require('assert'); const http2 = require('http2'); if (!common.hasCrypto) - common.skip('missing crypto'); - + common.skip('missing crypto'); const serverOptions = { - key: fixtures.readKey('agent1-key.pem'), - cert: fixtures.readKey('agent1-cert.pem') + key: fixtures.readKey('agent1-key.pem'), + cert: fixtures.readKey('agent1-cert.pem') }; -const server = http2.createSecureServer( - serverOptions, - common.mustCall((req, res) => { -const request=req - assert(true===request.socket.encrypted) - assert("encrypted" in request.socket) -res.end() - })); +const server = http2.createSecureServer(serverOptions, common.mustCall((req, res) => { + const request = req; + assert(true === request.socket.encrypted); + assert('encrypted' in request.socket); + res.end(); +})); server.listen(common.mustCall(() => { -const port=server.address().port - -const client = http2.connect('https://localhost:'+port, { - ca: fixtures.readKey('agent1-cert.pem'), -rejectUnauthorized: false -}); - const req = client.request({ - - - + const port = server.address().port; + const client = http2.connect('https://localhost:' + port, { + ca: fixtures.readKey('agent1-cert.pem'), + rejectUnauthorized: false }); - req.on('response',common.mustCall( (headers, flags) => { - console.log(headers) - -server.close(common.mustCall(()=>{})) -})); + const req = client.request({}); + req.on('response', common.mustCall((headers, flags) => { + console.log(headers); + server.close(common.mustCall(() => { + })); + })); + req.on('end', common.mustCall(() => { + client.close(); + })); req.end(); - - })); +})); From e634e5948c8d5fa53473bf63cafeffa186dbe421 Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Tue, 15 Sep 2020 13:19:36 +0800 Subject: [PATCH 11/17] Update compat.js --- lib/internal/http2/compat.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index 8fe3c2f703880a..598f885a561786 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -10,7 +10,7 @@ const { ReflectGetPrototypeOf, Symbol, } = primordials; -const { Reflect } = primordials; + const assert = require('internal/assert'); const Stream = require('stream'); const { Readable } = Stream; @@ -191,8 +191,8 @@ const proxySocketHandler = { has(stream, prop) { - const ref = stream.session !== undefined ? stream.session[kSocket] : stream; - return Reflect.has(stream, prop) || Reflect.has(ref, prop); + const ref = stream.session !== undefined ? stream.session[kSocket] : stream; + return (prop in stream ) || (prop in ref); }, get(stream, prop) { From ccfccf1443c88e22df8672894f13d96b950bca18 Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Tue, 15 Sep 2020 13:35:43 +0800 Subject: [PATCH 12/17] Update test-for-pull-35197.js --- test/parallel/test-for-pull-35197.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-for-pull-35197.js b/test/parallel/test-for-pull-35197.js index 33eb9fbbb86c76..ee1ff06f79f088 100644 --- a/test/parallel/test-for-pull-35197.js +++ b/test/parallel/test-for-pull-35197.js @@ -3,8 +3,10 @@ const common = require('../common'); const fixtures = require('../common/fixtures'); const assert = require('assert'); const http2 = require('http2'); -if (!common.hasCrypto) +if (!common.hasCrypto){ common.skip('missing crypto'); + process.exit() +} const serverOptions = { key: fixtures.readKey('agent1-key.pem'), cert: fixtures.readKey('agent1-cert.pem') From 6a67797130c2d6562369da1887fc74ff442d5445 Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Tue, 15 Sep 2020 13:59:08 +0800 Subject: [PATCH 13/17] Update test-for-pull-35197.js --- test/parallel/test-for-pull-35197.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-for-pull-35197.js b/test/parallel/test-for-pull-35197.js index ee1ff06f79f088..59e13aefe39bb3 100644 --- a/test/parallel/test-for-pull-35197.js +++ b/test/parallel/test-for-pull-35197.js @@ -5,7 +5,7 @@ const assert = require('assert'); const http2 = require('http2'); if (!common.hasCrypto){ common.skip('missing crypto'); - process.exit() + } const serverOptions = { key: fixtures.readKey('agent1-key.pem'), From 362a62852298373c846ec8bde58e012e7640b9a5 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 18 Sep 2020 09:30:28 -0700 Subject: [PATCH 14/17] fixup! Update test-for-pull-35197.js --- lib/internal/http2/compat.js | 8 ++--- test/parallel/test-for-pull-35197.js | 48 ++++++++++++++-------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index 598f885a561786..0e5b511ce1e7d0 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -188,11 +188,11 @@ function resumeStream(stream) { } const proxySocketHandler = { - - + + has(stream, prop) { - const ref = stream.session !== undefined ? stream.session[kSocket] : stream; - return (prop in stream ) || (prop in ref); + const ref = stream.session !== undefined ? stream.session[kSocket] : stream; + return (prop in stream) || (prop in ref); }, get(stream, prop) { diff --git a/test/parallel/test-for-pull-35197.js b/test/parallel/test-for-pull-35197.js index 59e13aefe39bb3..0168753d9a0d6c 100644 --- a/test/parallel/test-for-pull-35197.js +++ b/test/parallel/test-for-pull-35197.js @@ -1,36 +1,36 @@ - 'use strict'; +'use strict'; const common = require('../common'); const fixtures = require('../common/fixtures'); const assert = require('assert'); const http2 = require('http2'); -if (!common.hasCrypto){ - common.skip('missing crypto'); - +if (!common.hasCrypto) { + common.skip('missing crypto'); + } const serverOptions = { - key: fixtures.readKey('agent1-key.pem'), - cert: fixtures.readKey('agent1-cert.pem') + key: fixtures.readKey('agent1-key.pem'), + cert: fixtures.readKey('agent1-cert.pem') }; const server = http2.createSecureServer(serverOptions, common.mustCall((req, res) => { - const request = req; - assert(true === request.socket.encrypted); - assert('encrypted' in request.socket); - res.end(); + const request = req; + assert.strictEqual(true, request.socket.encrypted); + assert('encrypted' in request.socket); + res.end(); })); server.listen(common.mustCall(() => { - const port = server.address().port; - const client = http2.connect('https://localhost:' + port, { - ca: fixtures.readKey('agent1-cert.pem'), - rejectUnauthorized: false - }); - const req = client.request({}); - req.on('response', common.mustCall((headers, flags) => { - console.log(headers); - server.close(common.mustCall(() => { - })); + const port = server.address().port; + const client = http2.connect('https://localhost:' + port, { + ca: fixtures.readKey('agent1-cert.pem'), + rejectUnauthorized: false + }); + const req = client.request({}); + req.on('response', common.mustCall((headers, flags) => { + console.log(headers); + server.close(common.mustCall(() => { })); - req.on('end', common.mustCall(() => { - client.close(); - })); - req.end(); + })); + req.on('end', common.mustCall(() => { + client.close(); + })); + req.end(); })); From 734fa6392553bb529bf3c8889a9f9ded03e9d300 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 18 Sep 2020 09:36:10 -0700 Subject: [PATCH 15/17] fixup! fixup! Update test-for-pull-35197.js --- test/parallel/test-for-pull-35197.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/test/parallel/test-for-pull-35197.js b/test/parallel/test-for-pull-35197.js index 0168753d9a0d6c..ccc63149ff1b12 100644 --- a/test/parallel/test-for-pull-35197.js +++ b/test/parallel/test-for-pull-35197.js @@ -1,22 +1,25 @@ 'use strict'; const common = require('../common'); +if (!common.hasCrypto) { + common.skip('missing crypto'); +} + const fixtures = require('../common/fixtures'); const assert = require('assert'); const http2 = require('http2'); -if (!common.hasCrypto) { - common.skip('missing crypto'); -} const serverOptions = { key: fixtures.readKey('agent1-key.pem'), cert: fixtures.readKey('agent1-cert.pem') }; -const server = http2.createSecureServer(serverOptions, common.mustCall((req, res) => { - const request = req; - assert.strictEqual(true, request.socket.encrypted); - assert('encrypted' in request.socket); - res.end(); -})); +const server = http2.createSecureServer(serverOptions, common.mustCall( + (req, res) => { + const request = req; + assert.strictEqual(request.socket.encrypted, true); + assert.ok('encrypted' in request.socket); + res.end(); + } +)); server.listen(common.mustCall(() => { const port = server.address().port; const client = http2.connect('https://localhost:' + port, { From 19b09513361c4a50eb72758c9f2da6bb1185bff8 Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Sat, 19 Sep 2020 00:39:13 +0800 Subject: [PATCH 16/17] Update lib/internal/http2/compat.js Co-authored-by: Rich Trott --- lib/internal/http2/compat.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index 0e5b511ce1e7d0..e3cc240da1e1c6 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -188,8 +188,6 @@ function resumeStream(stream) { } const proxySocketHandler = { - - has(stream, prop) { const ref = stream.session !== undefined ? stream.session[kSocket] : stream; return (prop in stream) || (prop in ref); From 8259db5b59169e0949f66077a30ca449c5cffe3f Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Sat, 19 Sep 2020 00:44:54 +0800 Subject: [PATCH 17/17] Rename test-for-pull-35197.js to test-http2-socket-proxy-handler-for-has.js --- ...r-pull-35197.js => test-http2-socket-proxy-handler-for-has.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/parallel/{test-for-pull-35197.js => test-http2-socket-proxy-handler-for-has.js} (100%) diff --git a/test/parallel/test-for-pull-35197.js b/test/parallel/test-http2-socket-proxy-handler-for-has.js similarity index 100% rename from test/parallel/test-for-pull-35197.js rename to test/parallel/test-http2-socket-proxy-handler-for-has.js