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: Stoppable curl_easy_perform ?

From: Dan Fandrich via curl-library <>
Date: Mon, 7 Oct 2019 23:49:28 +0200

On Mon, Oct 07, 2019 at 11:27:28PM +0200, Daniel Stenberg via curl-library wrote:
> Consider curl_easy_stop(). Can be called from the same or another thread.
> This stops the specific transfer *iff* that transfer was setup to *allow*
> being externally stopped.
> You enable a transfer to be stopped like this by using the share interface
> and making sure that the share object the transfer uses has the new
> CURL_LOCK_STOP bit set. That bit makes that transfer stoppable.

That seems like an elegant way to ensure thread safety without building in a
lot of platform-specific code into libcurl.

> curl_easy_stop(easy);

Now it's time to bike shed :-) This name implies to me something like "pause"
in that you might expect to be able to start it again later. I'm guessing once
this is called, the transfer is toast, forever. curl_easy_abort() would make
that a bit more clear, since this isn't a clean operation. It also aligns with
the error code CURLE_ABORTED_BY_CALLBACK which would be my first choice as to
what code would be returned by curl_easy_perform() if this were called (barring
creating a new error code).
Received on 2019-10-07