Skip to content

Conversation

bentsku
Copy link
Contributor

@bentsku bentsku commented Apr 14, 2023

As reported in #8139, the new S3 provider will decode gzip encoded requests before returning the data.
This was due to our Proxy and more specifically our SimpleHttpClient, which uses requests under the hood. Requests automatically decode the response, and we need the raw data underneath. I've duplicated our http client to not do a drastic change and only use it in the virtual host part of S3, we can then see if it creates issues or not 😄

I didn't add unit tests as I believe it could be added on top of #8104, and don't want to create too many conflicts.

About requests and decoding gzip:
https://docs.python-requests.org/en/latest/community/faq/#encoded-data

fixes #8139

@bentsku bentsku changed the title fix auto decoding of gzip for proxied requests fix auto decoding of gzip for s3 host proxied requests Apr 14, 2023
@bentsku bentsku changed the title fix auto decoding of gzip for s3 host proxied requests fix auto decoding of gzip for s3 vhost proxied requests Apr 14, 2023
@bentsku bentsku self-assigned this Apr 14, 2023
@bentsku bentsku added the aws:s3 Amazon Simple Storage Service label Apr 14, 2023
@coveralls
Copy link

Coverage Status

Coverage: 82.017% (+0.006%) from 82.011% when pulling 06b3e40 on fix-s3-vhost-gzip into 1c32bf4 on master.

@github-actions
Copy link

LocalStack Community integration with Pro

1 902 tests   1 700 ✔️  1h 19m 30s ⏱️
       2 suites     202 💤
       2 files           0

Results for commit 06b3e40.

Copy link
Member

@thrau thrau left a comment

Choose a reason for hiding this comment

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

LGTM! I appreciate you tried to leave the base implementation unmodified! It seems we should probably add this as a transparent feature to the default client though. Definitely not part of this PR though :-)

:shipit:

@bentsku
Copy link
Contributor Author

bentsku commented Apr 17, 2023

LGTM! I appreciate you tried to leave the base implementation unmodified! It seems we should probably add this as a transparent feature to the default client though. Definitely not part of this PR though :-)

:shipit:

Thanks! Yes I am a bit wary when modifying a central piece like this one, and thought we could try it on S3 first. I guess it's also a nice part in our new push towards streaming responses, and it's good to see it seems to work this way! I'll merge after 2.0.2 :shipit: but agreed about merging this in one implementation, maybe with the simple keyword stream like requests, or just by default. We will see then!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws:s3 Amazon Simple Storage Service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: S3 automatically decodes gzip requests (it should leave that to the client)
3 participants