cURL / Mailing Lists / curl-library / Single Mail


Re: How to use DNS cache in curl

From: Daniel Stenberg <>
Date: Fri, 15 Nov 2013 10:36:16 +0100 (CET)

On Thu, 14 Nov 2013, Gaurav Rastogi -X (garastog - ARICENT TECHNOLOGIES MAURIITIUS LIMITED at Cisco) wrote:

> 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

libcurl uses its DNS cache by default as long as you re-use the handle. You
can change the time it'll hold entries in the cache - it is only meant to aid
"spikes" or rapid requests to the same host names as it doesn't get the "true"
TTL values.

The multi interface or the share interface allow you to share the cache over
multiple simultanoues requests.

List admin:
Received on 2013-11-15