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

Poll inner connection until EOF after gzip decoder is complete #2484

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Andrey36652
Copy link

Fix for #2381

let stream_reader = gzip_decoder.get_mut();
let peekable_io_stream = stream_reader.get_mut();
match futures_core::ready!(Pin::new(peekable_io_stream).poll_next(cx)) {
Some(Ok(bytes)) => Poll::Ready(Some(Ok(Frame::data(bytes)))),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is should likely be an error. If you said a response's content-encoding: gzip, it's assumed the entire content is encoded. If there's some dangling data that isn't, that seems bad.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could there be multiple consecutive chunks (Transfer-Encoding: chunked) in body?
And what about HTTP trailers?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and most likely the compressed body came over multiple chunks. But content-encoding implies the entire content.

Trailers would come through as a different Frame, but the IoStream already tosses them. We could (in a separate PR, perhaps) reach into the IoStream and poll that instead, to support trailers.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, can it be like this?

|--------------original-content--------------------|
|-----gzip-content-1-----||-----gzip-content-2-----|
|-chunk-1-||---chunk-2---||----------chunk-3-------|

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Some(Ok(bytes)) should return error, then what kind of error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants