cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Problems with curl_easy_perform with call back function

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 24 May 2013 23:13:26 +0200 (CEST)

On Fri, 24 May 2013, alpforce wrote:

> From what I understand (and I very well might be mistaken ;-) ) the write
> and read function callbacks should function in the manner similar to stdio's
> fwrite and fread functions... that means returning 0 is not enough , you
> also need to set the error to end-of-file (even though you are not actually
> working with files). I need to check my old code, I made something like that
> once or twice... AGAIN , I MIGHT BE MISTAKEN :) if so , I am sorry ;)

CURLOPT_READFUNCTION

   If you stop the current transfer by returning 0 "pre-maturely" (i.e before
   the server expected it, like when you've said you will upload N bytes and
   you upload less than N bytes), you may experience that the server "hangs"
   waiting for the rest of the data that won't come.

   The read callback may return CURL_READFUNC_ABORT to stop the current
   operation immediately, resulting in a CURLE_ABORTED_BY_CALLBACK error code
   from the transfer (Added in 7.12.1)

quoted from:

http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTREADFUNCTION

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-05-24