From b88223f99d2ffeef9d87ea35e0eed7806254a81e Mon Sep 17 00:00:00 2001
From: hniksic <devnull@localhost>
Date: Sat, 24 Nov 2001 10:05:57 -0800
Subject: [PATCH] [svn] Don't modify bp->total_length if it equals zero.

---
 src/ChangeLog  | 5 +++++
 src/progress.c | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 04ef9908..2c58a116 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2001-11-24  Hrvoje Niksic  <hniksic@arsdigita.com>
+
+	* progress.c (bar_update): Don't modify bp->total_length if it is
+	zero.
+
 2001-11-24  Hrvoje Niksic  <hniksic@arsdigita.com>
 
 	* retr.c (retrieve_url): When the redirection URL doesn't parse,
diff --git a/src/progress.c b/src/progress.c
index a69433f9..9c981bd8 100644
--- a/src/progress.c
+++ b/src/progress.c
@@ -411,7 +411,8 @@ bar_update (void *progress, long howmuch)
   long dltime = wtimer_elapsed (bp->timer);
 
   bp->count += howmuch;
-  if (bp->count + bp->initial_length > bp->total_length)
+  if (bp->total_length > 0
+      && bp->count + bp->initial_length > bp->total_length)
     /* We could be downloading more than total_length, e.g. when the
        server sends an incorrect Content-Length header.  In that case,
        adjust bp->total_length to the new reality, so that the code in