cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl/c-ares problem with a chroot'ed program

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Fri, 6 Feb 2004 15:41:17 +0100 (CET)

On Thu, 5 Feb 2004, codemastr wrote:

> > I believe we can call ares_init() from curl_easy_init() instead, and
> > re-use the same ares handle during the entire curl handle lifetime. Then
> > it would only read that file each time a new curl handle is created.

> I personally don't reuse an easy handle in my program, it's just not
> practical for my application. Therefore for me this wouldn't solve the
> problem for me but I do think it is a good idea anyhow.

I've added it to the TODO-RELEASE document now so that it won't be forgotten.

> > add that to the share interface, either by bundling it in the DNS share
> > data or by providing a separate share entity for it.

> That's really what I want, and I'd do it myself but honestly looking at the
> share interface, I have no idea what it is or how to use it otherwise I'd
> have included a patch :)

Hehe. The share interface basicly creates an object that keeps a set of
properties. You decide what properties, and the share object can be shared
between multiple curl handles, even multiple simultanous ones or just to keep
data between cleanup/init of handles.

So, you'd create a share object, tell it to share ares "stuff" and then add
that share to the curl handle, then when that handle dies and you kill it, you
just create a new handle, and tell that to share the same share object
again...

> > Adding global data is not a good idea

> Indeed, I was just thinking of this along the lines of the global DNS cache
> which to my knowledge uses a global var.

It does, but that was added a long time ago to fix a specific problem in a
short time. Since then we've introduced "the proper way" and even a global DNS
cache should be done using the share interface, if an application wants one I
mean.

I'll add a note about adding ares to the share inteface as well.

-- 
    Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
   [[ Do not send mails to this email address. They won't reach me. ]]
Received on 2004-02-06