1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 13:41:15 +02:00

downloadCached: Return ETag

(cherry picked from commit 529add316c)
This commit is contained in:
Eelco Dolstra 2019-02-25 23:20:50 +08:00
parent 94f11d0a61
commit dc29e9fb47
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
6 changed files with 29 additions and 12 deletions

View file

@ -88,7 +88,7 @@ static void update(const StringSet & channelNames)
// definition from a consistent location if the redirect changes mid-download.
std::string effectiveUrl;
auto dl = getDownloader();
auto filename = dl->downloadCached(store, url, false, "", Hash(), &effectiveUrl, 0);
auto filename = dl->downloadCached(store, url, false, "", Hash(), &effectiveUrl, 0).path;
url = chomp(std::move(effectiveUrl));
// If the URL contains a version number, append it to the name
@ -123,10 +123,10 @@ static void update(const StringSet & channelNames)
// Download the channel tarball.
auto fullURL = url + "/nixexprs.tar.xz";
try {
filename = dl->downloadCached(store, fullURL, false);
filename = dl->downloadCached(store, fullURL, false).path;
} catch (DownloadError & e) {
fullURL = url + "/nixexprs.tar.bz2";
filename = dl->downloadCached(store, fullURL, false);
filename = dl->downloadCached(store, fullURL, false).path;
}
chomp(filename);
}