You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by GitBox <gi...@apache.org> on 2021/03/25 17:16:02 UTC

[GitHub] [httpcomponents-core] pkoenig10 commented on a change in pull request #274: HTTPCORE-671: URIBuilder does not precent-encode bracketed IPv6 addre…

pkoenig10 commented on a change in pull request #274:
URL: https://github.com/apache/httpcomponents-core/pull/274#discussion_r601688891



##########
File path: httpcore5/src/main/java/org/apache/hc/core5/net/URIBuilder.java
##########
@@ -292,6 +292,8 @@ private String buildString() {
                 }
                 if (InetAddressUtils.isIPv6Address(this.host)) {
                     sb.append("[").append(this.host).append("]");
+                } else if (InetAddressUtils.isIPv6URLBracketedAddress(this.host)) {

Review comment:
       This also results in unintuitive and inconsistent behavior due to the fact that  `URIBuilder` uses `URI#getHost` by default, and then clears the host if any part of the authority changes.
   
   For example:
   ```
   URI uri = URI.create("http://[::1]/");
   
   // Produces "http://[::1]/"
   new URIBuilder(uri).toString();
   
   // Produces "http://%5B%3A%3A1%5D:443/"
   new URIBuilder(uri).setPort(1234).toString();
   ```




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org