URI ignores invalid ipv6 address while parsing authority
Jing LV
lvjing at linux.vnet.ibm.com
Tue Mar 1 01:58:52 PST 2011
Hello,
According to authority component RFC2396, if host name is a domain name
there should be no "[" and "]". However if we put a hostname like
"[www.abc.com]" while creating a URI, it silently accept, no error is
reported. I suppose this is a bug. A testcase can be found below:
try {
uri = new URI("ftp", "[www.abc.com]", "/dir1/dir2", "query", "frag");
} catch (URISyntaxException e) {
// Expected
System.out.printf("Should reach here");
}
And if we print uri.getAuthority() we'll get a null value.
I think the problem is caused by ipv6 address, which is enclosed with
"[]", but a normal hostname does not.
Any comments?
--
Best Regards,
Jimmy, Jing LV
More information about the net-dev
mailing list