Merge branch 'v0.20.x'
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include "event/DeferEvent.hxx"
|
||||
#include "thread/Mutex.hxx"
|
||||
#include "thread/Cond.hxx"
|
||||
#include "util/ASCII.hxx"
|
||||
#include "util/ChronoUtil.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
#include "util/StringCompare.hxx"
|
||||
@@ -551,8 +552,8 @@ CurlStorage::OpenDirectory(const char *uri_utf8)
|
||||
static std::unique_ptr<Storage>
|
||||
CreateCurlStorageURI(EventLoop &event_loop, const char *uri)
|
||||
{
|
||||
if (strncmp(uri, "http://", 7) != 0 &&
|
||||
strncmp(uri, "https://", 8) != 0)
|
||||
if (!StringStartsWithCaseASCII(uri, "http://") &&
|
||||
!StringStartsWithCaseASCII(uri, "https://"))
|
||||
return nullptr;
|
||||
|
||||
return std::make_unique<CurlStorage>(event_loop, uri);
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include "event/Call.hxx"
|
||||
#include "event/DeferEvent.hxx"
|
||||
#include "event/TimerEvent.hxx"
|
||||
#include "util/ASCII.hxx"
|
||||
#include "util/StringCompare.hxx"
|
||||
|
||||
extern "C" {
|
||||
@@ -404,11 +405,10 @@ NfsStorage::OpenDirectory(const char *uri_utf8)
|
||||
static std::unique_ptr<Storage>
|
||||
CreateNfsStorageURI(EventLoop &event_loop, const char *base)
|
||||
{
|
||||
if (strncmp(base, "nfs://", 6) != 0)
|
||||
const char *p = StringAfterPrefixCaseASCII(base, "nfs://");
|
||||
if (p == nullptr)
|
||||
return nullptr;
|
||||
|
||||
const char *p = base + 6;
|
||||
|
||||
const char *mount = strchr(p, '/');
|
||||
if (mount == nullptr)
|
||||
throw std::runtime_error("Malformed nfs:// URI");
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include "fs/Traits.hxx"
|
||||
#include "thread/Mutex.hxx"
|
||||
#include "system/Error.hxx"
|
||||
#include "util/ASCII.hxx"
|
||||
#include "util/StringCompare.hxx"
|
||||
#include "util/ScopeExit.hxx"
|
||||
|
||||
@@ -183,7 +184,7 @@ SmbclientDirectoryReader::GetInfo(gcc_unused bool follow)
|
||||
static std::unique_ptr<Storage>
|
||||
CreateSmbclientStorageURI(gcc_unused EventLoop &event_loop, const char *base)
|
||||
{
|
||||
if (strncmp(base, "smb://", 6) != 0)
|
||||
if (!StringStartsWithCaseASCII(base, "smb://"))
|
||||
return nullptr;
|
||||
|
||||
SmbclientInit();
|
||||
|
Reference in New Issue
Block a user