Skip to content

http2: don't fail response reads after clean RST_STREAM - #67558

Open
pimterry wants to merge 2 commits into
nodejs:mainfrom
pimterry:fix-h2-response-with-reset
Open

pimterry wants to merge 2 commits into
nodejs:mainfrom
pimterry:fix-h2-response-with-reset

Conversation

@pimterry

Copy link
Copy Markdown
Member

RFC 9113 allows servers to send a response and then ask the client to cancel their request:

A server can send a complete response prior to the client sending an entire request if the response does not depend on any portion of the request that has not been sent and received. When this is true, a server MAY request that the client abort transmission of a request without error by sending a RST_STREAM with an error code of NO_ERROR after sending a complete response (i.e., a frame with the END_STREAM flag set). Clients MUST NOT discard responses as a result of receiving such a RST_STREAM, though clients can always discard responses at their discretion for other reasons.

The client side of this wasn't fully covered in #63249. We previously always destroyed the stream when receiving a reset, and just used the code to decide whether it was clean or an error, but the destroy meant that we discarded the pending response.

This PR fixes that: if a server cancels a client's request with a RST_STREAM after sending a full response, the client now keeps the response (and skips future writes). This extends the fix from #67553 to resolve #66693 on main and v27 as well.

Signed-off-by: Tim Perry <pimterry@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http2
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added http2 Issues and PRs related to the http2 subsystem. needs-ci PRs that need a full CI run. labels Nov 17, 2026
@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.70%. Comparing base (1c40cfa) to head (2db71c5).
⚠️ Report is 44 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67558      +/-   ##
==========================================
+ Coverage   90.67%   90.70%   +0.03%     
==========================================
  Files         800      801       +1     
  Lines      280889   280730     -159     
  Branches    54274    54192      -82     
==========================================
- Hits       254684   254650      -34     
+ Misses      16295    16259      -36     
+ Partials     9910     9821      -89     
Files with missing lines Coverage Δ
lib/internal/http2/core.js 95.02% <100.00%> (+0.05%) ⬆️

... and 73 files with indirect coverage changes

🚀 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.

Clean up & (hopefully) deflake the new test
@pimterry pimterry added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 18, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 18, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

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

Labels

http2 Issues and PRs related to the http2 subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

http2: async iterator rejects complete buffered response after NO_ERROR reset with request side open

3 participants