aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES7
-rw-r--r--RELEASE-NOTES2
-rw-r--r--lib/progress.c32
3 files changed, 29 insertions, 12 deletions
diff --git a/CHANGES b/CHANGES
index 7d68e5314..e60000897 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,13 @@
Changelog
+Daniel Stenberg (4 Nov 2009)
+- I fixed several problems with the transfer progress meter. It showed the
+ wrong percentage for small files, most notable for <1000 bytes and could
+ easily end up showing more than 100% at the end. It also didn't show any
+ percentage, transfer size or estimated transfer times when transferring
+ less than 100 bytes.
+
Version 7.19.7 (4 November 2009)
Daniel Stenberg (2 Nov 2009)
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index 696875b79..cb688c5ea 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -13,7 +13,7 @@ This release includes the following changes:
This release includes the following bugfixes:
- o
+ o progress meter percentage and transfer time estimates fixes
This release includes the following known bugs:
diff --git a/lib/progress.c b/lib/progress.c
index eddd852c1..c96db2abb 100644
--- a/lib/progress.c
+++ b/lib/progress.c
@@ -370,21 +370,29 @@ int Curl_pgrsUpdate(struct connectdata *conn)
}
/* Figure out the estimated time of arrival for the upload */
- if((data->progress.flags & PGRS_UL_SIZE_KNOWN) &&
- (data->progress.ulspeed > CURL_OFF_T_C(0)) &&
- (data->progress.size_ul > CURL_OFF_T_C(100)) ) {
+ if((data->progress.flags & PGRS_UL_SIZE_KNOWN) &&
+ (data->progress.ulspeed > CURL_OFF_T_C(0))) {
ulestimate = data->progress.size_ul / data->progress.ulspeed;
- ulpercen = data->progress.uploaded /
- (data->progress.size_ul/CURL_OFF_T_C(100));
+
+ if(data->progress.size_ul > CURL_OFF_T_C(10000) )
+ ulpercen = data->progress.uploaded /
+ (data->progress.size_ul/CURL_OFF_T_C(100));
+ else
+ ulpercen = (data->progress.uploaded*100) /
+ data->progress.size_ul;
}
/* ... and the download */
if((data->progress.flags & PGRS_DL_SIZE_KNOWN) &&
- (data->progress.dlspeed > CURL_OFF_T_C(0)) &&
- (data->progress.size_dl > CURL_OFF_T_C(100))) {
+ (data->progress.dlspeed > CURL_OFF_T_C(0)) ) {
dlestimate = data->progress.size_dl / data->progress.dlspeed;
- dlpercen = data->progress.downloaded /
- (data->progress.size_dl/CURL_OFF_T_C(100));
+
+ if(data->progress.size_dl > CURL_OFF_T_C(10000))
+ dlpercen = data->progress.downloaded /
+ (data->progress.size_dl/CURL_OFF_T_C(100));
+ else
+ dlpercen = (data->progress.downloaded*100) /
+ data->progress.size_dl;
}
/* Now figure out which of them is slower and use that one for the
@@ -407,9 +415,11 @@ int Curl_pgrsUpdate(struct connectdata *conn)
total_transfer = data->progress.downloaded + data->progress.uploaded;
/* Get the percentage of data transfered so far */
- if(total_expected_transfer > CURL_OFF_T_C(100))
+ if(total_expected_transfer > CURL_OFF_T_C(10000))
total_percen = total_transfer /
- (total_expected_transfer/CURL_OFF_T_C(100));
+ (total_expected_transfer/CURL_OFF_T_C(100));
+ else if(total_expected_transfer > 0)
+ total_percen = (total_transfer*100) / total_expected_transfer;
fprintf(data->set.err,
"\r"