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 #5867 · nodejs/undici

Conversation

@Knowzzz

@Knowzzz Knowzzz commented Sep 23, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

This relates to...

Fixes #5865. Supersedes #5866 after renaming the source branch.

Rebased onto main at 8145595. Main has since reverted #5811 in #5860; this PR preserves that revert, including the HTTP/1.1 restriction for legacy dispatcher consumers and the native-fetch redirect regression test.

Rationale

HTTP/2 controllers expose rawHeaders / rawTrailers as objects, whereas legacy dispatch callbacks require raw arrays. LegacyHandlerWrapper currently forwards non-null object values unchanged.

The normalization remains necessary when Dispatcher1Wrapper.wrapHandler() is used directly with an HTTP/2-capable dispatcher. This PR does not re-enable HTTP/2 for legacy global fetch.

Changes

  • 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.
  • Preserve main's allowH2: false dispatch guard and native-fetch redirect/WebSocket behavior.
  • Keep the upstream deletion of the HTTP/2-only native-fetch fixture.
  • Exercise the handler bridge directly against real TLS servers: HTTP/1.1 and HTTP/2 headers/trailers, Latin-1 values, repeated Set-Cookie, and HTTP/2 CONNECT headers.

No public API or type changes.

Validation

Node.js 22.23.2 and 24.20.0, Linux x86_64:

npm ci --ignore-scripts --no-audit --no-fund
npm run generate-pem
node --test --test-timeout=15000 \
  test/dispatcher1-http2-headers.js \
  test/node-test/global-dispatcher-version.js \
  test/dispatcher.js \
  test/websocket/issue-4989.js
# Each Node version: 11 passed, 1 skipped (existing Node-26-only test)

npx eslint lib/dispatcher/dispatcher1-wrapper.js \
  test/dispatcher1-http2-headers.js \
  test/node-test/global-dispatcher-version.js
# passed (Node 24)
git diff --check upstream/main
# passed

The first run before generating the PEM fixtures failed TLS handshakes; after the repository's certificate-generation step, both Node versions passed. The full test suite has not been run. No typechecks.

Status

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

Sorry, something went wrong.

Uh oh!

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

All reactions
This was referenced Sep 23, 2026
fix: normalize HTTP/2 headers for legacy dispatch handlers #5866
Closed
8.11.0: native Node fetch loses HTTP/2 headers and fails to decode compressed responses #5865
Closed
@mcollina

mcollina commented Sep 23, 2026

Copy link
Copy Markdown
Member

There are conflicts now, unfortunatelyt.

All reactions

Sorry, something went wrong.

Uh oh!

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

@Knowzzz
fix: normalize HTTP/2 headers for legacy dispatch handlers
40736a3
Signed-off-by: Knowzzz <[email protected]>
@Knowzzz
Knowzzz force-pushed the fix-legacy-http2-raw-headers branch from 8da31d1 to 40736a3 Compare September 23, 2026 14:36
@Knowzzz

Knowzzz commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the heads-up @mcollina! Rebased on latest main and resolved the conflicts. The revert from #5860 is preserved, and the targeted tests pass on Node 22 and 24.

All reactions

Sorry, something went wrong.

Uh oh!

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

metcoder95
metcoder95 approved these changes Sep 24, 2026
View reviewed changes
@codecov-commenter

codecov-commenter commented Sep 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.89%. Comparing base (8145595) to head (40736a3).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5867      +/-   ##
==========================================
- Coverage   93.90%   93.89%   -0.01%     
==========================================
  Files         110      110              
  Lines       39901    39907       +6     
==========================================
+ Hits        37470    37472       +2     
- Misses       2431     2435       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
All reactions

Sorry, something went wrong.

Uh oh!

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

mcollina
mcollina approved these changes Sep 24, 2026
View reviewed changes

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sorry, something went wrong.

Uh oh!

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

All reactions
@mcollina
mcollina merged commit 5e6e0e9 into nodejs:main Sep 24, 2026
36 of 38 checks passed

Uh oh!

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

@github-actions github-actions Bot mentioned this pull request Oct 14, 2026
[Release] v8.12.0 #6008
Merged
@delbyte delbyte mentioned this pull request Nov 4, 2026
fix(deps): bump undici and postcss-selector-parser pins withzeusai/app-template#182
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mcollina mcollina mcollina approved these changes
@metcoder95 metcoder95 metcoder95 approved these changes

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.

4 participants

@Knowzzz @mcollina @codecov-commenter @metcoder95
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.