]> sjero.net Git - wget/commitdiff
[svn] Minor fix for the new progress bar.
authorhniksic <devnull@localhost>
Fri, 23 Nov 2001 05:09:39 +0000 (21:09 -0800)
committerhniksic <devnull@localhost>
Fri, 23 Nov 2001 05:09:39 +0000 (21:09 -0800)
src/ChangeLog
src/progress.c

index f1291b24985febbf22775dd362afd6097816a758..9d6659e86a5799e5638ad713cefb48a156766734 100644 (file)
@@ -1,3 +1,8 @@
+2001-11-23  Hrvoje Niksic  <hniksic@arsdigita.com>
+
+       * progress.c (bar_update): If the downloaded amount becomes larger
+       than the expected amount, adjust the expected amount accordingly.
+
 2001-11-23  Hrvoje Niksic  <hniksic@arsdigita.com>
 
        * utils.c (determine_screen_width): New function.
index fc7ced31a881b5d7fbc605bbbd265e4f6f34b45b..518ec48ee25d0fc342e13538567d7e3c89d59c5a 100644 (file)
@@ -397,6 +397,13 @@ bar_update (void *progress, long howmuch)
   long dltime = wtimer_elapsed (bp->timer);
 
   bp->count += howmuch;
+  if (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
+       create_image() that depends on total size being smaller or
+       equal to the expected size doesn't abort.  */
+    bp->total_length = bp->count + bp->initial_length;
 
   if (screen_width != bp->width)
     {