cURL / Mailing Lists / curl-library / Single Mail


Re: curl_multi_perform and write_callback

From: Daniel Stenberg <>
Date: Tue, 18 Nov 2014 00:21:40 +0100 (CET)

On Mon, 17 Nov 2014, Jeroen Ooms wrote:

> It is unclear to me if a single call to curl_multi_perform() will always
> result in at most one callback call to write_callback, or if a single
> curl_multi_perform can actually invoke the callback multiple times.

It might be called multiple times.

> I am unsure if there is a bug somewhere, or if this is expected when the
> network speed outruns the processing (I guess gzip introduced some cpu
> overhead). And if so, what is a good technique to make sure that
> write_callback is only invoked once per curl_multi_perform, to give me a
> chance to read the data without having to keep growing the buffer?

Unfortunately, there is no way to alter libcurl behavior in such a way. If
libcurl for example gets data that expands to 3x the buffer size, it will call
the write callback three times to let the application consume all data

You need to write your callback to take this into account.

List admin:
Received on 2014-11-18