Permalink
Browse files

Fixed URL parsing with fragment and empty path

  • Loading branch information...
luccioman committed Dec 1, 2017
1 parent e07ef1b commit d1c7dfd852d786a8eb14e601cf5886191e068abe
@@ -228,6 +228,9 @@ public MultiProtocolURL(String url) throws MalformedURLException {
q = url.indexOf("?", p + 3);
}
}
if (q < 0) { // check for www.test.com#fragment
q = url.indexOf("#", p + 3);
}
int r;
if (q < 0) {
if ((r = url.indexOf('@', p + 3)) < 0) {
@@ -139,6 +139,7 @@ public void testGetHost() throws MalformedURLException {
new String[]{"http://www.yacy.net?data=1/2/3", "www.yacy.net"},
new String[]{"http://www.yacy.net?url=http://test.com", "www.yacy.net"},
new String[]{"http://www.yacy.net#fragment", "www.yacy.net"},
/* Punycode encoded internationalized domain name : Algeria TLD */
new String[]{"http://xn--ggbdmbaav3cjl1c9heugfv.xn--lgbbat1ad8j/", "xn--ggbdmbaav3cjl1c9heugfv.xn--lgbbat1ad8j"},
/* Internationalized domain name : Algeria TLD */

0 comments on commit d1c7dfd

Please sign in to comment.