hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vasile Alin <alinachegal...@gmail.com>
Subject Re: svn commit: r1165635 - in /httpcomponents/httpclient/trunk: ./ httpclient/src/main/java/org/apache/http/conn/ httpclient/src/main/java/org/apache/http/impl/conn/ httpclient/src/test/java/org/apache/http/impl/conn/
Date Tue, 06 Sep 2011 17:55:24 GMT
On 6 September 2011 19:02, sebb <sebbaz@gmail.com> wrote:

>>     /**
>>      * Creates a new client connection operator for the given scheme registry.
>>      *
>> @@ -100,6 +105,26 @@ public class DefaultClientConnectionOper
>>             throw new IllegalArgumentException("Scheme registry amy not be
null");
>>         }
>>         this.schemeRegistry = schemes;
>> +        this.dnsResolver = null;
>
> Could replace this with a default resolver that did
>
>     return InetAddress.getAllByName(host);
>
>> +    }

Good idea.


>     public OperatedClientConnection createConnection() {
> @@ -233,6 +258,10 @@ public class DefaultClientConnectionOper
>      * Resolves the given host name to an array of corresponding IP addresses, based
on the
>      * configured name service on the system.
>      *
> +     * If a custom DNS resolver is provided, the given host will be searched in
> +     * it first. If the host is not configured, the default OS DNS-lookup
> +     * mechanism is used.
> +     *
>      * @param host host name to resolve
>      * @return array of IP addresses
>      * @exception  UnknownHostException  if no IP address for the host could be determined.
> @@ -240,7 +269,11 @@ public class DefaultClientConnectionOper
>      * @since 4.1
>      */
>     protected InetAddress[] resolveHostname(final String host) throws UnknownHostException
{
> -        return InetAddress.getAllByName(host);
> +        if (dnsResolver != null) {
> +            return dnsResolver.resolve(host);
> +        } else {
> +            return InetAddress.getAllByName(host);
> +        }

This javadoc should be corrected, into something like:

 /**
     * Resolves the given host name to an array of corresponding IP
addresses, based on the
     * configured name service on the provided DNS resolver. If one
wasn't provided, the system
     * configuration is used.
     *
     * @param host host name to resolve
     * @return array of IP addresses
     * @exception  UnknownHostException  if no IP address for the host
could be determined.
     *
     * @see {@link DnsResolver}
     * @see {@link SystemDefaultDnsResolver}
     * @since 4.1
     */

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message