Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add proxy handler "has" for "http2.Http2ServerResponse.socket" and "http2.Http2ServerRequest.socket" #35197

Closed
wants to merge 17 commits into from
Closed
Prev Previous commit
Next Next commit
Update test-for-pull-35197.js
  • Loading branch information
masx200 authored Sep 15, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 68268bf33d9e1c7d629e987d3aee2f66976ac4ff
56 changes: 24 additions & 32 deletions test/parallel/test-for-pull-35197.js
Original file line number Diff line number Diff line change
@@ -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();

}));
}));