-
Notifications
You must be signed in to change notification settings - Fork 39
CompressStream and DecompressStream really handles deflate content encoding #64
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
Comments
Are we sure this is an error from our side ? it seems that the deflate of httpbin return in fact a compress, test it with : <?php
$payload = file_get_contents('http://httpbin.org/deflate');
var_dump(gzinflate($payload));
var_dump(gzuncompress($payload)); |
That was my first thought, so I tested it at http://www.gidnetwork.com/tools/gzip-test.php which reports that http://httpbin.org/deflate compression type is Also, reading http://php.net/manual/en/filters.compression.php I saw that all examples related to It would be useful to have another endpoint to test the |
This indicate that PHP may be wrong then as here : https://github.com/php/php-src/blob/master/ext/zlib/php_zlib.h#L31 You can see that PHP_ZLIB_ENCODING_RAW is -15, and this windows size is used by the gzdeflate / gzinflate php function as see here : https://github.com/php/php-src/blob/master/ext/zlib/zlib.c#L728 However php doc say in http://php.net/manual/en/function.gzdeflate.php is RFC 1950 + 1951 so it should use the windows size of 15 and not -15 no ? |
So finally, PHP is right, it's the right window as a deflate stream like said in RFC 1951 is basically a RFC 1950 withtout the headers which is created in zlib by specifing a window of -15 However if you look at httpbin here : https://github.com/Runscope/httpbin/blob/master/httpbin/filters.py#L79 They use This window size set a header like specified in RFC 1950 (but no compliant with 1951). Both RFC use the same compression algorithm that's why i think http://www.gidnetwork.com/tools/gzip-test.php report this as being a deflate (to test, but i think it will indicate deflate with or without the headers) |
The best definition for the
Another test tool that identifies http://httpbin.org/deflate as
So I think that the right window size to use is Anyway, as long as major HTTP servers like Apache and Nginx only support GZIP compression, I think we must deprecate |
Yes, right, deflate is the a windows size of 15, i think i misinterpret some functions names and http content encoding. In fact there is no "compress" support in PHP, and we should not support this IMO as there is no interest (since everybody use deflate nowadays) |
Finally, I think our Stream is right, maybe the wording is a little wrong, but Compress is RFC 1950, and Deflate is RFC 1951. The only update here could maybe be a documentation change to explain better which one to use (in fact there is no interest to use directly the Deflate / Inflate Stream). However the
|
IMO we must even deprecate the |
do you want to deprecate deflate because its not used by common web
servers or do you think we can't get it to work properly?
i expect this library to also be used in layered architecture, where the
client talks to a server done by the same developers as the client and
they could be doing specific things or use a specific server and want
deflate i expect. or somebody needs to talk to odd servers they can't
control that do deflate...
|
I think that Anyway, it's trivial to fix, so maybe we should drop support for |
as long as we can make reasonably sure that we handle it correctly and its not a huge effort, i'd prefer to keep it in for completeness sake. |
Closing this as this issue was more in the client-common and was fixed a long time ago |
Actual Behavior
An stream encoded with
deflate
content-encoding cannot be read byInflateStream
, but withDecompressStream
.Expected Behavior
The
deflate
content-encoding should be managed byInflateStream
andDeflateStream
whileCompressStream
andDecompressStream
should handlecompress
content-encoding.Steps to Reproduce
Possible Solutions
To avoid BC breaks, I think we should add a warning in the documentation and in the class docblocks
and rename them in 2.0.
I'm looking for and HTTP endpoint to test
compress
content-encoding, but I have not found anyone.The text was updated successfully, but these errors were encountered: