Make processing of RST_STREAM more lenient (original) (raw)
Jetty version(s)
12.1.x
Enhancement Description
RFC 9113 forbids (in section §5.1) to send RST_STREAM for "closed" streams.
However, this happens in non-compliant implementations.
We could make processing of RST_STREAM more lenient, with the following rules:
- If the stream is "remote half-closed" already, receiving a RST_STREAM is ignored on the receiving side, and only interpreted as the will to stop the sending side. If the sending side is already complete, the RST_STREAM is effectively ignored.
- If the stream is not "remote half-closed", then the RST_STREAM will cause the discarding of unread data (and reclaim the flow control window accordingly) on the receiving side, and stop the sending side.
- A RST_STREAM for an already "closed" stream is already ignored. This would be the case for a second (or third, etc.) RST_STREAM.
Currently, case 1 is treated like case 2, and this produces random errors in applications, that sometime read the data before the RST_STREAM is processed, but some other times the RST_STREAM processing discard already arrived data before the application has a chance to read it.