mirror of
https://github.com/nodejs/node.git
synced 2025-04-29 14:25:18 +00:00

Add support for “sensitive”/“never-indexed” HTTP2 headers. Fixes: https://github.com/nodejs/node/issues/34091 PR-URL: https://github.com/nodejs/node/pull/34145 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com>
27 lines
725 B
JavaScript
27 lines
725 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const assert = require('assert');
|
|
const http2 = require('http2');
|
|
|
|
const server = http2.createServer();
|
|
server.on('stream', (stream, headers) => {
|
|
assert.deepStrictEqual(headers, {
|
|
':scheme': 'http',
|
|
':authority': `localhost:${server.address().port}`,
|
|
':method': 'GET',
|
|
':path': '/',
|
|
'bar': '',
|
|
'__proto__': null,
|
|
[http2.sensitiveHeaders]: []
|
|
});
|
|
stream.session.destroy();
|
|
server.close();
|
|
});
|
|
server.listen(0, common.mustCall(() => {
|
|
const client = http2.connect(`http://localhost:${server.address().port}/`);
|
|
client.request({ ':path': '/', '': 'foo', 'bar': '' }).end();
|
|
}));
|