cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl not refreshing DNS entries populated with CURLOPT_RESOLVE

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 13 Oct 2013 00:16:02 +0200 (CEST)

On Fri, 11 Oct 2013, Romulo Ceccon wrote:

> I use the multi interface to cache the connections to some server between
> requests and CURLOPT_RESOLVE to populate the DNS cache (my scenario is a
> private GPRS network with no working DNS servers). But even though I
> initialize the DNS entries with every easy handle libcurl sometimes
> considers them expired when initiating the connection. As a result libcurl
> tries to reach one of the default DNS servers, which always results in a
> CURLE_COULDNT_RESOLVE_HOST in my case.
>
> The documentation states that CURLOPT_RESOLVE just pre-populates the DNS
> cache, which implies it should follow the same rules about expiration.

That wasn't my intention though. I meant for the entries to get stuck in the
cache since they're kind of magically added because you have special knowledge
so if they would get kicked out from the cache there's no easy way to get it
back.

So, if a CURLOPT_RESOLVE name gets expunged I actually consider that a bug.

Or can you think of a useful case when you actually want these fake entries to
get flushed?

> I attached a program demonstrating the problem (tested on
> Ubuntu-64/Linux-3.8.0-31 with latest version from github:
> 9b33ecfd013d0713a707aec097f3fd6fe3d495a3), also available at:
> https://gist.github.com/romuloceccon/6941606. It outputs the following. Note
> that you can't reproduce it when omitting the call to sleep():

I haven't had time to try this out yet but I hope I will soon.

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