aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/filetransfer.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2023-06-07 14:26:30 +0200
committerEelco Dolstra <edolstra@gmail.com>2023-06-13 14:17:45 +0200
commit1ad3328c5efea041990fa82e6ad24ae2b4e81c24 (patch)
tree5366bfa02177e9c5bc61211121bbe9aa6335129a /src/libstore/filetransfer.hh
parent3402b650cdce318e42acd4dc34f42423cafef587 (diff)
Allow tarball URLs to redirect to a lockable immutable URL
Previously, for tarball flakes, we recorded the original URL of the tarball flake, rather than the URL to which it ultimately redirects. Thus, a flake URL like http://example.org/patchelf-latest.tar that redirects to http://example.org/patchelf-<revision>.tar was not really usable. We couldn't record the redirected URL, because sites like GitHub redirect to CDN URLs that we can't rely on to be stable. So now we use the redirected URL only if the server returns the `x-nix-is-immutable` or `x-amz-meta-nix-is-immutable` headers in its response.
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 378c6ff78..a3b0dde1f 100644
--- a/src/libstore/filetransfer.hh
+++ b/src/libstore/filetransfer.hh
@@ -80,6 +80,10 @@ struct FileTransferResult
std::string effectiveUri;
std::string data;
uint64_t bodySize = 0;
+ /* An "immutable" URL for this resource (i.e. one whose contents
+ will never change), as returned by the `Link: <url>;
+ rel="immutable"` header. */
+ std::optional<std::string> immutableUrl;
};
class Store;