cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to use DNS cache in curl

From: Nick Zitzmann <nick_at_chronosnet.com>
Date: Thu, 14 Nov 2013 18:08:23 -0600

On Nov 14, 2013, at 2:57 AM, Gaurav Rastogi -X (garastog - ARICENT TECHNOLOGIES MAURIITIUS LIMITED at Cisco) <garastog_at_cisco.com> wrote:

> Hi,
>
> I want to use DNS caching feature of curl as currently every time I make https request a DNS request is sent.
> Due to this my performance is downgraded and also sometimes DNS takes too much time due to which my https requests timeouts.
> Let me know with an example how to enable DNS caching in CURL.

Either (1) use the multi API or (2) create a CURLSH structure using curl_share_init(), set it up to be a DNS cache, set its lock/unlock callbacks, and assign it to your easy handle(s) using the option CURLOPT_SHARE. For the latter, see the man pages for curl_share_init and curl_share_setopt for details.

Nick Zitzmann
<http://www.chronosnet.com/>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-11-15