mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01: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/25863 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
25 lines
751 B
JavaScript
25 lines
751 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.mustCall((res) => {
|
|
assert.strictEqual(res.statusCode, 400);
|
|
server.close();
|
|
}));
|
|
}));
|
|
}
|