arturobernalg opened a new pull request, #1272:
URL: https://github.com/apache/tomcat/pull/1272

   A `PRIORITY_UPDATE` frame that references a stream not in the stream map is 
treated as a connection error. This covers an idle stream, and a closed stream 
that has already been pruned. The client gets `GOAWAY` `PROTOCOL_ERROR` and 
every stream on the connection is lost.
   
   RFC 9218 allows both cases:
   
   - Section 7: "A client MAY send a PRIORITY_UPDATE frame before the stream 
that it references is open" and "Servers SHOULD buffer the most recently 
received PRIORITY_UPDATE frame and apply it once the referenced stream is 
opened."
   - Section 7.1: servers can discard frames where the prioritized stream ID 
refers to a stream in the half-closed (local) or closed state.
   
   The only connection errors section 7.1 requires for these frames are:
   
   - a frame for an idle push stream;
   - a frame that makes the prioritized idle streams plus the active streams 
exceed `SETTINGS_MAX_CONCURRENT_STREAMS`.
   
   Reproduced on a standalone Tomcat (h2c, NIO, both `useAsyncIO` values): 
connection preface, `PRIORITY_UPDATE` for stream 1, then `HEADERS` for stream 1 
gives `GOAWAY` (last stream 0, `PROTOCOL_ERROR`). With this change the request 
is served.
   
   Changes:
   
   - Retain the priority for an idle request stream. Apply it once the request 
header fields have been processed, so that it overrides any `priority` header 
field as section 7 describes.
   - When a stream is opened, drop the retained priorities for it and for any 
lower numbered idle streams, which are implicitly closed (RFC 9113, section 
5.1.1).
   - Ignore frames for closed streams.
   - Keep the section 7.1 connection errors: an idle push stream (server push 
is not supported), and exceeding the concurrent streams limit.
   
   Tests in `TestRfc9218` cover:
   
   - an idle stream;
   - an idle priority overriding the `priority` header field;
   - a closed and pruned stream;
   - the concurrent streams limit;
   - an idle push stream;
   - a malformed request on a prioritized idle stream.
   
   All six new tests fail without the change. The HTTP/2 tests pass with it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to