cURL / Mailing Lists / curl-library / Single Mail


Re: BUFFERSIZE on read callbacks.

From: Daniel Stenberg <>
Date: Thu, 18 Dec 2003 19:21:39 +0100 (CET)

On Thu, 18 Dec 2003, Wei Weng wrote:

> The read callback declaration is as read_callback(void* buffer, size_t size,
> size_t nmemb, void* stream). Say, the application might pass me size as
> 10000 bytes, and I have to return to it this much data when the read
> callback exits. I can not set a limit on the amount of data read_callback
> requests.

Yes, you can! The size asked for by libcurl in the read callback is the
maximum amount of data you can return, you can safely opt to return less.

In fact, that's how the command line tool implements its transfer-speed
limiter (it thus also involves a sleep before it returns control to the

Or is there something I'm missing?

    Daniel Stenberg -- --
   [[ Do not send mails to this email address. They won't reach me. ]]
This email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now!
Received on 2003-12-18