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 2022/08/11 19:19:09 UTC

[GitHub] [httpcomponents-core] j-bernard commented on a diff in pull request #350: HTTPCLIENT-2185 Add support for IDNA 2008 (RFC 5891)

j-bernard commented on code in PR #350:
URL: https://github.com/apache/httpcomponents-core/pull/350#discussion_r943848540


##########
httpcore5/src/main/java/org/apache/hc/core5/net/Host.java:
##########
@@ -72,7 +73,10 @@ static Host parse(final CharSequence s, final Tokenizer.Cursor cursor) throws UR
                 throw URISupport.createException(s, cursor, "Expected an IPv6 address");
             }
         } else {
-            hostName = tokenizer.parseContent(s, cursor, URISupport.PORT_SEPARATORS);
+            // If the hostName contains non-ASCII characters, IDNA processing is required
+            hostName = TextUtils.isAllASCII(s) ?
+                    tokenizer.parseContent(s, cursor, URISupport.PORT_SEPARATORS) :
+                    IDN.toASCII(tokenizer.parseContent(s, cursor, URISupport.PORT_SEPARATORS));

Review Comment:
   java.net.IDN is implementing a deprecated version of IDNA (IDNA 2003). The latest version, IDNA 2008, can be supported using the ICU4j library



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org

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