1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 19:01:16 +02:00

HttpBinaryCacheStore: Support upsertFile with PUT.

Some servers, such as Artifactory, allow uploading with PUT and BASIC
auth. This allows nix copy to work to upload binaries to those
servers.

Worked on together with @adelbertc
This commit is contained in:
Shea Levy 2018-01-26 11:12:30 -08:00
parent e09161d05c
commit 1d5d277ac7
No known key found for this signature in database
GPG key ID: 5C0BD6957D86FE27
3 changed files with 38 additions and 4 deletions

View file

@ -67,7 +67,13 @@ protected:
const std::string & data,
const std::string & mimeType) override
{
throw UploadToHTTP("uploading to an HTTP binary cache is not supported");
auto data_ = std::make_shared<string>(data);
auto req = DownloadRequest(cacheUri + "/" + path, data_, mimeType);
try {
getDownloader()->download(req);
} catch (DownloadError & e) {
throw UploadToHTTP(format("uploading to HTTP binary cache at %1% not supported: %2%") % cacheUri % e.msg());
}
}
void getFile(const std::string & path,