cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to list easy handles from a multi handle

From: Jeroen Ooms <jeroen.ooms_at_stat.ucla.edu>
Date: Wed, 8 Jun 2016 12:12:57 +0200

On Tue, Jun 7, 2016 at 1:02 AM, Ray Satiro via curl-library
<curl-library_at_cool.haxx.se> wrote:
> What he was getting at I think is you could propose a patch if you wanted.
>
> If you are in a pinch it's for sure very discouraged to do this but if
> you're comfortable with type punning you could access the internal linked
> list of easy handles for a multi. I experimented with that this afternoon.
> It's an internal structure that may change in the future though so you'd
> need to check each version you choose to support. See:
> https://gist.github.com/jay/5b68c1bde985b1b2d23f2b583a26e5ad

Hmm this is certainly interesting. I'm rather not start hacking though
because I'm writing bindings that should work across versions of
libcurl. However if such a feature were to be added to a future
version of libcurl, we could something like this as a fallback
implementation to support for older versions of libcurl.

However I still wonder how other applications deal with this problem.
This must have come up before, perhaps I'm missing something.

Suppose you implement a browser-like application where async (e.g.
ajax) requests are continuously added to a global multi handle.
Suppose you implement one multi-handle per browser tab. Now if the
user closes the tab, we need to cleanup the multi handle and "pending"
easy-handles from that multi handle.

Is the recommended approach to keep track of this ourselves by
implementing a double-linked list of easy handles in C, in which we
manually append and remove pointers to the easy handles when they are
added/removed to the multi handle?
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-06-08