Question to invokation behaviour of READFUNCTION for HTTP POST uploads
Date: Thu, 30 Aug 2018 10:01:01 +0000
Dear libcurl community,
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.
OS: Ubuntu Linux 14.04 (x86)
Libcurl version: 7.35.0 (also 7.47.0 and 7.61.0 for the differences we observe), with openssl, but we anyway look at a plain http usecase right now
Use case: HTTP POST (multi_perform) upload binary data with our own headers
So we have written our own little HTTPO POST upload client (multi-perform) including creating our own HTTP headers (for the Content type). We pass a READ_CALLBACK function pointer and this is getting called by libcurl multiple times (with libcurl 7.35.0) , until finally all the data, including the final delimiter, is uploaded. After this, the callback is called once again, and then our callback returns 0 to indicate the upload is finished.
Works fine with out Ubuntu 14.04.
Now, somebody else builds our upload client library in a later Ubuntu version (16.04), which ships with libcurl version 7.47.0: Suddenly, the last READFUNCTION callback invocation is missing. All the data is upload actually, but 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.
The rest of our code is the same, we only link against a different libcurl versions. Libcurl seems to not keep calling the READFUNCTION at least from 7.47.0 onwards (but in 7.35.0 it still did).
Since either which way the data is uploaded completely, there is no real problem with the upload – except that we would like to
- understand why we see different behaviour with different libcurl version
- make our client so generic that it works the same with all libcurl versions between 7.35.0 and the latest one
How often / until which point should we expect invokations of the READFUNCTION callback in theory ? until we return 0 ? or is it normal that it stops earlier because libcurl thinks the upload is finished ? Is it known when this behaviour changed inbetween 7.35.0 and 7.47.0, and why ?
Thanks a lot for your support in advance
Mit freundlichen Grüßen / Best Regards
Embedded Software Specialist
Phone +49 711 3423 - 2948
Managing Directors: Friedhelm Pickhard, Bernd Hergert, Christopher White
Chairman of the Supervisory Board: Dr. Walter Schirm
Registered Office: Stuttgart; Registration Court: Amtsgericht Stuttgart HRB 19033
Received on 2018-08-30