diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/SystemDefaultDnsResolver.java b/httpclient5/src/main/java/org/apache/hc/client5/http/SystemDefaultDnsResolver.java index 6a4d29357..7430c9bf7 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/SystemDefaultDnsResolver.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/SystemDefaultDnsResolver.java @@ -26,6 +26,7 @@ */ package org.apache.hc.client5.http; +import java.net.IDN; import java.net.InetAddress; import java.net.UnknownHostException; @@ -44,8 +45,9 @@ public class SystemDefaultDnsResolver implements DnsResolver { @Override public InetAddress[] resolve(final String host) throws UnknownHostException { try { + final String normalizedHost = IDN.toASCII(host); // Try resolving using the default resolver - return InetAddress.getAllByName(host); + return InetAddress.getAllByName(normalizedHost); } catch (final UnknownHostException e) { // If default resolver fails, try stripping the IPv6 zone ID and resolving again String strippedHost = null;