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

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

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


##########
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:
   @arturobernalg I am not sure I understand why host name conversion is necessary here. The purpose of the `SchemePortResolver` is to provide the default port for a protocol scheme: `http` -> 80, `https` -> 443, `myhttp` -> 8888. Could you please give an example where the proposed host name translation is necessary?



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