arturobernalg commented on code in PR #431: URL: https://github.com/apache/httpcomponents-client/pull/431#discussion_r1157490537
########## 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 Here's an example of how this conversion could be necessary: let's say you have a URI with an IDN hostname like http://www.öbb.at/, and you are using the SchemePortResolver to determine the default port for the http scheme. If the getHostName method returns the hostname as www.öbb.at, some components in the networking stack may not be able to handle it correctly, and you may get errors or unexpected behavior. By converting the hostname to its ASCII representation (www.xn--bb-eka.at) using IDN.toASCII, you 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-unsubscr...@hc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org