diff --git a/Account/Sources/Account/LocalAccount/LocalAccountRefresher.swift b/Account/Sources/Account/LocalAccount/LocalAccountRefresher.swift index fe39de0aa..fa37a5cdc 100644 --- a/Account/Sources/Account/LocalAccount/LocalAccountRefresher.swift +++ b/Account/Sources/Account/LocalAccount/LocalAccountRefresher.swift @@ -89,6 +89,11 @@ extension LocalAccountRefresher: DownloadSessionDelegate { return } + if let error { + os_log(.debug, "Error downloading \(url) - \(error)") + return + } + let conditionalGetInfo: HTTPConditionalGetInfo? = { if let httpResponse = response as? HTTPURLResponse { return HTTPConditionalGetInfo(urlResponse: httpResponse) @@ -96,9 +101,8 @@ extension LocalAccountRefresher: DownloadSessionDelegate { return nil }() - if let error { - os_log(.debug, "Error downloading \(url) - \(error)") - return + if let httpURLResponse = response as? HTTPURLResponse, let cacheControlInfo = CacheControlInfo(urlResponse: httpURLResponse) { + feed.cacheControlInfo = cacheControlInfo } let dataHash = data.md5String diff --git a/Account/Sources/Account/WebFeed.swift b/Account/Sources/Account/WebFeed.swift index a6db55552..7ca28e5f4 100644 --- a/Account/Sources/Account/WebFeed.swift +++ b/Account/Sources/Account/WebFeed.swift @@ -132,6 +132,15 @@ public final class WebFeed: Feed, Renamable, Hashable { } } + public var cacheControlInfo: CacheControlInfo? { + get { + metadata.cacheControlInfo + } + set { + metadata.cacheControlInfo = newValue + } + } + public var contentHash: String? { get { return metadata.contentHash