You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "arturobernalg (via GitHub)" <gi...@apache.org> on 2023/04/03 18:50:37 UTC

[GitHub] [httpcomponents-client] arturobernalg commented on a diff in pull request #431: Enable IDN conversion for scheme port resolver

arturobernalg commented on code in PR #431:
URL: https://github.com/apache/httpcomponents-client/pull/431#discussion_r1156339020


##########
httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java:
##########
@@ -751,6 +766,26 @@ public CloseableHttpClient build() {
             }
         }
 
+        if (enableIDNConversion && schemePortResolver == null) {
+            // Load the public suffix list
+            final PublicSuffixMatcher publicSuffixMatcher = PublicSuffixMatcherLoader.getDefault();
+
+            schemePortResolver = new DefaultSchemePortResolver() {
+                @Override
+                public int resolve(final HttpHost host) {
+                    final String hostname = IDN.toASCII(host.getHostName());

Review Comment:
   @ok2c 
   The purpose of converting the hostname to its ASCII representation using the IDN.toASCII method is to handle domain names that contain non-ASCII characters which may not be supported by some components in the networking stack. By converting the hostname to its ASCII representation, now we ensure that it can be correctly resolved and used by these components.



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