Repository navigation
Support Content-Encoding: gzip #48
Description
Activity
Yes on both, but IIRC nginx has some config option to exclude certain clients because they have issues decoding: http://nginx.org/en/docs/http/ngx_http_gzip_module.html#gzip_disable Generally those options are interesting to look at and see if we should consider some of them.
@WyriHaximus I need to prevent streaming chunks of data if a response has Content-Encoding. Are you ok with it? I mean - it must be some kind of buffer.
@WyriHaximus I need to prevent streaming chunks of data if a response has Content-Encoding. Are you ok with it? I mean - it must be some kind of buffer.
I'm not sure I follow :) Have you seen https://github.com/clue/php-zlib-react ?
- should it be encoded automatically when got Accept-Encoding: gzip in major qvalue?
We should probably add some kind of config for the consumer of this lib to decide whether compression makes sense in the first place.
- should force encoding be triggered by specifying Content-Encoding: gzip header by a user?
I'm undecided on this tbh. I'd love to see a PR so we see its implications 👍 Also, how do others (node etc.) handle this?
@clue with regards to reactphp/http-client#50 (comment) how likely is it that we could implement this at all?
The known inconsistencies essentially boil down to this:
- PHP 7+ exhibits a minor bug when compressing an empty string (edge case that could easily be worked around)
- HHVM buffers everything in memory, so it's not reasonable to rely on this at all
- All other versions work just fine
- For PHP 7+ we may want to look into addressing Approach: Build on top of deflate_init() / inflate_init() clue/reactphp-zlib#4, which should be more reliable
This means that implementing this here appears reasonable as long as we provide some level of control for the consumer to explicitly enable/disable this in case they are affected by one of these inconsistencies.
- changed the title
[-]gzip Content-Encoding[/-][+]Support Content-Encoding: gzip[/+]on Feb 10, 2017 Since ReactPHP Supports now Middlewares.. I made up a quick and dirty gzip compressor for php7+
https://gist.github.com/christoph-kluge/a8a3d4cc217fa42c9b2a38c3acd0a745might be a good starting point.
Reacted by Christian Lück, Jan Sorgalla and Chris BodenReacted by Christian Lück@ephrin if you take a look at the 3rd party middleware-wiki-page then you'll find the christoph-kluge/reactphp-http-response-compression-middleware. Does this solve your issue?
Reacted by Cees-Jan Kiewiet, Jan Sorgalla, Volodymyr Myrza and Christian Lück@christoph-kluge it should ^) but am currently not working on this and no plans for future regarding
Closing as this seems to be resolved.
as mentioned in #35 (comment)
could be interesting to implement gzip encoding for server responses.
So I've started some impl and researches.
Now I have some questions:
Accept-Encoding: gzipin major qvalue?Content-Encoding: gzipheader by a user?