From 5befce51ef9f38609b713cfbc6095a3b60b1d574 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Thu, 10 Apr 2014 19:15:31 +0200 Subject: add proxy support based on simplepie pr, fix #491 --- fetcher/feedfetcher.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'fetcher') diff --git a/fetcher/feedfetcher.php b/fetcher/feedfetcher.php index c00a8c859..6808465c2 100644 --- a/fetcher/feedfetcher.php +++ b/fetcher/feedfetcher.php @@ -42,6 +42,9 @@ class FeedFetcher implements IFeedFetcher { private $simplePieFactory; private $fetchTimeout; private $time; + private $proxyHost; + private $proxyPort; + private $proxyAuth; public function __construct(API $api, SimplePieAPIFactory $simplePieFactory, @@ -56,6 +59,9 @@ class FeedFetcher implements IFeedFetcher { $this->faviconFetcher = $faviconFetcher; $this->simplePieFactory = $simplePieFactory; $this->time = $time; + $this->proxyHost = $config->getProxyHost(); + $this->proxyPort = $config->getProxyPort(); + $this->proxyAuth = $config->getProxyAuth(); } @@ -83,6 +89,12 @@ class FeedFetcher implements IFeedFetcher { $simplePie->set_cache_location($this->cacheDirectory); $simplePie->set_cache_duration($this->cacheDuration); + if(trim($this->proxyHost) !== '') { + $simplePie->set_proxyhost($this->proxyHost); + $simplePie->set_proxyport($this->proxyPort); + $simplePie->set_proxyuserpwd($this->proxyAuth); + } + if (!$simplePie->init()) { throw new FetcherException('Could not initialize simple pie on feed with url ' . $url); } -- cgit v1.2.3