Fixed URL parsing with fragment and empty path

pull/149/head
luccioman 7 years ago
parent e07ef1b610
commit d1c7dfd852

@ -228,6 +228,9 @@ public class MultiProtocolURL implements Serializable, Comparable<MultiProtocolU
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 class MultiProtocolURLTest {
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 */

Loading…
Cancel
Save