fix(URI): don't lowercase host part if it's a Unix domain socket #4468

This commit is contained in:
Alex Fabijanic 2024-03-20 12:32:48 -05:00
parent a5b3c84874
commit e078dbb84e
2 changed files with 11 additions and 1 deletions

View File

@ -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);
}

View File

@ -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");
}