Skip to content

Commit

Permalink
fix(URI): don't lowercase host part if it's a Unix domain socket #4468
Browse files Browse the repository at this point in the history
  • Loading branch information
aleks-f committed Mar 20, 2024
1 parent 26a1b35 commit c4977b8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Foundation/src/URI.cpp
Expand Up @@ -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);
}


Expand Down
9 changes: 9 additions & 0 deletions Foundation/testsuite/src/URITest.cpp
Expand Up @@ -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");
}


Expand Down

0 comments on commit c4977b8

Please sign in to comment.