storage/Plugin: add "prefixes"

This commit is contained in:
Max Kellermann
2021-10-06 19:38:46 +02:00
parent 5d35983298
commit ef24cfa523
9 changed files with 73 additions and 5 deletions

View File

@@ -570,14 +570,15 @@ CurlStorage::OpenDirectory(std::string_view uri_utf8)
static std::unique_ptr<Storage>
CreateCurlStorageURI(EventLoop &event_loop, const char *uri)
{
if (!StringStartsWithCaseASCII(uri, "http://") &&
!StringStartsWithCaseASCII(uri, "https://"))
return nullptr;
return std::make_unique<CurlStorage>(event_loop, uri);
}
static constexpr const char *curl_prefixes[] = {
"http://", "https://", nullptr
};
const StoragePlugin curl_storage_plugin = {
"curl",
curl_prefixes,
CreateCurlStorageURI,
};