[BridgeAbstract] handle compressed data

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
Pierre Mazière 2016-09-14 13:39:53 +02:00
parent 2ca7129e22
commit 70c490d6ef
1 changed files with 23 additions and 0 deletions

View File

@ -364,6 +364,29 @@ abstract class BridgeAbstract implements BridgeInterface {
if($content === false)
$this->debugMessage('Cant\'t download ' . $url);
// handle compressed data
foreach($http_response_header as $header){
if(stristr($header, 'content-encoding')){
switch(true){
case stristr($header, 'gzip'):
$content = gzinflate( substr($content,10,-8));
break;
case stristr($header, 'compress'):
//TODO
case stristr($header, 'deflate'):
//TODO
case stristr($header, 'brotli'):
//TODO
returnServerError($header . '=> Not implemented yet');
break;
case stristr($header, 'identity'):
break;
default:
returnServerError($header . '=> Unknown compression');
}
}
}
return $content;
}