curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: [EXTERNAL] Re: Feature request: provide ability to set a global callback function telling libcurl if IPv6 works on the system

From: Dan Fandrich via curl-library <curl-library_at_lists.haxx.se>
Date: Tue, 20 Sep 2022 13:42:03 -0700

On Tue, Sep 20, 2022 at 08:28:10PM +0000, Dmitry Karpov wrote:
> Yes, I want to use dual-stack in general. That's why my application has numerous components which use CURLOPT_IPRESOLVE = AUTO.
> But if IPv6 doesn't work on a "system level", I want my curl code to be as fast as "IPv4 only" resolve mode without changing anything in my code - like doing detection that IPv6 doesn't work and modifying IP resolve mode in all the places where I create and set an easy handle (that's your suggestion as I understood it).

I still haven't seen any reason this needs to be a callback, besides that it's
easier to integrate into your program. If you insist on this being a callback,
then you can just call it yourself by changing your code from using
curl_easy_init() everywhere to using dmitry_curl_easy_init():

CURL *dmitry_curl_easy_init(void) {
  CURL *c=curl_easy_init();
  my_ipv6_callback(c);
  return c;
}

libcurl doesn't need a new callback mechanism to do this.

Dan
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2022-09-20