Repository navigation
Accept HTTP/2 PRIORITY_UPDATE frames for idle and closed streams - #1272
Open
arturobernalg wants to merge 1 commit into
Open
arturobernalg wants to merge 1 commit into
arturobernalg wants to merge 1 commit into
Conversation
RFC 9218, section 7 allows a client to send a PRIORITY_UPDATE frame before the stream it references is opened, and servers SHOULD retain it and apply it once the stream is opened. Section 7.1 allows servers to discard frames for closed streams. A PRIORITY_UPDATE frame for a stream that was not in the stream map, whether idle or closed and pruned, was treated as a connection error. Retain the priority for an idle request stream and apply it once the request header fields have been processed so that it overrides any priority header field. Ignore frames for closed streams. Keep the connection errors required by section 7.1 for an idle push stream and when the prioritized idle streams plus the active streams would exceed the maximum number of concurrent streams.
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.
Tomcat drops the whole connection (GOAWAY with PROTOCOL_ERROR) when a client sends a PRIORITY_UPDATE for a stream it hasn't opened yet, or for one that was already closed and pruned.
RFC 9218 explicitly allows the first case. Section 7 says a client MAY send PRIORITY_UPDATE before the stream is open, and the server SHOULD keep it and apply it once the stream opens. For closed streams, section 7.1 says the server can just discard the frame.
It's easy to reproduce over h2c. Send the preface, a PRIORITY_UPDATE for stream 1, then HEADERS for stream 1, and you get a GOAWAY instead of the response.
With this change, the priority for an idle stream is kept and applied once the request headers are in, so it wins over a priority header, as section 7 suggests. Frames for closed streams are ignored. The two errors section 7.1 does require are still there: a PRIORITY_UPDATE for an idle push stream, and going over SETTINGS_MAX_CONCURRENT_STREAMS with idle plus active streams.
Tests are added to TestRfc9218.