You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Mike Moran <mi...@mac.com> on 2003/01/26 16:50:33 UTC

Configurable DNS resolver?

Hi. It's good to see the release process is up and running now.

I just thought I'd ask if there was any way to configure the DNS 
resolver that HTTPClient uses? Does it just rely on the built-in 
resolver? Whereabouts would one go about inserting a different one?

Thanks,

-- 
Mike


Re: Configurable DNS resolver?

Posted by Ortwin Glück <or...@nose.ch>.
Mike Moran wrote:
> Ah, yes, that is a point. I suspect JNDI will be rather too much 
> overhead for a simple host lookup, but it's worth a look. Async lookups 
> may also still be impossible.

I don't see much overhead. The only expensive call is the service 
lookup. After that the performance fully depends on the implementation 
of the service. Some more resources:

http://java.sun.com/j2se/1.4/docs/guide/jndi/jndi-dns.html

> I've actually already made a wrapper around the dnsjava library (quite 
> old by now, perhaps, as it was done a year ago) so I'd rather make use 
> of that. I'll have a look at the latest HTTPClient release to see how 
> easy it is to do what I suggested before (accept a resolved IP address)


We are looking forward for a proposal.


Re: Configurable DNS resolver?

Posted by Mike Moran <mi...@mac.com>.
On Monday, January 27, 2003, at 10:00 AM, Ortwin Glück wrote:

> Mike Moran wrote:
>> I'll look into it, but I investigated this a year or so ago and then 
>> there was no way to replace the client side resolver. Regardless, one 
>> of the main reasons I would do this would be to avoid synchronous 
>> lookups. Even if the Java API was pluggable, it does not support 
>> asynchronous lookups.
>
> Isn't JNDI supposed to be capable of looking up DNS names from a 
> custom service provider?

Ah, yes, that is a point. I suspect JNDI will be rather too much 
overhead for a simple host lookup, but it's worth a look. Async lookups 
may also still be impossible.

I've actually already made a wrapper around the dnsjava library (quite 
old by now, perhaps, as it was done a year ago) so I'd rather make use 
of that. I'll have a look at the latest HTTPClient release to see how 
easy it is to do what I suggested before (accept a resolved IP address)

-- 
Mike


Re: Configurable DNS resolver?

Posted by Ortwin Glück <or...@nose.ch>.
Mike Moran wrote:
> I'll look into it, but I investigated this a year or so ago and then 
> there was no way to replace the client side resolver. Regardless, one of 
> the main reasons I would do this would be to avoid synchronous lookups. 
> Even if the Java API was pluggable, it does not support asynchronous 
> lookups.

Isn't JNDI supposed to be capable of looking up DNS names from a custom 
service provider?


Re: Configurable DNS resolver?

Posted by Mike Moran <mi...@mac.com>.
Ortwin Glück wrote:

> Michael Becke wrote:
>
>> If you set the host of a method or HttpClient to an IP address then 
>> it will connect to that address.  DNS names are not required, but 
>> will be resolved using the default Java method if used.
>>
>> Mike
>
>
> This causes problems on Multi-Homed sites. A DNS name is required in 
> the HTTP request (Host request header) to uniquely reference the site. 

I was having a look through the latest release code and that was one of 
the things that occurred to me. Am I right in thinking that it would be 
HostConfiguration/HttpConnection that would require extra methods/calls 
to make a distinction between the host connected to (Socket level) and 
the advertised  host (Host: header)?

-- 
Mike


Re: Configurable DNS resolver?

Posted by Ortwin Glück <or...@nose.ch>.
Michael Becke wrote:
> If you set the host of a method or HttpClient to an IP address then it 
> will connect to that address.  DNS names are not required, but will be 
> resolved using the default Java method if used.
> 
> Mike

This causes problems on Multi-Homed sites. A DNS name is required in the 
HTTP request (Host request header) to uniquely reference the site.


Re: Configurable DNS resolver?

Posted by Michael Becke <be...@u.washington.edu>.
On Monday, January 27, 2003, at 04:44 AM, Mike Moran wrote:
>
> I've thought about this further and it would be sufficient for any of 
> the GET/POST/BLAH methods to accept a URL (or whatever they have now) 
> and, in addition, an IP address. The intent would be that the 
> resolution process is done outside the HTTPClient library and the info 
> is simply passed in. The library would then not call any InetAddress 
> methods if the address is passed in.

If you set the host of a method or HttpClient to an IP address then it 
will connect to that address.  DNS names are not required, but will be 
resolved using the default Java method if used.

Mike


Re: Configurable DNS resolver?

Posted by Mike Moran <mi...@mac.com>.
On Monday, January 27, 2003, at 08:13 AM, Ortwin Glück wrote:

> Mike Moran wrote:
>> I just thought I'd ask if there was any way to configure the DNS 
>> resolver that HTTPClient uses? Does it just rely on the built-in 
>> resolver?
>
> Yes it does.

I've thought about this further and it would be sufficient for any of 
the GET/POST/BLAH methods to accept a URL (or whatever they have now) 
and, in addition, an IP address. The intent would be that the 
resolution process is done outside the HTTPClient library and the info 
is simply passed in. The library would then not call any InetAddress 
methods if the address is passed in.

> > Whereabouts would one go about inserting a different one?
>
> Ask Sun?

I'll look into it, but I investigated this a year or so ago and then 
there was no way to replace the client side resolver. Regardless, one 
of the main reasons I would do this would be to avoid synchronous 
lookups. Even if the Java API was pluggable, it does not support 
asynchronous lookups.

-- 
Mike


Re: Configurable DNS resolver?

Posted by Ortwin Glück <or...@nose.ch>.
Mike Moran wrote:
> I just thought I'd ask if there was any way to configure the DNS 
> resolver that HTTPClient uses? Does it just rely on the built-in 
> resolver? 

Yes it does.

 > Whereabouts would one go about inserting a different one?

Ask Sun?