From 2ca7129e221349f5ef2411b368d3a85612ff39c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Wed, 14 Sep 2016 10:25:40 +0200 Subject: [PATCH 1/2] [core] fix user agent url to rss-bridge github project MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index a4ae769..a3029b2 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'; From 70c490d6ef1f0aa973d21a7279a350f537d28398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Wed, 14 Sep 2016 13:39:53 +0200 Subject: [PATCH 2/2] [BridgeAbstract] handle compressed data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- lib/BridgeAbstract.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/BridgeAbstract.php b/lib/BridgeAbstract.php index bfd80de..4fce4bd 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; }