0

I'm uploading information to a server using a post call (using curlpp, but libcurl directly is fine too).

CURLOPT_PROGRESSFUNCTION callback gets called from time to time with reports on how much data was send until now. When I upload a file, I see this call being made with very small delta between calls.

I want to get a callback BEFORE each part of data is sent, with the information of how much data is going to be transmitted now.

polo
  • 1,352
  • 2
  • 16
  • 35

2 Answers2

1

There is no such callbacks in libcurl. CURLOPT_DEBUGFUNCTION will tell you basically that info, but after it was sent...

Daniel Stenberg
  • 54,736
  • 17
  • 146
  • 222
  • is there any way to inject such callback (preferably only to a specific instance of easy handler)? – polo Oct 10 '12 at 13:59
0

You might use the callback to be set by passing CURLOPT_READFUNCTION to curl_easy_setopt().

This assumes that the amount of data to be read by this callback function will be the size of the next chunk to be sent.

For details please see here: http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTREADFUNCTION

alk
  • 69,737
  • 10
  • 105
  • 255
  • CURLOPT_WRITEFUNCTION and CURLOPT_READFUNCTION were the first things I've tried, but while CURLOPT_PROGRESSFUNCTION is called multiple times during the upload, neither the read or write callback don't seems to be called. Any ideas why? – polo Oct 10 '12 at 12:41