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

Support compression in fetch() #208

Open
Zegnat opened this issue Nov 19, 2018 · 2 comments
Open

Support compression in fetch() #208

Zegnat opened this issue Nov 19, 2018 · 2 comments
Milestone

Comments

@Zegnat
Copy link
Member

Zegnat commented Nov 19, 2018

This became clear when inspecting indieweb/indiewebify-me#78.

Curl does not automatically support any compression. This is problematic as it also does not send an Accept-Encoding header. Note that not sending the header at all suggests to the server that any encoding is fine, and they are free to respond with a compressed format. It looks like most will not do this though, or this would have come up before.

I think we have two clear options:

  1. Specify a specific Accept-Encoding value of identity, which should tell servers never to send compressed data; or

  2. defining CURLOPT_ENCODING to automatically have Curl handle the compressions it knows about (DEFLATE and gzip):

    curl_setopt($ch, CURLOPT_ENCODING, '');
@Zegnat
Copy link
Member Author

Zegnat commented Nov 19, 2018

Alternatively I wonder if we should offload this to an external dependency. Maybe even aaronpk/p3k-http. That way all those weird extra flags we need for HTTP/2, gzip, etc., only need to get added once and multiple projects will profit from it.

Thoughts, @aaronpk?

@aaronpk
Copy link
Member

aaronpk commented Nov 19, 2018

One of the goals of this library is to be self-contained so that it can be included in other projects without bringing in a lot of other dependencies. I think it's best to just add this flag here rather than bring in p3k-http or any other http client.

@gRegorLove gRegorLove added this to the 0.5.1 milestone Apr 25, 2020
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

3 participants