doc: fix incorrect default for maxHeadersCount - #65505
Open
suraj-shrivastav wants to merge 1 commit into
Open
Conversation
request.maxHeadersCount and server.maxHeadersCount were documented with a default of 2000. The underlying parser limit, MAX_HEADER_PAIRS in lib/_http_common.js, is a count of name/value pairs (2 slots per header), so the effective maximum number of headers is 1000, not 2000. Verified against a running server: sending 1000 headers returns all of them, while sending 1001 headers still returns only 1000, with the extra header silently dropped. Fixes: nodejs#65470 Signed-off-by: suraj-shrivastav <suraj.shrivastavvv@gmail.com>
Collaborator
|
Review requested:
|
Member
|
Duplicate of #65472. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
request.maxHeadersCount and server.maxHeadersCount are documented with a
default of 2000. The underlying parser limit, MAX_HEADER_PAIRS in
lib/_http_common.js, counts name/value pairs (2 slots per header), so the
effective maximum number of headers is 1000, not 2000.
Also note that in practice server.maxHeadersCount and
request.maxHeadersCount default to null (see lib/_http_server.js and
lib/_http_client.js); when null, the wiring that sets
parser.maxHeaderPairs from the option never runs, and the parser falls
back to its own hardcoded 2000-pair (1000-header) constant. This PR keeps
the documented default as a plain number for consistency with the
existing docs style and focuses on correcting the number itself.
Verified against a live server: sending 1000 custom headers returns all
1000 in req.headers, while sending 1001 still returns only 1000, with the
1001st silently dropped. This confirms the effective cap is 1000 headers.
Fixes: #65470
Disclosure: root cause and fix were researched and drafted with the
assistance of a closed-source coding agent, then verified by hand against
the live source and a running server before submitting.