cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: error (6) : name lookup timed out

From: Jamie Lokier <jamie_at_shareable.org>
Date: Mon, 8 Dec 2008 08:33:14 +0000

Phil Blundell wrote:
> > I suppose a setopt option could be added to cause libcurl to automatically
> > call res_init() after a failed DNS lookup and try the lookup again for those
> > apps that don't mind a longer potential timeout in exchange for making the
> > resolve work at all.
>
> That seems like a reasonable idea. Or alternatively, one could arrange
> for libcurl to check the mtime on /etc/resolv.conf just before it calls
> gethostbyname(), and make an automatic call to res_init() if resolv.conf
> has changed. The overhead of stat() should be pretty negligible
> compared to the time it takes to do the DNS lookup itself, so I don't
> think this would be much of a performance hit.

Unfortunately, /etc/resolv.conf is not the whole DNS configuration on
all systems. There's /etc/nsswitch.conf, /etc/gai.conf, /etc/yp.conf,
/etc/ldap.conf, and variations. But I expect it is the one most
likely to change when DNS is updated on most basic setups.

-- Jamie
Received on 2008-12-08