GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: normalize HTTP/2 headers for legacy dispatch handlers by Knowzzz · Pull Request #5866 · nodejs/undici

Conversation

@Knowzzz

@Knowzzz Knowzzz commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

This relates to...

Fixes #5865. Follows the HTTP/2 compatibility change in #5811.

Rationale

HTTP/2 controllers expose rawHeaders / rawTrailers as objects, whereas legacy dispatch callbacks require raw arrays. LegacyHandlerWrapper currently forwards non-null object values unchanged. With Node 22's built-in fetch, this silently drops headers, including Content-Encoding, so compressed responses fail JSON parsing.

Changes

Bug Fixes

  • Preserve existing HTTP/1.1 raw arrays without copying them.
  • Convert HTTP/2 header/trailer objects with the existing toRawHeaders helper before calling legacy onHeaders, onComplete, or onUpgrade.
  • Keep HTTP/2 support and the existing WebSocket upgrade guard unchanged.
  • Extend the native-fetch HTTP/2 fixture to assert headers, repeated cookies, and identity/gzip/deflate/br decoding.
  • Add real TLS-server coverage for HTTP/1.1 and HTTP/2 legacy headers/trailers, Latin-1 values, repeated Set-Cookie, and HTTP/2 CONNECT headers.

Features / Breaking Changes and Deprecations

None.

Validation

Node.js 22.23.2, Linux x86_64:

node --test test/dispatcher1-http2-headers.js test/node-test/global-dispatcher-version.js
# 9 passed, 1 skipped (existing Node-26-only test)
node --test test/dispatcher.js
# 2 passed
npx eslint lib/dispatcher/dispatcher1-wrapper.js test/dispatcher1-http2-headers.js test/fixtures/global-fetch-h2-only.js test/node-test/global-dispatcher-version.js
# passed

The standalone reproduction in #5865 was run against the same Node binary:

  • 8.11.0: HTTP/2, missing Content-Encoding, gzip JSON parse failure.
  • 8.10.2: HTTP/1.1, correct headers and decoded JSON.
  • This patch: HTTP/2, correct headers and decoded JSON.

The full test suite has not been validated. A broader test/http2-dispatcher.js run encountered TLS handshake failures in existing PING tests and was stopped when it did not exit. The single Should send http2 PING frames failure was reproduced on pristine main (77d7b3f), without this patch. Only JavaScript tests and targeted lint were run; no typechecks.

Status

  • I have read and agreed to the Developer's Certificate of Origin
  • Tested (targeted coverage above)
  • Benchmarked (optional)
  • Documented (issue reproduction and this PR)
  • Review ready
  • In review
  • Merge ready

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Knowzzz
fix: normalize HTTP/2 headers for legacy dispatch handlers
8da31d1
Signed-off-by: Knowzzz <[email protected]>
@Knowzzz Knowzzz mentioned this pull request Sep 23, 2026
8.11.0: native Node fetch loses HTTP/2 headers and fails to decode compressed responses #5865
Closed
@Knowzzz Knowzzz closed this Sep 23, 2026
@Knowzzz
Knowzzz deleted the codex/fix-legacy-http2-raw-headers branch September 23, 2026 04:13
@Knowzzz Knowzzz mentioned this pull request Sep 23, 2026
fix: normalize HTTP/2 headers for legacy dispatch handlers #5867
Merged
4 of 7 tasks
@Knowzzz

Knowzzz commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

Replaced by #5867 after renaming the source branch. Same commit (8da31d1), no code changes. Please use #5867 for review.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

8.11.0: native Node fetch loses HTTP/2 headers and fails to decode compressed responses

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@Knowzzz
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.