cURL / Mailing Lists / curl-library / Single Mail

curl-library

Write call back not called for zero length files (curl version 7.24)

From: sandeep a <sandeep.a.sastry_at_gmail.com>
Date: Sun, 26 Feb 2012 15:56:58 +0400

Hello,

I am using libcurl version 7.24. I am trying to download a file of size 0.
I see in curl documentation that write callback can be called with size as
0, if file is empty. (snippet from curl documentation pasted as below).

I also see that in the release notes of " 7.12.2 - Oct 18 2004", there is a
bug fix namely "downloading empty files now calls the write callback
properly".
But I am seeing that the write callback is not being invoked in version
7.24 for empty files.

Thanks,
-Sandeep A

CURLOPT_WRITEFUNCTION

Function pointer that should match the following prototype: size_t
function( char *ptr, size_t size, size_t nmemb, void *userdata); This
function gets called by libcurl as soon as there is data received that
needs to be saved. The size of the data pointed to by ptr is size multiplied
with nmemb, it will not be zero terminated. Return the number of bytes
actually taken care of. If that amount differs from the amount passed to
your function, it'll signal an error to the library. This will abort the
transfer and returnCURLE_WRITE_ERROR.

From 7.18.0, the function can return CURL_WRITEFUNC_PAUSE which then will
cause writing to this connection to become paused. See
curl_easy_pause(3)<http://curl.haxx.se/libcurl/c/curl_easy_pause.html>
for
further details.

*This function may be called with zero bytes data if the transferred file
is empty.*

*
*

*
*

*
*

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-02-26