GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — http2: add has method to proxySocketHandler · nodejs/node@c4e17cf

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/http2
    • compat.js
  • test/parallel
    • test-http2-socket-proxy-handler-for-has.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/http2/compat.js‎

Copy file name to clipboardExpand all lines: lib/internal/http2/compat.js
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ function resumeStream(stream) {
181181
}
182182

183183
const proxySocketHandler = {
184+
has(stream, prop) {
185+
const ref = stream.session !== undefined ? stream.session[kSocket] : stream;
186+
return (prop in stream) || (prop in ref);
187+
},
188+
184189
get(stream, prop) {
185190
switch (prop) {
186191
case 'on':
Collapse file

‎test/parallel/test-http2-socket-proxy-handler-for-has.js‎

Copy file name to clipboard
+39Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
'use strict';
2+
const common = require('../common');
3+
if (!common.hasCrypto) {
4+
common.skip('missing crypto');
5+
}
6+
7+
const fixtures = require('../common/fixtures');
8+
const assert = require('assert');
9+
const http2 = require('http2');
10+
11+
const serverOptions = {
12+
key: fixtures.readKey('agent1-key.pem'),
13+
cert: fixtures.readKey('agent1-cert.pem')
14+
};
15+
const server = http2.createSecureServer(serverOptions, common.mustCall(
16+
(req, res) => {
17+
const request = req;
18+
assert.strictEqual(request.socket.encrypted, true);
19+
assert.ok('encrypted' in request.socket);
20+
res.end();
21+
}
22+
));
23+
server.listen(common.mustCall(() => {
24+
const port = server.address().port;
25+
const client = http2.connect('https://localhost:' + port, {
26+
ca: fixtures.readKey('agent1-cert.pem'),
27+
rejectUnauthorized: false
28+
});
29+
const req = client.request({});
30+
req.on('response', common.mustCall((headers, flags) => {
31+
console.log(headers);
32+
server.close(common.mustCall(() => {
33+
}));
34+
}));
35+
req.on('end', common.mustCall(() => {
36+
client.close();
37+
}));
38+
req.end();
39+
}));

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.