curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: use libcurl to obtain the real-time speed of git clone.

From: Ray Satiro via curl-library <>
Date: Thu, 20 Feb 2020 03:15:59 -0500

On 2/18/2020 4:34 AM, Hongyi Zhao via curl-library wrote:
>> So yes, git should
>> be able to show you the current download speed with libcurl. Doesn't it
>> already do this?
> Yes.
> But I want to use libcurl to do more self-customized jobs.

libcurl can show a progress meter if you disable NOPROGRESS [1]:

curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);

   % Total    % Received % Xferd  Average Speed   Time    Time Time  Current
                                  Dload  Upload   Total   Spent Left  Speed
100 15.5M    0 15.5M    0     0  2412k      0 --:--:--  0:00:06 --:--:--

In cases where the content size isn't known it shows 100%. (Seems to me
it should show ??? or something instead?)

The way it calculates the current speed can be found lib/progress.c [1].
It calculates it approximately once every second based on the last 5
seconds. I made an example from that code to demonstrate [2].


Received on 2020-02-20