Fixed parsing of URI with a IPv6-address

Allowed ipv6-address in a uri like:
  http://[::1]:8080/repo.git

Change-Id: Ia00a20f694b2e9314892df77f9b11f551bb1d34e
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
This commit is contained in:
Andreas König 2012-12-13 17:43:59 +01:00 committed by Chris Aniszczyk
parent 741ecf56b7
commit d9d3439617
2 changed files with 2 additions and 2 deletions

View File

@ -822,7 +822,7 @@ public void testALot() throws URISyntaxException {
String[] users = new String[] { "me", "l usr\\example.com",
"lusr\\example" };
String[] passes = new String[] { "wtf", };
String[] hosts = new String[] { "example.com", "1.2.3.4" };
String[] hosts = new String[] { "example.com", "1.2.3.4", "[::1]" };
String[] ports = new String[] { "1234", "80" };
String[] paths = new String[] { "/", "/abc", "D:/x", "D:\\x" };
for (String[] test : tests) {

View File

@ -87,7 +87,7 @@ public class URIish implements Serializable {
* Part of a pattern which matches the host part of URIs. Defines one
* capturing group containing the host name.
*/
private static final String HOST_P = "([^\\\\/:]+)"; //$NON-NLS-1$
private static final String HOST_P = "((?:[^\\\\/:]+)|(?:\\[[0-9a-f:]+\\]))";
/**
* Part of a pattern which matches the optional port part of URIs. Defines