diff options
Diffstat (limited to 'src/util/UriUtil.cxx')
-rw-r--r-- | src/util/UriUtil.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util/UriUtil.cxx b/src/util/UriUtil.cxx index 7997bd5c9..89d2a473a 100644 --- a/src/util/UriUtil.cxx +++ b/src/util/UriUtil.cxx @@ -27,6 +27,16 @@ bool uri_has_scheme(const char *uri) return strstr(uri, "://") != nullptr; } +std::string +uri_get_scheme(const char *uri) +{ + const char *end = strstr(uri, "://"); + if (end == nullptr) + end = uri; + + return std::string(uri, end); +} + /* suffixes should be ascii only characters */ const char * uri_get_suffix(const char *uri) |