diff --git a/src/main/java/io/vertx/core/net/impl/HostAndPortImpl.java b/src/main/java/io/vertx/core/net/impl/HostAndPortImpl.java index fc01bd187c2..3121cfb3e39 100644 --- a/src/main/java/io/vertx/core/net/impl/HostAndPortImpl.java +++ b/src/main/java/io/vertx/core/net/impl/HostAndPortImpl.java @@ -30,7 +30,7 @@ static int parseIPv4Address(String s, int from, int to) { return -1; } } - return from < to && s.charAt(from + 1) != ':' ? -1 : from; + return from; } static int parseDecOctet(String s, int from, int to) { diff --git a/src/test/java/io/vertx/core/net/impl/HostAndPortTest.java b/src/test/java/io/vertx/core/net/impl/HostAndPortTest.java index b626f662ea2..e6729dbea78 100644 --- a/src/test/java/io/vertx/core/net/impl/HostAndPortTest.java +++ b/src/test/java/io/vertx/core/net/impl/HostAndPortTest.java @@ -34,8 +34,6 @@ public void testParseIPV4Address() { assertEquals(7, HostAndPortImpl.parseIPv4Address("0.0.0.0", 0, 7)); assertEquals(11, HostAndPortImpl.parseIPv4Address("192.168.0.0", 0, 11)); assertEquals(-1, HostAndPortImpl.parseIPv4Address("011.168.0.0", 0, 11)); - assertEquals(-1, HostAndPortImpl.parseIPv4Address("10.0.0.1.nip.io", 0, 15)); - assertEquals(8, HostAndPortImpl.parseIPv4Address("10.0.0.1.nip.io", 0, 8)); } @Test @@ -44,7 +42,6 @@ public void testParseRegName() { assertEquals(5, HostAndPortImpl.parseRegName("abcdef:1234", 0, 5)); assertEquals(11, HostAndPortImpl.parseRegName("example.com", 0, 11)); assertEquals(14, HostAndPortImpl.parseRegName("example-fr.com", 0, 14)); - assertEquals(15, HostAndPortImpl.parseRegName("10.0.0.1.nip.io", 0, 15)); } @Test @@ -52,14 +49,10 @@ public void testParseHost() { assertEquals(14, HostAndPortImpl.parseHost("example-fr.com", 0, 14)); assertEquals(5, HostAndPortImpl.parseHost("[0::]", 0, 5)); assertEquals(7, HostAndPortImpl.parseHost("0.0.0.0", 0, 7)); - assertEquals(8, HostAndPortImpl.parseHost("10.0.0.1.nip.io", 0, 8)); - assertEquals(15, HostAndPortImpl.parseHost("10.0.0.1.nip.io", 0, 15)); } @Test public void testParseHostAndPort() { - assertHostAndPort("10.0.0.1.nip.io", -1, "10.0.0.1.nip.io"); - assertHostAndPort("10.0.0.1.nip.io", 8443, "10.0.0.1.nip.io:8443"); assertHostAndPort("example.com", 8080, "example.com:8080"); assertHostAndPort("example.com", -1, "example.com"); assertHostAndPort("0.1.2.3", -1, "0.1.2.3");