cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Stopping a "multi" transfer

From: Martin C. Martin <martin_at_metahuman.org>
Date: Mon, 10 Mar 2003 09:04:12 -0500

Daniel Stenberg wrote:
>
> On Sun, 9 Mar 2003, Martin C. Martin wrote:
>
> > What's the right way to stop a multi transfer in mid-transfer?
> > [I]f I take my easy
> > handle out of the multi, can I just call "curl_easy_cleanup()" on it?
>
> That's the way I'd say is the prefered way.
>
> > Does curl_easy_cleanup() know about the nefarious activities that the multi
> > interface may have been up to?
>
> No, but the general thought is that it shouldn't need to either.

Well, I'd call that an implementation detail. If I download half of a web
page, take the easy out of the multi and call curl_easy_perform, I'd
expect to get the other half of a web page. I'd expect that because of
this line in curl_multi_remove:

     When the easy handle has been removed from a multi stack, it
     is again perfectly legal to invoke curl_easy_perform() on
     this easy handle.

and this sentence in the multi intro:

     Once removed from the multi handle, you can again use other
     easy interface functions like curl_easy_perform on the han-
     dle or whatever you think is necessary.

Starting a curl_easy_perform with half the page already downloaded is not
a state the easy handle can be in using just easy commands. Whether the
representation of that state matches the representation of "connection
still open but next download hasn't started yet" is an implementation
issue. Just my two cents.

> don't hesitate to check out the sources and single-step your ways around
> a little! ;-)

I've done it before, I can do it again. :)

> Oh, and feel free to suggest what updates to the docs we need to make this
> more apparent there...

The current page for curl_easy_cleanup says:

     This will effectively close all connections this handle has
     used and possibly has kept open until now. Don't call this
     function if you intend to transfer more files.

Assuming the multi interface CAN leave an easy with a half-transfered
file, you might change that first sentence to "This will effectively halt
all transfers in progress (if this easy was part of a multi interface) and
close all connections..."

- Martin

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-03-10