Skip to content

fix(body): skip empty chunks during gzip decoding #480

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

Merged
Merged
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
9 changes: 7 additions & 2 deletions lib/src/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,13 @@ impl HttpBody for Body {
decoder_state.get_mut().get_mut().split().freeze();
// put the body back, so we can poll it again next time
self.chunks.push_front(chunk);

return Poll::Ready(Some(Ok(resulting_bytes)));
if resulting_bytes.is_empty() {
// If we got no bytes from this chunk, it might be just the gzip header
// we'll continue the loop to process more chunks
continue;
} else {
return Poll::Ready(Some(Ok(resulting_bytes)));
}
}
}
}
Expand Down
Loading