-
Notifications
You must be signed in to change notification settings - Fork 498
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
Requests::decompress falsely determines content is not compressed #301
Comments
Here's a sample I was able to reproduce: 301.gz from Elasticsearch 5.x Elasticpress encodes the data using deflate (zlib-encoded) but with a 3 compression level (see elastic/elasticsearch@b6a3952#diff-fc41ed568e8f9fe5f2ffd4a2d410295aR53) resulting in a header with bytes We have to support Patch incoming. |
Different compression levels yield a specific second byte in the magic header for the deflate encoding. All of them can be decoded by the same functions without any issues. Let them through, as they've been seen in the wild. Fixes WordPress#301
Different compression levels yield a specific second byte in the magic header for the deflate encoding. All of them can be decoded by the same functions without any issues. Let them through, as they've been seen in the wild. Fixes WordPress#301
Different compression levels yield a specific second byte in the magic header for the deflate encoding. All of them can be decoded by the same functions without any issues. Let them through, as they've been seen in the wild. Fixes #301
https://github.com/rmccue/Requests/blob/master/library/Requests.php#L823
That function attempts to poke at the data to see if it is actually compressed or not. On a Ubuntu 16.04 system without php-curl installed the fsockopen transport is used instead of curl. When accessing content that is return using encoding deflate or gzip (what I tested) this routine falsely determines that the content is NOT compressed and returns the compressed data leading to failures in dependent software.
My environment consists of the following:
Once configured, using
wp elasticpress stats
will report that it was unable to contact the ElasticSearch server. This is due to the data coming back compressed (using deflate directly out of ElasticSearch) but being determined as not compressed despite actually being compressed. Not performing the check or installing php-curl on the system will resolve the issue.The text was updated successfully, but these errors were encountered: