about summary refs log tree commit diff
path: root/src/libstore/http-binary-cache-store.cc
diff options
context:
space:
mode:
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,