Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion h3/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,8 @@ where
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<Option<impl Buf>, StreamError>> {
if !self.stream.has_data() {
// Empty DATA frames do not end the body.
while !self.stream.has_data() {
match ready!(self.stream.poll_next(cx)) {
Err(frame_stream_error) => {
return Poll::Ready(Err(
Expand Down
21 changes: 21 additions & 0 deletions h3/src/tests/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,27 @@ async fn request_valid_header_multiple_data_trailer() {
.await;
}

#[tokio::test]
async fn request_valid_empty_data_frames() {
for with_trailers in [false, true] {
request_sequence_ok(|mut buf| {
request_encode(
&mut buf,
Request::post("http://localhost/salut").body(()).unwrap(),
);
for chunk in ["", "", "hello", "", "", " world", "", ""] {
Frame::Data(Bytes::from(chunk)).encode_with_payload(&mut buf);
}
if with_trailers {
let mut trailers = HeaderMap::new();
trailers.insert("trailer", "value".parse().unwrap());
trailers_encode(buf, trailers);
}
})
.await;
}
}

#[tokio::test]
async fn request_valid_header_trailer() {
request_sequence_ok(|mut buf| {
Expand Down