aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/UriUtil.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/UriUtil.cxx')
-rw-r--r--src/util/UriUtil.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/util/UriUtil.cxx b/src/util/UriUtil.cxx
index 2609db2cf..3864c5e83 100644
--- a/src/util/UriUtil.cxx
+++ b/src/util/UriUtil.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2013 The Music Player Daemon Project
+ * Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -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)