55367

Curl's CURLOPT_XFERINFOFUNCTION callback returns dlnow > dltotal

Question:

I've been using CURL for all HTTP communication. I need a to know when the server is done sending me a response. According to the CURL documentation CURLOPT_XFERINFOFUNCTION is designed to do just that.

However, every time the callback function get hit, all the arguments are either all 0, or all 0 besides dlnow which is 233. This is not the expected behavior, and i haven't found people with a similar problem after googling.

Callback initiation:

curl_easy_setopt(handle, CURLOPT_XFERINFOFUNCTION, CLibCurlThreadTask::CurlProgress); curl_easy_setopt(handle, CURLOPT_NOPROGRESS, 0L);

Callback function:

int CLibCurlThreadTask::CurlProgress(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) { if( dltotal > 0 || dlnow > 0 || ultotal > 0 || ulnow > 0) { CryLogAlways("UP: %" CURL_FORMAT_CURL_OFF_T " of %" CURL_FORMAT_CURL_OFF_T " DOWN: %" CURL_FORMAT_CURL_OFF_T " of %" CURL_FORMAT_CURL_OFF_T "\r\n", ulnow, ultotal, dlnow, dltotal); } return CURLE_OK; }

Output:

<blockquote>

UP: 0 of 0 DOWN: 233 of 0

UP: 0 of 0 DOWN: 233 of 0

UP: 0 of 0 DOWN: 233 of 0

UP: 0 of 0 DOWN: 233 of 0

</blockquote>

Answer1:

This can be a problem of 32bits / 64bits platform.

See: <a href="http://forum.lazarus.freepascal.org/index.php?topic=29767.0" rel="nofollow">http://forum.lazarus.freepascal.org/index.php?topic=29767.0</a>

Recommend