> 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():
That's exactly what I would like to avoid - going through a gazillion places in numerous components and change something there just to improve how Curl_ipv6works(). Unfortunately, my "application" is a quite large - with a lot of independent components which are not easy or even feasible to change. Some of the components using curl code are "3rd party" code integrated into my application, which I just can't change, and which also have regressions caused by default Curl_ipv6works() behavior. So again, the "curl_global_init_ipv6() with callback" approach solves this problem very easily and cleanly with minimal changes in the code and without any need to touch "closed code" components, which just can't be modified. Besides, Curl already has mechanism allowing applications to define global memory management functions. So, the "IPv6 works" callback will be just another application/system level callback allowing to tune how the application should handle some "system" level behavior. Thanks, Dmitry Karpov -----Original Message----- From: curl-library <curl-library-boun...@lists.haxx.se> On Behalf Of Dan Fandrich via curl-library Sent: Tuesday, September 20, 2022 1:42 PM To: libcurl development <curl-library@lists.haxx.se> Cc: Dan Fandrich <d...@coneharvesters.com> Subject: Re: [EXTERNAL] Re: Feature request: provide ability to set a global callback function telling libcurl if IPv6 works on the system 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 -- Unsubscribe: https://lists.haxx.se/listinfo/curl-library Etiquette: https://curl.se/mail/etiquette.html