On Wed, 27 May 2015, Michael Kaufmann wrote:

As suggested in many mails on this mailing list, I have tried to solve this using CURLOPT_RESOLVE. I have found two problems:

Let me suggeset yet another way with existing functionality:

Use the share interface, and tell each easy handle that uses those host names to use its own share object with its own DNS cache. That way, the CURLOPT_RESOLVE setting would (should!) only affect that particular DNS cache.

For two connections, some psuedo code would be:

  /* two share objects with DNS sharing */
  share1 = curl_share_init()
  curl_share_setopt(share1, DNS);

  share2 = curl_share_init()
  curl_share_setopt(share2, DNS);

  curl_easy_setopt(easy1, CURLOPT_SHARE, share1);
  curl_easy_setopt(easy2, CURLOPT_RESOLVE, "hostname:80:10.0.0.0");

  curl_easy_setopt(easy2, CURLOPT_SHARE, share2);
  curl_easy_setopt(easy2, CURLOPT_RESOLVE, "hostname:80:192.168.0.1");

... then both handles would use the same host name but end up connecting to different IP addresses and yet use SNI and everything just fine.

The drawback is of course that the handles now use one DNS cache each and don't benefit from the previous resolves from the other handles involved.

--

 / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to