summaryrefslogtreecommitdiffstats
path: root/lib/Fetcher
diff options
context:
space:
mode:
authorRobert Wunderer <robert.wunderer@caprisys.at>2023-02-24 08:16:45 +0000
committerBenjamin Brahmer <info@b-brahmer.de>2023-03-23 12:12:06 +0100
commiteeabb4189b2376e1c5cb6fdeaa908bb30bfd1584 (patch)
treeee9a6408ec71499f5ccee6d15e662531beb43f21 /lib/Fetcher
parentbe95c17f46cb689a41db9d1b3d15543710c74ab7 (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/Fetcher')
-rwxr-xr-xlib/Fetcher/FeedFetcher.php10
-rw-r--r--lib/Fetcher/IFeedFetcher.php3
2 files changed, 10 insertions, 3 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;
/**