Skip to content

Commit

Permalink
Test malformed IPv6 addresses
Browse files Browse the repository at this point in the history
I was worried we weren't handling this case correctly. Fortunately we are.

Closes: #4451
  • Loading branch information
squarejesse committed Dec 30, 2018
1 parent 275d71b commit 8da92eb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions okhttp-tests/src/test/java/okhttp3/HttpUrlTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,10 @@ HttpUrl parse(String url) {
"Invalid URL host: \"[0:0:0:0:0:1:255.255.255]\"");
}

@Test public void hostIpv6Malformed() throws Exception {
assertInvalid("http://[::g]/", "Invalid URL host: \"[::g]\"");
}

@Test public void hostIpv6CanonicalForm() throws Exception {
assertEquals("abcd:ef01:2345:6789:abcd:ef01:2345:6789",
parse("http://[abcd:ef01:2345:6789:abcd:ef01:2345:6789]/").host());
Expand Down

0 comments on commit 8da92eb

Please sign in to comment.