cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURL_WRITEFUNC_ABORT for CURLOPT_WRITEFUNCTION

From: Carlos Alloatti <calloatti_at_gmail.com>
Date: Mon, 29 Sep 2008 20:47:13 -0300

On Mon, Sep 29, 2008 at 2:52 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> 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
>

Daniel:

Thank you for your reply. Yes, I have a flag in the callback, so my
wrapper to curl_easy_perform returns CURLE_ABORTED_BY_CALLBACK in this
case.

I was doing it that way before posting, I just posted to point this
out, it felt to me like a little inconsistency that could be fixed
only for elegance and completness's sake, you know, me being so
nitpicker and anal (can we say anal here?)

-- 
Carlos Alloatti
Received on 2008-09-30