]> source.dussan.org Git - jgit.git/commitdiff
Fixed parsing of URI with a IPv6-address 28/9228/2
authorAndreas König <eclipse@berg-turbenthal.ch>
Thu, 13 Dec 2012 16:43:59 +0000 (17:43 +0100)
committerChris Aniszczyk <zx@twitter.com>
Wed, 27 Mar 2013 14:44:13 +0000 (10:44 -0400)
Allowed ipv6-address in a uri like:
  http://[::1]:8080/repo.git

Change-Id: Ia00a20f694b2e9314892df77f9b11f551bb1d34e
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/URIishTest.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java

index b5a753bbba4344e6e187e69248b30c502b7e39f2..2202a91d3f2a07c22e9cd7a1788a0855c76b3f61 100644 (file)
@@ -822,7 +822,7 @@ public class URIishTest {
                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) {
index 9befb9275587bb31d79a48316834033816e18963..d11edfc63b44b0ff3bf95ffaab3d5ad66c276c8a 100644 (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