carterkozak commented on a change in pull request #274:
URL:
https://github.com/apache/httpcomponents-core/pull/274#discussion_r607110871
##########
File path: httpcore5/src/test/java/org/apache/hc/core5/net/TestURIBuilder.java
##########
@@ -813,4 +813,32 @@ public void testNormalizeSyntax() throws Exception {
new
URIBuilder("http:///../../.././").normalizeSyntax().build().toASCIIString());
}
+ @Test
+ public void testIpv6Host() throws Exception {
+ final URI uri = new URIBuilder("https://[::1]:432/path").build();
+ Assert.assertEquals(432, uri.getPort());
+ Assert.assertEquals("https", uri.getScheme());
+ Assert.assertEquals("[::1]", uri.getHost());
+ Assert.assertEquals("/path", uri.getPath());
+ }
+
+ @Test
+ public void testIpv6HostWithPortUpdate() throws Exception {
+ // Updating the port clears URIBuilder.encodedSchemeSpecificPart
+ // and bypasses the fast/simple path which preserves input.
+ final URI uri = new
URIBuilder("https://[::1]:432/path").setPort(123).build();
+ Assert.assertEquals(123, uri.getPort());
+ Assert.assertEquals("https", uri.getScheme());
+ Assert.assertEquals("[::1]", uri.getHost());
Review comment:
I've also updated the tests to check URIBuilder getters in addition to
URI getters -- this should make the differences between URIBuilder.getHost and
URI.getHost more obvious.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]