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

handling gzip encoded http responses? #366

Closed
huyng opened this issue May 21, 2024 · 4 comments
Closed

handling gzip encoded http responses? #366

huyng opened this issue May 21, 2024 · 4 comments

Comments

@huyng
Copy link

huyng commented May 21, 2024

A lot content on the web is hosted using gzip encoding.

For example the following command produces a lot of binary data output since github responds with gzip encoding by default.

megfile head https://raw.githubusercontent.com/huyng/table-bench/main/table.csv

To see the raw text, you have to pipe it through gunzip like so:

megfile head https://raw.githubusercontent.com/huyng/table-bench/main/table.csv | gunzip

Do you plan on supporting this gzip streaming in your library? Thank you for creating this amazing tool.

@LoveEatCandy
Copy link
Collaborator

I will support decoding gzip content over http, is that enough for you?
I think http is a special situation that i should decode the gzip content like browser, but .gz files should be decoded by user.

@huyng
Copy link
Author

huyng commented May 22, 2024

yes I think the behavior you outline is the one I had in mind as well. Mainly: if the server sends back an http header of Content-Encoding: gzip or Content-Encoding: deflate then the library will take care of gunzipping the content for the user.

@LoveEatCandy
Copy link
Collaborator

Header Content-Encoding has been supported in megfile>=3.0.5. Thank you for your issue, it's very important for us.

@huyng
Copy link
Author

huyng commented May 28, 2024

Excellent it works! Thank you for adding this functionality.

@huyng huyng closed this as completed May 28, 2024
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

No branches or pull requests

2 participants