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: Getting a list of easy handles in a multi handle - possible?

From: Henrik Holst via curl-library <>
Date: Sun, 27 Aug 2023 17:15:32 +0200

Den sön 27 aug. 2023 kl 10:02 skrev Ray Satiro via curl-library <>:

> On 8/26/2023 2:27 PM, Daniel Stenberg via curl-library wrote:
> Am I missing something or is this something that could be added?
> Something like this can absolutely be added, and it might even make a lot
> of sense.
> I think I personally would favor an approach that exports the list of easy
> handles, or perhaps just a way for an application to iterate over them all,
> rather than a more simple "close all easy handles the multi handle knows".
> Mostly because providing an iterator opens up for more use cases than
> "just" closing down nicely.
> Thoughts? Any proposals for how such an API would look like?
> How about just return a multi maintained linked list of non-internal easy
> handles?
> curl_easy_handles_list *list = curl_multi_get_handles(multi);
> struct curl_easy_handle_list {
> CURL *easy;
> struct curl_easy_handle_list *next;
> };

wouldn't it be much easier interface to just have a

CURL **handles = curl_multi_get_handles(multi);

where the last position in *handles would be NULL to indicate the end? Yes
it would require libcurl to allocate a list and populate it at the call,
but the allocation had to be done in this case anyway and returning a
complete list at once avoids the problem with adds/dels during iteration of
the list.


> --
> Unsubscribe:
> Etiquette:

Received on 2023-08-27