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/03/01 19:49:39 UTC

[GitHub] [httpcomponents-client] arturobernalg commented on a diff in pull request #418: Fix issue with LLv6 literals in URLs

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


##########
httpclient5/src/main/java/org/apache/hc/client5/http/SystemDefaultDnsResolver.java:
##########
@@ -40,7 +40,14 @@ public class SystemDefaultDnsResolver implements DnsResolver {
 
     @Override
     public InetAddress[] resolve(final String host) throws UnknownHostException {
-        return InetAddress.getAllByName(host);
+        try {

Review Comment:
   The reason why we don't want to call stripsIPv6ZoneId all the time is that it involves additional processing and may not be necessary for hostnames that are not LLv6. This additional processing can cause a slight delay in the overall execution time of the resolve method.
   In addition, if we always call stripsIPv6ZoneId before calling InetAddress.getAllByName, it means that we will be making two DNS queries for every hostname, even those that are not LLv6. This can result in unnecessary network traffic and may cause performance issues in certain environments.
   Therefore, the approach of only calling stripsIPv6ZoneId when a UnknownHostException is caught and the hostname is an LLv6 address is a more targeted and efficient solution.



##########
httpclient5/src/main/java/org/apache/hc/client5/http/SystemDefaultDnsResolver.java:
##########
@@ -40,7 +40,14 @@ public class SystemDefaultDnsResolver implements DnsResolver {
 
     @Override
     public InetAddress[] resolve(final String host) throws UnknownHostException {
-        return InetAddress.getAllByName(host);
+        try {

Review Comment:
   HI @ok2c 
   The reason why we don't want to call stripsIPv6ZoneId all the time is that it involves additional processing and may not be necessary for hostnames that are not LLv6. This additional processing can cause a slight delay in the overall execution time of the resolve method.
   In addition, if we always call stripsIPv6ZoneId before calling InetAddress.getAllByName, it means that we will be making two DNS queries for every hostname, even those that are not LLv6. This can result in unnecessary network traffic and may cause performance issues in certain environments.
   Therefore, the approach of only calling stripsIPv6ZoneId when a UnknownHostException is caught and the hostname is an LLv6 address is a more targeted and efficient solution.



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