fix: preserve HTTP/2 for non-upgrade legacy requests - #5811
Open
mcollina wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5811 +/- ##
==========================================
- Coverage 93.52% 93.48% -0.05%
==========================================
Files 110 110
Lines 39415 39522 +107
==========================================
+ Hits 36864 36947 +83
- Misses 2551 2575 +24 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
fetch()to negotiate HTTP/2 through an Undici v8 global dispatcherfetch()Why
Dispatcher1Wrappercurrently forcesallowH2: falsefor every request. On Node.js versions whose built-in fetch consumesundici.globalDispatcher.1, this prevents a configured Undici v8 dispatcher from reaching servers that only advertiseh2through ALPN.The override was introduced for legacy WebSocket consumers that cannot retry with HTTP/1.1 when HTTP/2 Extended CONNECT is unavailable. Scoping it to upgrade requests preserves that workaround without changing the protocol for ordinary fetch traffic.
Refs: #4989 and #4990.
Tests
npm run lintnpx borp -p "test/node-test/global-dispatcher-version.js"on Node.js 22.22.1, 24.18.1, and 26.8.1npx borp -p "test/websocket/issue-4989.js"on Node.js 22.22.1, 24.18.1, and 26.8.1npm run test:unit(one unrelated high-concurrency failure intest/issue-4880.js; isolated rerun passed)