cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURL_WRITEFUNC_ABORT for CURLOPT_WRITEFUNCTION

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 29 Sep 2008 07:52:17 +0200 (CEST)

On Sun, 28 Sep 2008, Carlos Alloatti wrote:

> Is there any reason why there is no CURL_READFUNC_ABORT equivalent for the
> CURLOPT_WRITEFUNCTION?
>
> Maybe CURL_WRITEFUNC_ABORT could be added?
>
> The reason is to be able to abort a download in the write callback, and
> instead of getting a "Failed writing received data to disk/application"
> error, get a CURLE_ABORTED_BY_CALLBACK error code.

Well, the reason is simply because you can abort it easily by just returning
any value that isn't the same as passed in. The minor thing as the different
return code hasn't prompted me (or anyone else) to push for a
CURL_WRITEFUNC_ABORT return code. You can easily set a variable or similar
within the callback before you abort it, to make the parent function realize
this was the cause.

-- 
  / daniel.haxx.se
Received on 2008-09-29