cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Asynch DNS

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

On Mon, 17 Mar 2003, codemastr wrote:

> The multi interface is great for allowing asynchronous sockets, but what
> about DNS? Is there anyway I can handle the DNS lookups? I intend to use
> libcurl in a single threaded (non 'child forking' model) server
> application. Because of this, I need everything to be done asynchronously.
> As I said, the multi interface solves the problem with sockets allowing me
> to use my won select() loop, but what about the DNS lookups?

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.

> I looked through the docs, I didn't see anything that allowed me to handle
> a DNS lookup, so what I thought of was, if I pass a URL in the form of say
> http://127.0.0.1/file.html will libcurl still attempt any kind of DNS
> lookup?

Nope. But you need to make sure to pass in a Host: header that is fine in
case you intend to play HTTP.

> Meaning if I do the DNS before I ever even call libcurl and pass the IP as
> part of the URL, will it allow me to fully control the DNS?

It will.

> Or is there a better way to accomplish this?

Not that I can think of right now.

-- 
 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