Repository navigation
feat(http2): tell a reset upgraded stream from a half-close - #4255
Open
robertream wants to merge 1 commit into
Open
robertream wants to merge 1 commit into
robertream wants to merge 1 commit into
Conversation
An `Upgraded` stream over HTTP/2 is a CONNECT stream, and `RST_STREAM` is the only way its peer can end one abruptly. Every reset read as an end of stream, so an application could not tell an abandoned session from a peer that had finished. Nothing else on the stream carries the distinction: the write half reports the same error a poll later for a clean half-close as for a reset. `Builder::upgrade_reset_is_error` opts in to reading any reset but `NO_ERROR` as `ConnectionReset`, on both ends. Off by default, because reading `CANCEL` as a close is what RFC 8441 relies on, where a reset is the connection going away under a protocol that signals its own close in-band. A protocol whose session is the CONNECT stream itself needs the opposite. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013CWmskbkrYMCKcuYaufajw
This branch has not been deployed
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.
An upgraded HTTP/2 stream is a CONNECT stream, and
RST_STREAMis the only way its peer can end one abruptly. Every reset currently reads as an end of stream, so an application cannot tell an abandoned session from a peer that finished.I need this for a WebTransport over HTTP/2 implementation, where the session is the CONNECT stream itself: a reset means the peer abandoned it, and reading that as a clean close reports a signal the peer never sent.
Opt-in, and the default is unchanged. With the flag off the match arms resolve exactly as before, which keeps the
CANCEL-reads-as-close behaviour RFC 8441 relies on. Two tests cover both settings, and the flag is the only difference between them.This needs nothing new from h2, only
Reason::NO_ERRORandReason::CANCEL, so it stands alone from hyperium/h2#993.