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

Properly filter the stores according to their declared uriSchemes

When opening a store, only try the stores whose `uriSchemes()` include
the current one
This commit is contained in:
regnat 2020-09-11 11:11:05 +02:00
parent 5895184df4
commit 7f103dcddd
10 changed files with 51 additions and 33 deletions

View file

@ -29,13 +29,14 @@ private:
public:
HttpBinaryCacheStore(
const std::string & scheme,
const Path & _cacheUri,
const Params & params)
: StoreConfig(params)
, BinaryCacheStoreConfig(params)
, BinaryCacheStore(params)
, HttpBinaryCacheStoreConfig(params)
, cacheUri(_cacheUri)
, cacheUri(scheme + "://" + _cacheUri)
{
if (cacheUri.back() == '/')
cacheUri.pop_back();
@ -64,11 +65,11 @@ public:
}
}
static std::vector<std::string> uriPrefixes()
static std::set<std::string> uriSchemes()
{
static bool forceHttp = getEnv("_NIX_FORCE_HTTP") == "1";
auto ret = std::vector<std::string>({"http", "https"});
if (forceHttp) ret.push_back("file");
auto ret = std::set<std::string>({"http", "https"});
if (forceHttp) ret.insert("file");
return ret;
}
protected: