Commit 78bc6ad5 authored by mikeytown2's avatar mikeytown2

Issue #2281873 by mikeytown2: gzinflate(): data error in httprl_decode_data()

parent e804db00
......@@ -2416,25 +2416,33 @@ function httprl_decode_data(&$result) {
// Decompress if compressed.
if (isset($result->headers['content-encoding'])) {
if ($result->headers['content-encoding'] == 'gzip') {
$chunk = gzinflate(substr($chunk, 10));
$chunk = @gzinflate(substr($chunk, 10));
}
elseif ($result->headers['content-encoding'] == 'deflate') {
$chunk = gzinflate($chunk);
$chunk = @gzinflate($chunk);
}
if ($chunk === FALSE) {
break;
}
}
// Glue the chunks together.
$output .= $chunk;
$stream_position += httprl_strlen($chunk);
}
$result->data = $output;
if ($chunk !== FALSE) {
$result->data = $output;
}
}
// Decompress if compressed.
elseif (isset($result->headers['content-encoding'])) {
if ($result->headers['content-encoding'] == 'gzip') {
$result->data = gzinflate(substr($result->data, 10));
$chunk = @gzinflate(substr($result->data, 10));
}
elseif ($result->headers['content-encoding'] == 'deflate') {
$result->data = gzinflate($result->data);
$chunk = @gzinflate($result->data);
}
if ($chunk !== FALSE) {
$result->data = $chunk;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment