Skip to content

Commit cc20b41

Browse files
committed
fixup! http: make maximum header size configurable per-stream or per-server
1 parent 83190a8 commit cc20b41

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

doc/api/http.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,7 +2048,7 @@ Found'`.
20482048
added: v0.1.13
20492049
changes:
20502050
- version: REPLACEME
2051-
pr-url: https://github.com/nodejs/node/pull/?????
2051+
pr-url: https://github.com/nodejs/node/pull/30570
20522052
description: The `maxHeaderSize` option is supported now.
20532053
- version: v9.6.0, v8.12.0
20542054
pr-url: https://github.com/nodejs/node/pull/15752
@@ -2063,8 +2063,9 @@ changes:
20632063
to be used. Useful for extending the original `ServerResponse`. **Default:**
20642064
`ServerResponse`.
20652065
* `maxHeaderSize` {number} Optionally overrides the value of
2066-
[`--max-http-header-size][] for requests received by this server.
2067-
**Default:** 8KB.
2066+
[`--max-http-header-size`][] for requests received by this server, i.e.
2067+
the maximum length of request headers in bytes.
2068+
**Default:** 8192 (8KB).
20682069
* `requestListener` {Function}
20692070

20702071
* Returns: {http.Server}
@@ -2171,7 +2172,7 @@ This can be overridden for servers and client requests by passing the
21712172
added: v0.3.6
21722173
changes:
21732174
- version: REPLACEME
2174-
pr-url: https://github.com/nodejs/node/pull/?????
2175+
pr-url: https://github.com/nodejs/node/pull/30570
21752176
description: The `maxHeaderSize` option is supported now.
21762177
- version: v10.9.0
21772178
pr-url: https://github.com/nodejs/node/pull/21616
@@ -2209,8 +2210,9 @@ changes:
22092210
* `localAddress` {string} Local interface to bind for network connections.
22102211
* `lookup` {Function} Custom lookup function. **Default:** [`dns.lookup()`][].
22112212
* `maxHeaderSize` {number} Optionally overrides the value of
2212-
[`--max-http-header-size][] for requests received by this server.
2213-
**Default:** 8KB.
2213+
[`--max-http-header-size`][] for requests received from the server, i.e.
2214+
the maximum length of response headers in bytes.
2215+
**Default:** 8192 (8KB).
22142216
* `method` {string} A string specifying the HTTP request method. **Default:**
22152217
`'GET'`.
22162218
* `path` {string} Request path. Should include query string if any.

lib/_http_client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ function ClientRequest(input, options, cb) {
173173
}
174174

175175
const maxHeaderSize = options.maxHeaderSize;
176-
if (maxHeaderSize !== undefined && (typeof maxHeaderSize !== 'number' ||
176+
if (maxHeaderSize !== undefined && (!Number.isSafeInteger(maxHeaderSize) ||
177177
maxHeaderSize < 0)) {
178178
throw new ERR_INVALID_ARG_TYPE('maxHeaderSize', 'number', maxHeaderSize);
179179
}

lib/_http_server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ function Server(options, requestListener) {
320320
this[kServerResponse] = options.ServerResponse || ServerResponse;
321321

322322
const maxHeaderSize = options.maxHeaderSize;
323-
if (maxHeaderSize !== undefined && (typeof maxHeaderSize !== 'number' ||
323+
if (maxHeaderSize !== undefined && (!Number.isSafeInteger(maxHeaderSize) ||
324324
maxHeaderSize < 0)) {
325325
throw new ERR_INVALID_ARG_TYPE('maxHeaderSize', 'number', maxHeaderSize);
326326
}

0 commit comments

Comments
 (0)