Skip to content

doc: document different duplicate header rules in http2 - #68020

Open
hicay wants to merge 1 commit into
nodejs:mainfrom
hicay:doc/http2-duplicate-headers
Open

hicay wants to merge 1 commit into
nodejs:mainfrom
hicay:doc/http2-duplicate-headers

Conversation

@hicay

@hicay hicay commented Dec 4, 2026 •

Copy link
Copy Markdown

The node:http2 documentation lists the incoming headers that discard duplicates. The node:http documentation has a different list. No page tells users about this difference. Thus, an application that serves both protocols can get different values for the same request.

I did a test on v26.14.0. I sent each header below two times (one and two), on HTTP/1.1 and on HTTP/2. Then I compared req.headers:

Header node:http node:http2
date, if-match, if-none-match, if-range, range, content-language, content-location, content-md5, content-range, dnt, tk, upgrade-insecure-requests, x-content-type-options, access-control-allow-credentials, access-control-max-age, access-control-request-method 'one, two' 'one'
server 'one' 'one, two'

This change adds a short note after the node:http2 list. The note gives examples of the difference. It also tells users to use the raw headers when they must get all values.

This change is documentation only. It does not change behavior. node tools/lint-md/lint-md.mjs doc/api/http2.md passes.

AI disclosure: A coding agent helped me write this note and run the header test. I examined the result against the source code: kSingleValueFields in lib/internal/http2/util.js and the known-field table in lib/internal/http/incoming.js.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/http2
  • @nodejs/net

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

Caution

AgentScan found account activity patterns that may be consistent with automation. This is a heuristic, not proof that this pull request was opened by an agent or violates policy. AI-assisted contributions are permitted, but automated tooling must not open pull requests without advance approval, and contributors must personally understand, test, verify, and take responsibility for every submitted change. See the AgentScan analysis, AI use policy, and automation policy for additional context.

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to Node.js documentation. http2 Issues and PRs related to the http2 subsystem. labels Dec 4, 2026
The node:http2 and node:http modules use different lists of incoming
headers that discard duplicates. For example, node:http joins duplicate
date, if-match, and range headers, but node:http2 discards them. For
the server header, the behavior is the opposite.

Add a note after the node:http2 list. The note tells users about the
difference. It also tells them to use the raw headers when they must
get all values.

Signed-off-by: hicay <caglarispirli@gmail.com>
@hicay hicay changed the title doc: note that http2 and http merge duplicate headers differently doc: document different duplicate header rules in http2 Dec 4, 2026
@hicay
hicay force-pushed the doc/http2-duplicate-headers branch from 37119fe to 9755b61 Compare December 4, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agentscan:automated-account doc Issues and PRs related to Node.js documentation. http2 Issues and PRs related to the http2 subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants