From 04fbad4554c38a11a6f1cb3d042c85bbeab5f1ef Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Tue, 16 Sep 2014 20:42:57 +0200 Subject: [PATCH] also use url in user agent --- fetcher/feedfetcher.php | 4 +++- tests/unit/fetcher/FeedFetcherTest.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fetcher/feedfetcher.php b/fetcher/feedfetcher.php index 59f8df805..0e4dc7a4b 100644 --- a/fetcher/feedfetcher.php +++ b/fetcher/feedfetcher.php @@ -74,7 +74,9 @@ class FeedFetcher implements IFeedFetcher { $simplePie = $this->simplePieFactory->getCore(); $simplePie->set_feed_url($url); $simplePie->enable_cache(true); - $simplePie->set_useragent('ownCloud News/' . $this->appConfig->getConfig('version') . ' (+https://owncloud.org/; 1 subscriber)'); + $simplePie->set_useragent('ownCloud News/' . + $this->appConfig->getConfig('version') . + ' (+https://owncloud.org/; 1 subscriber; feed-url=' . $url . ')'); $simplePie->set_stupidly_fast(true); // disable simple pie sanitation // we use htmlpurifier $simplePie->set_timeout($this->fetchTimeout); diff --git a/tests/unit/fetcher/FeedFetcherTest.php b/tests/unit/fetcher/FeedFetcherTest.php index 186f94e04..893fb7b2a 100644 --- a/tests/unit/fetcher/FeedFetcherTest.php +++ b/tests/unit/fetcher/FeedFetcherTest.php @@ -199,7 +199,9 @@ class FeedFetcherTest extends \PHPUnit_Framework_TestCase { ->with($this->equalTo($this->cacheDuration)); $this->core->expects($this->once()) ->method('set_useragent') - ->with($this->equalTo('ownCloud News/3 (+https://owncloud.org/; 1 subscriber)')); + ->with($this->equalTo( + 'ownCloud News/3 (+https://owncloud.org/; 1 subscriber; ' . + 'feed-url=http://tests)')); $this->setExpectedException('\OCA\News\Fetcher\FetcherException'); $this->fetcher->fetch($this->url); }