cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Asynch DNS

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 17 Mar 2003 19:44:11 +0100 (CET)

On Mon, 17 Mar 2003, codemastr wrote:

> > libcurl uses synchronous DNS lookups (as there are no portable
> > alternatives). I do hope to get libdenise
> > (http://libdenise.sourceforge.net/) good enough to add asynch lookups in
> > the future, but that is still but a dream.

> Well what I was thinking is something along the lines the the multi
> interface. Meaning I handle DNS myself. I don't know if that is actually
> doable on your end, but I think it would be the most flexible way.

Perhaps most flexible, but it would add an unnecessary API that most people
wouldn't need/want.

But of course, bouncing around ideas and design plans is fun and certainly
helps. As these things still aren't close to being implemented, I'm all ears
for ideas and suggestions on how this could be done.

> For example in my program, DNS is handled within the main select() loop. So
> if it were implemented the way I described, I could simply instruct my
> resolver to query libcurl to see if it has any pending DNS requests by
> calling curl_multi_dns_queries(). If there is, it returns an slist of all
> the hostnames it needs to have resolved, if not, it returns NULL. I then
> handle this in my resolver, and then I call say curl_multi_dns_perform()
> where I pass an slist of hostents. Granted this system doesn't work 100%,
> but I'm just throwing out basic ideas.

Given that my vision becomes reality, you wouldn't have to care about what
DNS is or when libcurl resolves names etc. The multi interface already
provides mechanisms enough to work asynchronously, and I hope to one day have
DNS lookups embedded in this in the same way the non-blocking connects are
today. As a multi-interface user, you don't need to know when libcurl is
actually connecting or if it in fact is transferring data. The API and
behavior is the same.

Thus, adding asynch name resolves to this would require exactly zero lines of
code changes in the client applications. I think people will like that.

> The way I'm thinking is, you want to use libdenise, well maybe I use adns,
> and I'd like to have adns serve all my DNS requests (for whatever reason)

You would need to produce a few good reasons for this first.

> if you handle the DNS yourself I really have no control over that, but if
> an interface exists that allows me to worry about DNS, then I can do it
> however I want.

Now if libcurl does asynch name lookups fine under the hood, why would you
want to fix what isn't broken?

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
Received on 2003-03-17