aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-24 22:33:55 +0200
committerMax Kellermann <max@duempel.org>2014-02-24 19:59:53 +0100
commit6ba1fe75689b394d39488b691b225e4269110b61 (patch)
tree57646abb6f11c5b32f47bf57162f364f3373b125
parentbfae92e307aeeb80809b7cc9c44c48e87b595d22 (diff)
downloadmpd-6ba1fe75689b394d39488b691b225e4269110b61.tar.gz
mpd-6ba1fe75689b394d39488b691b225e4269110b61.tar.xz
mpd-6ba1fe75689b394d39488b691b225e4269110b61.zip
UriUtil: support ftp:// URLs in uri_remove_auth()
Diffstat (limited to '')
-rw-r--r--src/util/UriUtil.cxx2
-rw-r--r--test/test_util.cxx2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/util/UriUtil.cxx b/src/util/UriUtil.cxx
index 3864c5e83..a549f7938 100644
--- a/src/util/UriUtil.cxx
+++ b/src/util/UriUtil.cxx
@@ -98,6 +98,8 @@ uri_remove_auth(const char *uri)
auth = uri + 7;
else if (memcmp(uri, "https://", 8) == 0)
auth = uri + 8;
+ else if (memcmp(uri, "ftp://", 6) == 0)
+ auth = uri + 6;
else
/* unrecognized URI */
return std::string();
diff --git a/test/test_util.cxx b/test/test_util.cxx
index a472391a3..07bcacbe9 100644
--- a/test/test_util.cxx
+++ b/test/test_util.cxx
@@ -44,6 +44,8 @@ public:
uri_remove_auth("http://foo@www.example.com/"));
CPPUNIT_ASSERT_EQUAL(std::string(),
uri_remove_auth("http://www.example.com/f:oo@bar"));
+ CPPUNIT_ASSERT_EQUAL(std::string("ftp://ftp.example.com/"),
+ uri_remove_auth("ftp://foo:bar@ftp.example.com/"));
}
};