cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: can either libcurl's SSL/TLS hostname verification, or hostname resolving, be overridden?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 9 Feb 2015 13:13:39 +0100 (CET)

On Thu, 5 Feb 2015, Vadim Grinshpun wrote:

> I'm writing a program (using libcurl's "multi" interface) that needs to have
> concurrent persistent HTTP connections to the same hostname *but* to
> different IPs (the hostname in question uses DNS-based load balancing, so IP
> diversity is important).

Let me then first just mention that having "IP diverity" from a single client
based on DNS is really hard. A client will basically try the same IP after the
DNS lookup, or at least in the same order.

> Unfortunately, the obvious solution of disabling libcurl's DNS caching isn't
> sufficient: the local DNS resolver has a quirk s.t. under certain
> circumstances it will provide the same response to multiple requests issued
> within a very short amount of time, so I can't rely on it to produce
> diversity;

"DNS pinning" is considered something good at times =)

> and CURLOPT_RESOLVE wouldn't provide me enough control for this, since, if I
> understand correctly, the same entry would get used by multiple easy handles
> due to the sharing of the DNS cache associated with the multi handle.

Correct. It never struck me that you actually might want to _not_ have the
same DNS cache for all the entries in a multi handle!

But... it should be possible to use the share interface and create a shared
object for reach handle and have them all use their own DNS cache and make all
handles use their own. I think.

Then you can use CURLOPT_RESOLVE and set a unique IP for each handle. Or for
each DNS cache actually.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2015-02-09