cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: easy API: curl_easy_perform() doesn't return after receiving all data

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 12 Nov 2006 23:02:24 +0100 (CET)

On Mon, 13 Nov 2006, James Buchanan wrote:

> CURLOPT_READFUNCTION
>
> Function pointer that should match the following prototype: size_t
> function( void *ptr, size_t size, size_t nmemb, void *stream); This
> function gets called by libcurl as soon as it needs to read data in
> order to send it to the peer.
>
> I read that as "This function gets called by libcurl as soon as it needs to
> read data in order to upload it to some server elsewhere..." I took "peer"
> to mean server elsewhere, not "here" as in the application using libcurl.

No. "peer" is the (remote) server in that context. The read function is called
by libcurl when local data needs to be read to get sent away.

> Is it possible CURLOPT_READFUNCTION will be called multiple times, or do the
> callbacks get executed only once, when curl has all the data it can get by
> seeing Content-Length: or the chunked numbers?

Both the read and the write callbacks will be called as many times as
necessary, which can be zero, one or very many times.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-11-12