cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Is it normal to the progress callback be called once again after returning non-zero value?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 13 Jun 2014 23:45:08 +0200 (CEST)

On Wed, 11 Jun 2014, Ray Satiro wrote:

>> - if(Curl_pgrsDone(conn) && !result)
>> + if((status != CURLE_ABORTED_BY_CALLBACK) && Curl_pgrsDone(conn) &&
>> !result)
>> result = CURLE_ABORTED_BY_CALLBACK;

Oops. I wanted that to instead be:

- if(Curl_pgrsDone(conn) && !result)
+ if(!result && Curl_pgrsDone(conn))

As when we've already detected and error, whichever it may be, I don't think
we should call the progress callback again. Basically that could lead to the
similar problem: return an error from another callback and yet you get the
progress callback called again.

> I've attached a simple example without the libuv stuff by modifying curl
> example simple.c, should be easier to work with.

Thanks alot, that helps. Once we agree on the fix I'll use your test code here
to write up a proper test case for this to make sure we don't reintroduce a
problem like this in the future.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-06-13