cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_multi_perform usage & easy handle "reset"

From: Robert Iakobashvili <coroberti_at_gmail.com>
Date: Sat, 11 Aug 2007 19:24:41 +0200

On 8/11/07, Davide Pippa <thepyper_at_gmail.com> wrote:
>
> >> The only API improvement I would propose could be a function that
> changes
> >> the multi state from the blocking states (CURLM_STATE_COMPLETED or
> >> CURLM_STATE_CANCELLED) to the state CURLM_STATE_INIT, doing the various
> >> initializations; a sort of fusion of remove/add functions without the
> linked
> >> list management.
> >
> >I've been pondering on allowing curl_multi_add_handle() on an already
> added
> >handle to do exactly that: reset the state and thus restart the transfer.
> >Currently, calling curl_multi_add_handle() on an already added handle
> will
> >result in CURLM_BAD_EASY_HANDLE getting returned.
>
> That sounds even better and consistent as you couldn't reset a handle
> not being already in the multi handle... the only drawback is backward
> compatibility, maybe someone relies on that add_handle() behaviour.

I would agree with Davide, that it is better not to have API with
overloading of functionality.
add - should really add,
remove - should really remove

There are two major user scenarios here:
a) restart transfer using a handle with the same URL, etc as for the
previous transfer;
b) re-use the handle for another URL (could be after http - ftp), or other
params;

case a) may be handled by some curl_multi_restart_handle ()

Case b) requires:
1) reset an easy handle;
2) setting a new URL, new params to an easy handle;
Still it does not work without correcting states.
It looks like function curl_multi_restart_handle () might be of assistance
for this case as well.

-- 
Sincerely,
Robert Iakobashvili,
coroberti %x40 gmail %x2e com
...........................................................
http://curl-loader.sourceforge.net
A web testing and traffic generation tool.
Received on 2007-08-11