about summary refs log tree commit diff
path: root/src/libstore/http-binary-cache-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-01-31T14·10+0100
committerEelco Dolstra <edolstra@gmail.com>2018-01-31T14·10+0100
commit6270b2e50f94e6686581f041d7824c9fb34da3d8 (patch)
tree5ffb7818751bccfb36dd12c2c36d2059c082c85c /src/libstore/http-binary-cache-store.cc
parentf8e8dd827eb9005fcc3ba42fd0855729ef77d9fb (diff)
parent1d5d277ac7bf8a4bc601358b38746005416e935e (diff)
Merge branch 'http-binary-cache-put-upsert' of https://github.com/adelbertc/nix
Diffstat (limited to 'src/libstore/http-binary-cache-store.cc')
-rw-r--r--src/libstore/http-binary-cache-store.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libstore/http-binary-cache-store.cc b/src/libstore/http-binary-cache-store.cc
index 057337685791..93bd3e5d5982 100644
--- a/src/libstore/http-binary-cache-store.cc
+++ b/src/libstore/http-binary-cache-store.cc
@@ -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,