Repository navigation
Conversation
…G frames are refused with the error RFC 9113 names, and a GOAWAY carries the last stream (#641) PRIORITY and PUSH_PROMISE were ignored, an RST_STREAM's payload was never looked at, a SETTINGS ACK returned before its length check, SETTINGS on a stream and SETTINGS_ENABLE_PUSH past 1 passed, and a PING was checked only for its length. Each is now refused as RFC 9113 says: - PRIORITY (6.3): on stream 0, GOAWAY(PROTOCOL_ERROR). Not five octets, a stream error of FRAME_SIZE_ERROR. A stream that depends on itself, a stream error of PROTOCOL_ERROR: RFC 9113 dropped that rule with the priority scheme, but RFC 7540 5.3.1 had it, and h2spec and nghttp2 still hold a server to it. A PRIORITY may name an idle stream, which no RST_STREAM may (6.4), so for one the connection answers with GOAWAY of the same code. A stream that is open is reset as RefuseBody resets one: its body reader ends and its response window goes, so nothing more goes out on it. RefuseBody now shares that helper, ResetOpenStream. - HEADERS: the priority fields are read, and a self-dependency is refused the same way. The block is still decoded aside, so HPACK stays in step; a new stream is reset once its block is in, with PROTOCOL_ERROR rather than the REFUSED_STREAM of a stream past the concurrency limit, which DiscardHeaderBlock now takes from a field. - PUSH_PROMISE from a client: GOAWAY(PROTOCOL_ERROR) (8.4). - RST_STREAM: on stream 0, GOAWAY(PROTOCOL_ERROR); not four octets, GOAWAY(FRAME_SIZE_ERROR) (6.4). - SETTINGS: on a stream, GOAWAY(PROTOCOL_ERROR); an ACK with a payload, GOAWAY(FRAME_SIZE_ERROR) (6.5); SETTINGS_ENABLE_PUSH other than 0 or 1, GOAWAY(PROTOCOL_ERROR) (6.5.2). - PING on a stream: GOAWAY(PROTOCOL_ERROR) (6.7). - GOAWAY's last-stream-id was always 0. It is now the highest stream the client opened, refused ones included (6.8): the client learns which requests it may retry, and REFUSED_STREAM already told it that a refused one may be. Unknown frame types are still ignored (4.1). h2spec 2.6.0 against a reactor serving h2c: the 12 cases of this issue fail on origin/main (5.3.1/1, 5.3.1/2, 5.4.1/1, 6.3/1, 6.3/2, 6.4/1, 6.4/3, 6.5/1, 6.5/2, 6.5.2/1, 6.7/3, 8.2/1) and pass with this; 35 failures go to 23. Tests: Http2ControlFrameTests, in Unit. Each malformed frame after a served stream 1 ends the connection with the expected GOAWAY naming stream 1, and stream 3 behind it is not served; PRIORITY of four octets or depending on itself resets a request still arriving and the next is served; HEADERS depending on their own stream are reset with no handler run and HPACK in step. A control sends a well-formed PRIORITY on a closed and on an idle stream, ENABLE_PUSH 0 and 1, an empty ACK and a PING, and both streams are served with the PING echoed. Run against origin/main's source every refusal test fails, "expected [GOAWAY 1 0x1], got []" and the like, and a DATA on an idle stream, refused before as well, "expected [GOAWAY 1 0x1], got [GOAWAY 0 0x1]"; the control passes either way. Suites: Unit 321, Chaos 105, Http 113, none failing.
…nection instead of resetting a stream that may never have been opened (#641) Review of #647. RefusePriority reset any stream at or below the highest the client opened. That includes an even stream, which only a server opens, and an odd one the client skipped, and RFC 9113 6.4 forbids an RST_STREAM on a stream never opened. Nothing on this branch can tell a skipped stream from one closed long ago, so only a stream that is still live (still arriving, or still being answered) is reset now. A PRIORITY on any other stream is answered with GOAWAY of the same code. Tests, Http2PriorityResetTests in Unit: - A PRIORITY of four octets on an even stream, and on an odd one skipped below the highest, ends the connection. Against the previous commit's source they fail with "expected [GOAWAY 5 0x6], got [RST_STREAM 2 0x6]" (and 3). - Coverage the review asked for, of what the previous commit already did, so these fail against origin/main's source and pass against the previous commit's: - A PRIORITY of four octets, and trailers whose priority depends on their own stream, on a stream whose handler has a body read parked and a flush parked on credit: the read raises, the flush wakes and reports the peer gone, only the RST_STREAM goes out on the stream, and a self-dependent trailer block still keeps HPACK in step. With ResetOpenStream's ReleaseCreditWaiters removed, both fail with "the flush parked on credit never woke". - A self-dependent HEADERS whose block continues in CONTINUATION is reset once the block is in, and HPACK stays in step. - Self-dependent trailers reset a buffered request that is still arriving. Http2ControlFrameTests.Fields is internal now, so these tests can use it. Suites: Unit 327, Chaos 105, Http 113, none failing.
This was referenced Nov 17, 2026
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.
Fixes #641.
PRIORITY and PUSH_PROMISE were ignored, an RST_STREAM's payload was never looked at, a SETTINGS ACK
returned before its length check, SETTINGS on a stream and SETTINGS_ENABLE_PUSH past 1 passed, and a
PING was checked only for its length. Each is now refused as RFC 9113 says:
FRAME_SIZE_ERROR. A stream that depends on itself, a stream error of PROTOCOL_ERROR: RFC 9113 dropped
that rule with the priority scheme, but RFC 7540 5.3.1 had it, and h2spec and nghttp2 still hold a
server to it. A PRIORITY may name an idle stream, which no RST_STREAM may (6.4), so for one the
connection answers with GOAWAY of the same code. A stream that is open is reset as RefuseBody resets
one: its body reader ends and its response window goes, so nothing more goes out on it. RefuseBody
now shares that helper, ResetOpenStream.
still decoded aside, so HPACK stays in step; a new stream is reset once its block is in, with
PROTOCOL_ERROR rather than the REFUSED_STREAM of a stream past the concurrency limit, which
DiscardHeaderBlock now takes from a field.
SETTINGS_ENABLE_PUSH other than 0 or 1, GOAWAY(PROTOCOL_ERROR) (6.5.2).
included (6.8): the client learns which requests it may retry, and REFUSED_STREAM already told it
that a refused one may be.
Unknown frame types are still ignored (4.1).
h2spec 2.6.0 against a reactor serving h2c: the 12 cases of this issue fail on origin/main (5.3.1/1,
5.3.1/2, 5.4.1/1, 6.3/1, 6.3/2, 6.4/1, 6.4/3, 6.5/1, 6.5/2, 6.5.2/1, 6.7/3, 8.2/1) and pass with
this; 35 failures go to 23.
Tests: Http2ControlFrameTests, in Unit. Each malformed frame after a served stream 1 ends the
connection with the expected GOAWAY naming stream 1, and stream 3 behind it is not served; PRIORITY of
four octets or depending on itself resets a request still arriving and the next is served; HEADERS
depending on their own stream are reset with no handler run and HPACK in step. A control sends a
well-formed PRIORITY on a closed and on an idle stream, ENABLE_PUSH 0 and 1, an empty ACK and a PING,
and both streams are served with the PING echoed. Run against origin/main's source every refusal
test fails, "expected [GOAWAY 1 0x1], got []" and the like, and a DATA on an idle stream, refused
before as well, "expected [GOAWAY 1 0x1], got [GOAWAY 0 0x1]"; the control passes either way.
Suites: Unit 321, Chaos 105, Http 113, none failing.