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

only decompress with proper content-encoding header #438

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion library/Requests.php
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,10 @@ protected static function parse_response($headers, $url, $req_headers, $req_data
unset($return->headers['transfer-encoding']);
}
if (isset($return->headers['content-encoding'])) {
$return->body = self::decompress($return->body);
$compressed_encoding = array_intersect(explode(',', strtolower($return->headers['content-encoding'])), array('gzip', 'x-gzip', 'deflate', 'compress', 'x-compress'));
if (!empty($compressed_encoding)) {
$return->body = self::decompress($return->body);
}
}

//fsockopen and cURL compatibility
Expand Down