curl / Mailing Lists / curl-library / Single Mail


Re: Question to invokation behaviour of READFUNCTION for HTTP POST uploads

From: Daniel Stenberg via curl-library <>
Date: Thu, 30 Aug 2018 23:51:13 +0200 (CEST)

On Thu, 30 Aug 2018, Syberichs Stefan (ETAS/ERS-CON) via curl-library wrote:

> I have a question which is related to (possibly ?) different behaviour
> between some libcurl versions that we have discovered, I am still trying to
> understand the background.

Without you telling us exactly what options you set, this is hard to give a
definite answer to.

Do you set CURLOPT_INFILESIZE? Do you set Content-Length yourself? Do you
upload chunked-encoded?

> we miss the READFUNCTION call where we finally return 0 to stop the upload.
> In our current implementation that leads to a hang, because we expect the
> last call.

It sounds like something made it stop. Does CURLOPT_VERBOSE give any output?
Like perhaps "We are completely uploaded and fine" ?

> How often / until which point should we expect invokations of the
> READFUNCTION callback in theory ?

When the socket becomes readable libcurl calls the callback for data and it
will continue to do that for as long there is more data to send.

> until we return 0 ?

No, typically libcurl knows how much data to send because you told it. Then it
only calls for data for as long as the total size hasn't been reached yet.

> Is it known when this behaviour changed inbetween 7.35.0 and 7.47.0, and why
> ?

Not that I can recall.

Received on 2018-08-30