Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: early server response with data #703

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions tests/h2-tests/tests/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ async fn recv_connection_header() {
}

#[tokio::test]
async fn sends_reset_cancel_when_req_body_is_dropped() {
async fn sends_reset_no_error_when_req_body_is_dropped() {
h2_support::trace_init!();
let (io, mut client) = mock::new();

Expand All @@ -563,8 +563,11 @@ async fn sends_reset_cancel_when_req_body_is_dropped() {
client
.send_frame(frames::headers(1).request("POST", "https://example.com/"))
.await;
// server responded with data before consuming POST-request's body, resulting in `RST_STREAM(NO_ERROR)`.
client.recv_frame(frames::headers(1).response(200)).await;
client.recv_frame(frames::data(1, vec![0; 16384])).await;
client
.recv_frame(frames::headers(1).response(200).eos())
.recv_frame(frames::data(1, vec![0; 16384]).eos())
.await;
client
.recv_frame(frames::reset(1).reason(Reason::NO_ERROR))
Expand All @@ -578,7 +581,8 @@ async fn sends_reset_cancel_when_req_body_is_dropped() {
assert_eq!(req.method(), &http::Method::POST);

let rsp = http::Response::builder().status(200).body(()).unwrap();
stream.send_response(rsp, true).unwrap();
let mut tx = stream.send_response(rsp, false).unwrap();
tx.send_data(vec![0; 16384 * 2].into(), true).unwrap();
}
assert!(srv.next().await.is_none());
};
Expand Down