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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to