Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
http: increase default header size from 8KB to 16KB
Fixes: #27645
  • Loading branch information
rosaxxny committed Mar 27, 2020
commit 7163e124251b2416d268391a0b274055b983b634
6 changes: 5 additions & 1 deletion doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,13 @@ disappear in a non-semver-major release.
### `--max-http-header-size=size`
<!-- YAML
added: v11.6.0
changes:
- version: REPLACEME
pr-url: REPLACEME
description: Change maximum default size of HTTP headers from 8KB to 16KB.
-->

Specify the maximum size, in bytes, of HTTP headers. Defaults to 8KB.
Specify the maximum size, in bytes, of HTTP headers. Defaults to 16KB.

### `--napi-modules`
<!-- YAML
Expand Down
4 changes: 2 additions & 2 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -2059,7 +2059,7 @@ changes:
* `maxHeaderSize` {number} Optionally overrides the value of
[`--max-http-header-size`][] for requests received by this server, i.e.
the maximum length of request headers in bytes.
**Default:** 8192 (8KB).
**Default:** 16384 (16KB).
* `requestListener` {Function}

* Returns: {http.Server}
Expand Down Expand Up @@ -2213,7 +2213,7 @@ changes:
* `maxHeaderSize` {number} Optionally overrides the value of
[`--max-http-header-size`][] for requests received from the server, i.e.
the maximum length of response headers in bytes.
**Default:** 8192 (8KB).
**Default:** 16384 (16KB).
* `method` {string} A string specifying the HTTP request method. **Default:**
`'GET'`.
* `path` {string} Request path. Should include query string if any.
Expand Down
2 changes: 1 addition & 1 deletion doc/node.1
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ This flag is inherited from V8 and is subject to change upstream. It may
disappear in a non-semver-major release.
.
.It Fl -max-http-header-size Ns = Ns Ar size
Specify the maximum size of HTTP headers in bytes. Defaults to 8KB.
Specify the maximum size of HTTP headers in bytes. Defaults to 16KB.
.
.It Fl -napi-modules
This option is a no-op.
Expand Down
2 changes: 1 addition & 1 deletion src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
&EnvironmentOptions::heap_prof_interval);
#endif // HAVE_INSPECTOR
AddOption("--max-http-header-size",
"set the maximum size of HTTP headers (default: 8192 (8KB))",
"set the maximum size of HTTP headers (default: 16384 (16KB))",
&EnvironmentOptions::max_http_header_size,
kAllowedInEnvironment);
AddOption("--redirect-warnings",
Expand Down
2 changes: 1 addition & 1 deletion src/node_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class EnvironmentOptions : public Options {
bool expose_internals = false;
bool frozen_intrinsics = false;
std::string heap_snapshot_signal;
uint64_t max_http_header_size = 8 * 1024;
uint64_t max_http_header_size = 16 * 1024;
bool no_deprecation = false;
bool no_force_async_hooks_checks = false;
bool no_warnings = false;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-http-max-header-size.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const assert = require('assert');
const { spawnSync } = require('child_process');
const http = require('http');

assert.strictEqual(http.maxHeaderSize, 8 * 1024);
assert.strictEqual(http.maxHeaderSize, 16 * 1024);
const child = spawnSync(process.execPath, ['--max-http-header-size=10', '-p',
'http.maxHeaderSize']);
assert.strictEqual(+child.stdout.toString().trim(), 10);