aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/filetransfer.hh
diff options
context:
space:
mode:
authorGreg Hale <imalsogreg@gmail.com>2020-06-17 15:08:59 -0400
committerGreg Hale <imalsogreg@gmail.com>2020-09-16 13:46:48 -0400
commita303c0b6dc71b1e0d6a57986c3f7a9b61361cd92 (patch)
tree1fe085d5c3d809b69600a4c883fb5ddcbfb09418 /src/libstore/filetransfer.hh
parent5080d4e7b2525d1656282c65a217a22ff8381df3 (diff)
Fetch commits from github/gitlab using Auth header
`nix flake info` calls the github 'commits' API, which requires authorization when the repository is private. Currently this request fails with a 404. This commit adds an authorization header when calling the 'commits' API. It also changes the way that the 'tarball' API authenticates, moving the user's token from a query parameter into the Authorization header. The query parameter method is recently deprecated and will be disallowed in November 2020. Using them today triggers a warning email.
Diffstat (limited to 'src/libstore/filetransfer.hh')
-rw-r--r--src/libstore/filetransfer.hh4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstore/filetransfer.hh b/src/libstore/filetransfer.hh
index 0d608c8d8..7e302ff39 100644
--- a/src/libstore/filetransfer.hh
+++ b/src/libstore/filetransfer.hh
@@ -51,6 +51,7 @@ extern FileTransferSettings fileTransferSettings;
struct FileTransferRequest
{
std::string uri;
+ Headers headers;
std::string expectedETag;
bool verifyTLS = true;
bool head = false;
@@ -65,6 +66,9 @@ struct FileTransferRequest
FileTransferRequest(const std::string & uri)
: uri(uri), parentAct(getCurActivity()) { }
+ FileTransferRequest(const std::string & uri, Headers headers)
+ : uri(uri), headers(headers) { }
+
std::string verb()
{
return data ? "upload" : "download";