diff --git a/index.php b/index.php index a4ae769e..a3029b27 100644 --- a/index.php +++ b/index.php @@ -54,7 +54,7 @@ if(!extension_loaded('openssl')) // FIXME : beta test UA spoofing, please report any blacklisting by PHP-fopen-unfriendly websites ini_set('user_agent', 'Mozilla/5.0(X11; Linux x86_64; rv:30.0) Gecko/20121202 Firefox/30.0(rss-bridge/0.1; - +https://github.com/sebsauvage/rss-bridge)'); + +https://github.com/RSS-Bridge/rss-bridge)'); // default whitelist $whitelist_file = './whitelist.txt'; diff --git a/lib/BridgeAbstract.php b/lib/BridgeAbstract.php index bfd80dea..4fce4bd0 100644 --- a/lib/BridgeAbstract.php +++ b/lib/BridgeAbstract.php @@ -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; }