cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl dns cache and dns changes on linux

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 9 Jul 2008 09:45:33 +0200 (CEST)

On Wed, 9 Jul 2008, Mathew Hounsell wrote:

> I tracked it down and it turns out that glibc gethostbyname_r won't
> automatically reload it's configuration if that configuration changes. You
> have to manually call res_init. See Below.

> libc caches resolv.conf forever

> That's what res_init() is for, call it.

Oh. Yeah I bet that took a little while figuring out... so how do you deal
with it in your application? Do you call res_init() when you get (weird)
libcurl errors?

I wonder if we can make libcurl itself use it in a clever way somehow without
it causing badness. res_init() doesn't seem to be POSIX either so this "That's
what res_init() is for" statement seems very glibc-specific.

Anyone knows how this works on other systems/libc implementations?

-- 
  / daniel.haxx.se
Received on 2008-07-09