Improved logic for using stored etag or last-modified headers to avoid re-downloading resources

This commit is contained in:
Greg Neagle
2025-10-23 11:52:51 -07:00
parent 8e5848d9f8
commit 03993beceb

View File

@@ -336,11 +336,9 @@ func getHTTPfileIfChangedAtomically(
resume: Bool = false,
followRedirects: String = "none",
) throws -> Bool {
var eTag = ""
var getOnlyIfNewer = false
if pathExists(destinationPath) {
getOnlyIfNewer = true
// see if we have an etag attribute
// see if we have a stored etag or last-modified header
do {
let data = try getXattr(named: GURL_XATTR, atPath: destinationPath)
if let headers = try readPlist(fromData: data) as? [String: String] {