cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: anybody ever met the percent issue in result?

From: 雷王 <skygragon_at_gmail.com>
Date: Thu, 5 Nov 2009 01:03:16 +0800

2009/11/5 雷王 <skygragon_at_gmail.com>

>
>
> 2009/11/4 Daniel Stenberg <daniel_at_haxx.se>
>
>> On Wed, 4 Nov 2009, 雷王 wrote:
>>
>> it seems the percent number is weird zero if the content request is
>>> smaller than 100 bytes? is it a known bug?
>>>
>>
>> I've seen similar things reported in the past, but I've not been able to
>> repeat them myself so I can't really tell whose to blame or how to fix.
>>
>> --
>>
>> / daniel.haxx.se
>> -------------------------------------------------------------------
>> List admin: http://cool.haxx.se/list/listinfo/curl-users
>> FAQ: http://curl.haxx.se/docs/faq.html
>> Etiquette: http://curl.haxx.se/mail/etiquette.html
>>
>> please do not request html content, do request "vod" content like jpg or
> avi files, you might reproduce this easily.....
> e.g,
> [root_at_localhost ~]# curl --version
> curl 7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b
> zlib/1.2.3 libidn/0.6.5
> Protocols: tftp ftp telnet dict ldap http file https ftps
> Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz
> [root_at_localhost ~]# curl --range 100-199
> http://www26.babidou.com/pic/2008/5/10/seanghx/john%20curl.jpg -o ./file
>
> % Total % Received % Xferd Average Speed Time Time Time
> Current
> Dload Upload Total Spent Left
> Speed
> 0 100 0 100 0 0 386 0 --:--:-- --:--:--
> --:--:-- 0
>
> it seems suspect in lib/process.c:410, would be better if it looks like:
    if((total_transfer >= total_expected_transfer) ||
(total_expected_transfer > CURL_OFF_T_C(100)))
      total_percen = (curl_off_t)((total_transfer * CURL_OFF_T_C(100) *1.0)/
total_expected_transfer);

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-11-04