aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/download.cc
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2016-08-31 09:57:56 -0400
committerShea Levy <shea@shealevy.com>2016-08-31 09:57:56 -0400
commitdfe09386148901e4d9f2dc84641d2d5544c886f7 (patch)
tree15a106b8b30ff5a57d995803288d7f41fc8caa47 /src/libstore/download.cc
parent572aba284a161cb94532cec297785266ee719b99 (diff)
download.hh: Fix conflicts from nix-channel-c++ merge
Diffstat (limited to 'src/libstore/download.cc')
-rw-r--r--src/libstore/download.cc14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/libstore/download.cc b/src/libstore/download.cc
index 5cb2b497a..ed7e124d2 100644
--- a/src/libstore/download.cc
+++ b/src/libstore/download.cc
@@ -249,13 +249,7 @@ ref<Downloader> makeDownloader()
return make_ref<CurlDownloader>();
}
-Path Downloader::downloadCached(ref<Store> store, const string & url_, bool unpack, string name, const Hash & expectedHash)
-{
- string ignored;
- return downloadCached(store, url_, unpack, ignored, expectedHash);
-}
-
-Path Downloader::downloadCached(ref<Store> store, const string & url_, bool unpack, string & effectiveUrl, const Hash & expectedHash)
+Path Downloader::downloadCached(ref<Store> store, const string & url_, bool unpack, string name, const Hash & expectedHash, string * effectiveUrl)
{
auto url = resolveUri(url_);
@@ -295,7 +289,8 @@ Path Downloader::downloadCached(ref<Store> store, const string & url_, bool unpa
time_t lastChecked;
if (string2Int(ss[2], lastChecked) && lastChecked + ttl >= time(0)) {
skip = true;
- effectiveUrl = url_;
+ if (effectiveUrl)
+ *effectiveUrl = url_;
} else if (!ss[1].empty()) {
printMsg(lvlDebug, format("verifying previous ETag ‘%1%’") % ss[1]);
expectedETag = ss[1];
@@ -311,7 +306,8 @@ Path Downloader::downloadCached(ref<Store> store, const string & url_, bool unpa
DownloadOptions options;
options.expectedETag = expectedETag;
auto res = download(url, options);
- effectiveUrl = res.effectiveUrl;
+ if (effectiveUrl)
+ *effectiveUrl = res.effectiveUrl;
if (!res.cached) {
ValidPathInfo info;