cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: CURLOPT_RESOLVE and cycling through addresses (avoiding lack-of-IPv6-connectivity)

From: Yehezkel Horowitz <horowity_at_checkpoint.com>
Date: Sun, 13 Oct 2013 10:24:24 +0000

>Then, we create an easy handle, create *curl_slist for our CURLOPT_RESOLVE entries, and then add the IPv6 entries first, followed by the IPv4 addresses.

>So, if we get an IPv6 address, we'll attempt to connect, and if we don't have any IPv6 connectivity, we get CURLcode 7. Okay, cool, but... my next request (new easy handle) does the same thing and makes the same connection, and so we end up with a failure to connect to the v4 addresses.

>My question is - after reading url.c/hostip.c and not entirely following the scoping - how do I get libcurl to cycle through the addresses given to it?  I am NOT reusing easy handles, I imagine this is the issue.  If I reuse an easy handle, will libcurl cycle through addresses for me?  Or is it preferable to feed just one address into the CURLOPT_RESOLVE option and deal with that externally in my application?  Other than keeping track of my easy handle for a request and calling curl_easy_reset() after each request, is there anything else I need to do?

You can remove the IPv6 entry from your failed easy handle (with -HOST:PORT), and call curl_easy_perfrom() again on the same easy handle (or create a new one and configure it with only IPv4 addresses).

HTH

Yehezkel Horowitz

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