cURL / Mailing Lists / curl-library / Single Mail

curl-library

Canceling transfers with multi interface

From: Andrew Penner <ampenner_at_gmail.com>
Date: Fri, 16 Mar 2007 12:53:29 -0500

I have followed the examples to write a basic program using the curl
multi interface. For now, all I am dealing with is HTTP get requests
(I'm not setting any fancy options for each easy handle).

Adding easy handles dynamically in the main loop works just fine; so
does removing them when a transfer is complete.

My question is: how do I cancel transfers while they are in progress?
Technically, I can make the download stop by returning the appropriate
value from the write callback or the progress callback, but there are
two issues:

1. Initiating the cancel from the callback function causes dozens of
tcp resets to occur. This doesn't seem normal.
2. The man pages say that this method is not recommended for programs
using the multi interface.

I really don't want one thread per download; I'm trying to stick with
the nice multi interface.

Is there a better way to cancel a download?

Thanks,
Andrew
Received on 2007-03-16