aboutsummaryrefslogtreecommitdiff
path: root/src/libfetchers/tarball.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-09-29 13:05:19 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-09-29 13:05:19 +0200
commit5999978a053b3ec16f448c40b54a1a62ceb82c90 (patch)
treed08c51a3803d7eefb02b046eaed34d679b52088e /src/libfetchers/tarball.cc
parentde86abbf3f9f0d18f7506b1d50072597786332ea (diff)
Make Headers an optional argument
Diffstat (limited to 'src/libfetchers/tarball.cc')
-rw-r--r--src/libfetchers/tarball.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/libfetchers/tarball.cc b/src/libfetchers/tarball.cc
index cf6d6e3d2..ca49482a9 100644
--- a/src/libfetchers/tarball.cc
+++ b/src/libfetchers/tarball.cc
@@ -12,9 +12,9 @@ namespace nix::fetchers {
DownloadFileResult downloadFile(
ref<Store> store,
const std::string & url,
- const Headers & headers,
const std::string & name,
- bool immutable)
+ bool immutable,
+ const Headers & headers)
{
// FIXME: check store
@@ -38,7 +38,8 @@ DownloadFileResult downloadFile(
if (cached && !cached->expired)
return useCached();
- FileTransferRequest request(url, headers);
+ FileTransferRequest request(url);
+ request.headers = headers;
if (cached)
request.expectedETag = getStrAttr(cached->infoAttrs, "etag");
FileTransferResult res;
@@ -112,9 +113,9 @@ DownloadFileResult downloadFile(
std::pair<Tree, time_t> downloadTarball(
ref<Store> store,
const std::string & url,
- const Headers & headers,
const std::string & name,
- bool immutable)
+ bool immutable,
+ const Headers & headers)
{
Attrs inAttrs({
{"type", "tarball"},
@@ -130,7 +131,7 @@ std::pair<Tree, time_t> downloadTarball(
getIntAttr(cached->infoAttrs, "lastModified")
};
- auto res = downloadFile(store, url, headers, name, immutable);
+ auto res = downloadFile(store, url, name, immutable, headers);
std::optional<StorePath> unpackedStorePath;
time_t lastModified;
@@ -225,7 +226,7 @@ struct TarballInputScheme : InputScheme
std::pair<Tree, Input> fetch(ref<Store> store, const Input & input) override
{
- auto tree = downloadTarball(store, getStrAttr(input.attrs, "url"), Headers {}, "source", false).first;
+ auto tree = downloadTarball(store, getStrAttr(input.attrs, "url"), "source", false).first;
return {std::move(tree), input};
}
};