Commit 3c47107c authored by mikeytown2's avatar mikeytown2

Issue #2789719: Add in support for brotli compression

parent e0725c3b
......@@ -2410,12 +2410,15 @@ function httprl_decode_data(&$result) {
$chunk = substr($data, $stream_position, $num);
// Decompress if compressed.
if (isset($result->headers['content-encoding'])) {
if ($result->headers['content-encoding'] == 'gzip') {
if ($result->headers['content-encoding'] === 'gzip') {
$chunk = @gzinflate(substr($chunk, 10));
}
elseif ($result->headers['content-encoding'] == 'deflate') {
elseif ($result->headers['content-encoding'] === 'deflate') {
$chunk = @gzinflate($chunk);
}
elseif ($result->headers['content-encoding'] === 'br' && is_callable('brotli_uncompress')) {
$chunk = @brotli_uncompress($chunk);
}
if ($chunk === FALSE) {
break;
}
......@@ -2430,13 +2433,16 @@ function httprl_decode_data(&$result) {
}
// Decompress if compressed.
elseif (isset($result->headers['content-encoding'])) {
if ($result->headers['content-encoding'] == 'gzip') {
if ($result->headers['content-encoding'] === 'gzip') {
$chunk = @gzinflate(substr($result->data, 10));
}
elseif ($result->headers['content-encoding'] == 'deflate') {
elseif ($result->headers['content-encoding'] === 'deflate') {
$chunk = @gzinflate($result->data);
}
if ($chunk !== FALSE) {
elseif ($result->headers['content-encoding'] === 'br' && is_callable('brotli_uncompress')) {
$chunk = @brotli_uncompress($result->data);
}
if (isset($chunk) && $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