cURL / Mailing Lists / curl-library / Single Mail

curl-library

Why does ultotal stay at 0 in progress callback function?

From: Saqib Ali <saqib.ali.75_at_gmail.com>
Date: Thu, 17 Mar 2011 02:10:16 -0400

I have taken my code shown here
http://curl.haxx.se/mail/lib-2011-03/0066.html and modified it in the
following ways to add a progress callback function:

1) Defined my progress callback function:

int progressCallBack(void *clientp, double dltotal, double dlnow, double
ultotal, double ulnow)
{

cout <<
"\n********************************************************************************\n";
cout << "\tFrom within progressCallBack()\n";
cout << "\tdltotal=" << dltotal << ", dlnow=" << dlnow << ", ultotal=" <<
ultotal << ", ulnow=" << ulnow << endl;
cout <<
"********************************************************************************\n\n";
return 0;
}

2. Set the callback:

    curl_easy_setopt(newEasyHandle, CURLOPT_NOPROGRESS, 0);
    curl_easy_setopt(newEasyHandle, CURLOPT_PROGRESSFUNCTION,
progressCallBack);

When I run it, the callback gets called, but ultotal=0 and remains at 0,
even as ulnow increases:

********************************************************************************
        From within progressCallBack()
        dltotal=0, dlnow=0, ultotal=0, ulnow=1.72032e+06
********************************************************************************

********************************************************************************
        From within progressCallBack()
        dltotal=0, dlnow=0, ultotal=0, ulnow=1.7367e+06
********************************************************************************

Does anyone know why my ultotal is staying at 0? It should be the size of
the uploaded file. The file is successfully transferred.

This seems to be the same problem described back in 2008 here:
http://curl.haxx.se/mail/lib-2008-01/0322.html

- Saqib

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-03-17