mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
Refs: https://github.com/nodejs/node/pull/24738 Fixes: https://github.com/nodejs/node/issues/25858 PR-URL: https://github.com/nodejs/node/pull/25939 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
25 lines
790 B
JavaScript
25 lines
790 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const { spawnSync } = require('child_process');
|
|
const http = require('http');
|
|
|
|
assert.strictEqual(http.maxHeaderSize, 8 * 1024);
|
|
const child = spawnSync(process.execPath, ['--max-http-header-size=10', '-p',
|
|
'http.maxHeaderSize']);
|
|
assert.strictEqual(+child.stdout.toString().trim(), 10);
|
|
|
|
{
|
|
const server = http.createServer(common.mustNotCall());
|
|
server.listen(0, common.mustCall(() => {
|
|
http.get({
|
|
port: server.address().port,
|
|
headers: { foo: 'x'.repeat(http.maxHeaderSize + 1) }
|
|
}, common.mustNotCall()).once('error', common.mustCall((err) => {
|
|
assert.strictEqual(err.code, 'ECONNRESET');
|
|
server.close();
|
|
}));
|
|
}));
|
|
}
|