diff options
author | Robert Wunderer <robert.wunderer@caprisys.at> | 2023-02-24 08:16:45 +0000 |
---|---|---|
committer | Benjamin Brahmer <info@b-brahmer.de> | 2023-03-23 12:12:06 +0100 |
commit | eeabb4189b2376e1c5cb6fdeaa908bb30bfd1584 (patch) | |
tree | ee9a6408ec71499f5ccee6d15e662531beb43f21 /lib | |
parent | be95c17f46cb689a41db9d1b3d15543710c74ab7 (diff) |
Use httpLastModified field for If-Modified-Since header when fetching feed updates
Signed-off-by: Robert Wunderer <robert.wunderer@caprisys.at>
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/Fetcher/FeedFetcher.php | 10 | ||||
-rw-r--r-- | lib/Fetcher/IFeedFetcher.php | 3 | ||||
-rw-r--r-- | lib/Service/FeedServiceV2.php | 3 |
3 files changed, 12 insertions, 4 deletions
diff --git a/lib/Fetcher/FeedFetcher.php b/lib/Fetcher/FeedFetcher.php index 8864df084..60d798889 100755 --- a/lib/Fetcher/FeedFetcher.php +++ b/lib/Fetcher/FeedFetcher.php @@ -114,15 +114,21 @@ class FeedFetcher implements IFeedFetcher string $url, bool $fullTextEnabled, ?string $user, - ?string $password + ?string $password, + ?string $httpLastModified ): array { $url2 = new Net_URL2($url); if (!is_null($user) && trim($user) !== '') { $url2->setUserinfo(rawurlencode($user), rawurlencode($password)); } + if (!is_null($httpLastModified) && trim($httpLastModified) !== '') { + $lastModified = new DateTime($httpLastModified); + } else { + $lastModified = null; + } $url = $url2->getNormalizedURL(); $this->reader->resetFilters(); - $resource = $this->reader->read($url); + $resource = $this->reader->read($url, null, $lastModified); $location = $resource->getUrl(); $parsedFeed = $resource->getFeed(); diff --git a/lib/Fetcher/IFeedFetcher.php b/lib/Fetcher/IFeedFetcher.php index 45e0915f0..8729858b5 100644 --- a/lib/Fetcher/IFeedFetcher.php +++ b/lib/Fetcher/IFeedFetcher.php @@ -37,7 +37,8 @@ interface IFeedFetcher string $url, bool $fullTextEnabled, ?string $user, - ?string $password + ?string $password, + ?string $httpLastModified ): array; /** diff --git a/lib/Service/FeedServiceV2.php b/lib/Service/FeedServiceV2.php index 3e02b3971..3610c3e3a 100644 --- a/lib/Service/FeedServiceV2.php +++ b/lib/Service/FeedServiceV2.php @@ -267,7 +267,8 @@ class FeedServiceV2 extends Service $location, $feed->getFullTextEnabled(), $feed->getBasicAuthUser(), - $feed->getBasicAuthPassword() + $feed->getBasicAuthPassword(), + $feed->getHttpLastModified() ); } catch (ReadErrorException $ex) { $feed->setUpdateErrorCount($feed->getUpdateErrorCount() + 1); |