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
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Daniel F via curl-library <curl-library_at_lists.haxx.se>
Date: Thu, 22 Sep 2022 17:31:29 +0200
W dniu 2022-09-22 15:57, Daniel Stenberg napisaĆ(a):
> On Thu, 22 Sep 2022, Daniel F via curl-library wrote:
>
>> You can consider another approach for this - add new global function
>> curl_global_setopt. It would better fit how libcurl works now. This
>> new function should be called after
>> curl_global_init/curl_global_init_mem and before any other libcurl
>> calls.
>
> In theory, yes. We have however rather tried to decrease the use of
> globals over time since they make things complicated in multi-threaded
> situations.
Yes, this can cause problems. One way to address this is to document it
somewhere, unfortunately people still would be able to write bad code
and complain here that something does not work. So better approach would
be to pass all these global options to curl_global_init_opts function:
struct CURL_INIT_OPTIONS curl_opts;
memset(&curl_opts, 0, sizeof(curl_opts));
curl_opts.flags = CURL_GLOBAL_DEFAULT;
curl_opts.foo = ...;
curl_opts.bar = ...;
curl_global_init_opts(&curl_opts, sizeof(curl_opts));
2nd parameter for curl_global_init_opts is added for forward
compatibility, so libcurl could check if structure passed by application
contains given field. Such approach is common is Windows API.
Date: Thu, 22 Sep 2022 17:31:29 +0200
W dniu 2022-09-22 15:57, Daniel Stenberg napisaĆ(a):
> On Thu, 22 Sep 2022, Daniel F via curl-library wrote:
>
>> You can consider another approach for this - add new global function
>> curl_global_setopt. It would better fit how libcurl works now. This
>> new function should be called after
>> curl_global_init/curl_global_init_mem and before any other libcurl
>> calls.
>
> In theory, yes. We have however rather tried to decrease the use of
> globals over time since they make things complicated in multi-threaded
> situations.
Yes, this can cause problems. One way to address this is to document it
somewhere, unfortunately people still would be able to write bad code
and complain here that something does not work. So better approach would
be to pass all these global options to curl_global_init_opts function:
struct CURL_INIT_OPTIONS curl_opts;
memset(&curl_opts, 0, sizeof(curl_opts));
curl_opts.flags = CURL_GLOBAL_DEFAULT;
curl_opts.foo = ...;
curl_opts.bar = ...;
curl_global_init_opts(&curl_opts, sizeof(curl_opts));
2nd parameter for curl_global_init_opts is added for forward
compatibility, so libcurl could check if structure passed by application
contains given field. Such approach is common is Windows API.
-- Regards, Daniel -- Unsubscribe: https://lists.haxx.se/listinfo/curl-library Etiquette: https://curl.se/mail/etiquette.htmlReceived on 2022-09-22