hyper = { version = "1.1.0", features = ["full"] }
tokio = { version = "1", features = ["full"] }
http-body-util = "0.1"
hyper-util = { version = "0.1", features = ["full"] }
futures-channel = { version = "0.3", features = ["sink"] }
futures-util = { version = "0.3", default-features = false, features = ["alloc", "sink"] }
bytes = "1.6.0"
h2 = "0.4"
http = "1.1.0"
Platform
Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:49 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6020 arm64
Description
Silent failure on HTTP2 server reading request body when client sends RST_STREAM(CANCEL) on the stream containing request body.
In the example repro, the client is sending request body containing payload, followed by RST_STREAM(CANCEL) frame. Since the server is reading canceled stream, request.body_mut().collect().await.unwrap().to_bytes() is expected to trigger a panic via unwrap(). However, the function call returns the payload successfully without any indication of error.
After digging through the PR history, the changes to ignore CANCEL and NO_ERROR code on RST_STREAM was introduced in https://github.com/hyperium/hyper/pull/3275 in response to issue https://github.com/hyperium/hyper/issues/2872. While this may be an expected behavior, is there a way to read stream more gracefully on the server such that the error on RST_STREAM is propagated?
Version
Platform
Description Silent failure on HTTP2 server reading request body when client sends
RST_STREAM(CANCEL)
on the stream containing request body.In the example repro, the client is sending request body containing payload, followed by
RST_STREAM(CANCEL)
frame. Since the server is reading canceled stream,request.body_mut().collect().await.unwrap().to_bytes()
is expected to trigger a panic viaunwrap()
. However, the function call returns the payload successfully without any indication of error.After digging through the PR history, the changes to ignore
CANCEL
andNO_ERROR
code onRST_STREAM
was introduced in https://github.com/hyperium/hyper/pull/3275 in response to issue https://github.com/hyperium/hyper/issues/2872. While this may be an expected behavior, is there a way to read stream more gracefully on the server such that the error onRST_STREAM
is propagated?Repro https://github.com/sirahd/hyper-http2-rst-stream-cancel-repro
server code snippet:
client code snippet: