Skip to content

[http2] Gracefully receive headers on canceled streams #1800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

wchargin
Copy link

If a client opens a stream and then cancels it, the server may have already sent response frames back. The HTTP/2 spec says that the client MUST be prepared to receive any such frames. We already handle this correctly for data frames, but prior to this patch, header frames on a canceled stream would cause the whole connection to be torn down. This patch fixes that.

Fixes #1799.

Test Plan:
Unit tests included. Before this change, the new test would fail with "Connection is being forcefully terminated. (errorCode: 1)".

wchargin-branch: http2-headers-after-cancel


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR:
    • Changelog updated
    • Pubspec version revved
    • Tests included

wchargin added 2 commits July 26, 2025 12:03
If a client opens a stream and then cancels it, the server may have
already sent response frames back. The HTTP/2 spec says that the client
MUST be prepared to receive any such frames. We already handle this
correctly for data frames, but prior to this patch, header frames on a
canceled stream would cause the whole connection to be torn down.
This patch fixes that.

Fixes dart-lang#1799.

Test Plan:
Unit tests included. Before this change, the new test would fail with
"Connection is being forcefully terminated. (errorCode: 1)".

wchargin-branch: http2-headers-after-cancel
wchargin-source: 428af2c7cf2fc9f18884558e2b471d2d29a05998
wchargin-branch: http2-headers-after-cancel
wchargin-source: 8aed54b8d5bcc0450db8f46ab08a8012f4de1bd8
@wchargin
Copy link
Author

Hello! This is my first time writing Dart code. I tried to follow local style, and ran dart format, dart fix, and dart analyze. Please let me know if you'd like any modifications; happy to conform to your preferences.

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

Successfully merging this pull request may close these issues.

After client's RST_STREAM, headers from the server cause client to tear down connection
1 participant