fix: retry refused HTTP/2 streams - #5598
Open
mcollina wants to merge 1 commit into
Open
Conversation
Signed-off-by: Matteo Collina <hello@matteocollina.com>
ronag
approved these changes
Jul 27, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5598 +/- ##
==========================================
+ Coverage 93.47% 93.49% +0.01%
==========================================
Files 110 110
Lines 38238 38327 +89
==========================================
+ Hits 35744 35833 +89
Misses 2494 2494 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
trivikr
approved these changes
Jul 28, 2026
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.
This relates to...
HTTP/2 peers can reject an unprocessed stream with
RST_STREAM(REFUSED_STREAM). Node.js surfaces this as the genericERR_HTTP2_STREAM_ERROR, and Undici previously failed the request without considering the retry-safe HTTP/2 reset code.Rationale
RFC 9113 section 8.7 permits clients to retry a request rejected with
REFUSED_STREAM, including non-idempotent requests, because the peer asserts that no application processing occurred. It also says clients should not automatically retry the same request more than once.Changes
Features
N/A
Bug Fixes
NGHTTP2_REFUSED_STREAMusingstream.rstCodebefore response headers are exposed.Buffer, orBlob.error.http2ErrorCodewhen an error is ultimately exposed.Breaking Changes and Deprecations
None.
Status
Validation:
npm run test:h2:core— 96 passednpm run test:h2:fetch— 11 passednpx eslint lib/dispatcher/client-h2.js test/http2-refused-stream.jsnpm run lint