diff --git a/Foundation/src/URI.cpp b/Foundation/src/URI.cpp index e64629fb21..bc7582b489 100644 --- a/Foundation/src/URI.cpp +++ b/Foundation/src/URI.cpp @@ -857,7 +857,8 @@ void URI::parseHostAndPort(std::string::const_iterator& it, const std::string::c } else _port = 0; _host = host; - toLowerInPlace(_host); + if (_host.size() && _host[0] != '%') + toLowerInPlace(_host); } diff --git a/Foundation/testsuite/src/URITest.cpp b/Foundation/testsuite/src/URITest.cpp index e835b377b7..4008bdbeee 100644 --- a/Foundation/testsuite/src/URITest.cpp +++ b/Foundation/testsuite/src/URITest.cpp @@ -798,6 +798,15 @@ void URITest::testOther() assertTrue (uri.getRawFragment() == "foo%2Fbar"); assertTrue (uri.toString() == "http://google.com/search?q=hello+world#foo%2Fbar"); assertTrue (uri.getPathEtc() == "/search?q=hello+world#foo%2Fbar"); + + uri = "http://ServerSocket.com/index.html"; + assertTrue (uri.toString() == "http://serversocket.com/index.html"); + + uri = "http+unix://%2Ftmp%2FServerSocket/index.html"; + assertTrue (uri.toString() == "http+unix://%2Ftmp%2FServerSocket/index.html"); + std::string decoded; + uri.decode("http+unix://%2Ftmp%2FServerSocket/index.html", decoded); + assertTrue (decoded == "http+unix:///tmp/ServerSocket/index.html"); }