]> sjero.net Git - wget/commitdiff
Fixed #22251: Terminated download gets new filename.
authorMicah Cowan <micah@cowan.name>
Sun, 10 Feb 2008 22:39:41 +0000 (14:39 -0800)
committerMicah Cowan <micah@cowan.name>
Sun, 10 Feb 2008 22:39:41 +0000 (14:39 -0800)
src/ChangeLog
src/http.c
src/progress.c

index c5b2c20049626857f22e5d87e75a6dd7527af8ed..673bd9c7aa4eb8a7a2a79788d0e6317f870aa5f2 100644 (file)
@@ -1,3 +1,15 @@
+2008-02-10  Micah Cowan  <micah@cowan.name>
+
+       * http.c: Added existence_checked member to the http_stat
+       struct.
+       (gethttp): Mark hs->existence_checked when we've checked whether
+       a file-to-download exists; so we don't check it again if the
+       connection gets lost (and potentially pick a new "unique" name).
+       This fixes bug 22251.
+       * progress.c (create_image): Add space for an extra column in
+       the "eta" portion of the progress bar image; to deal with
+       too-long Czech translation.
+
 2008-02-07  Micah Cowan  <micah@cowan.name>
 
        * progress.c (create_image): Remove assertion on exceeding
 2008-02-07  Micah Cowan  <micah@cowan.name>
 
        * progress.c (create_image): Remove assertion on exceeding
index 02645724b136bc0f5554b9e98489e38aacfbdc68..3a0481a2be3d3a8ca5103c909cb356b449cb1e8e 100644 (file)
@@ -1291,6 +1291,10 @@ struct http_stat
   double dltime;                /* time it took to download the data */
   const char *referer;          /* value of the referer header. */
   char *local_file;             /* local file name. */
   double dltime;                /* time it took to download the data */
   const char *referer;          /* value of the referer header. */
   char *local_file;             /* local file name. */
+  bool existence_checked;       /* true if we already checked for a file's
+                                   existence after having begun to download
+                                   (needed in gethttp for when connection is
+                                   interrupted/restarted. */
   bool timestamp_checked;       /* true if pre-download time-stamping checks 
                                  * have already been performed */
   char *orig_file_name;         /* name of file to compare for time-stamping
   bool timestamp_checked;       /* true if pre-download time-stamping checks 
                                  * have already been performed */
   char *orig_file_name;         /* name of file to compare for time-stamping
@@ -1807,7 +1811,7 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
     }
   
   /* TODO: perform this check only once. */
     }
   
   /* TODO: perform this check only once. */
-  if (file_exists_p (hs->local_file))
+  if (!hs->existence_checked && file_exists_p (hs->local_file))
     {
       if (opt.noclobber)
         {
     {
       if (opt.noclobber)
         {
@@ -1833,6 +1837,7 @@ File `%s' already there; not retrieving.\n\n"), hs->local_file);
           hs->local_file = unique;
         }
     }
           hs->local_file = unique;
         }
     }
+  hs->existence_checked = true;
 
   /* Support timestamping */
   /* TODO: move this code out of gethttp. */
 
   /* Support timestamping */
   /* TODO: move this code out of gethttp. */
index bbbad179975fcbd8b79c7b8b1ba31d197b7f61db..9ea74b030386ba9b20b5e5bbaa5b5c9d726ad96e 100644 (file)
@@ -874,12 +874,12 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
      "[]"              - progress bar decorations - 2 chars
      " nnn,nnn,nnn"    - downloaded bytes         - 12 chars or very rarely more
      " 12.5K/s"        - download rate             - 8 chars
      "[]"              - progress bar decorations - 2 chars
      " nnn,nnn,nnn"    - downloaded bytes         - 12 chars or very rarely more
      " 12.5K/s"        - download rate             - 8 chars
-     "  eta 36m 51s"   - ETA                      - 13 chars
+     "  eta 36m 51s"   - ETA                      - 14 chars
 
      "=====>..."       - progress bar             - the rest
   */
   int dlbytes_size = 1 + MAX (size_grouped_len, 11);
 
      "=====>..."       - progress bar             - the rest
   */
   int dlbytes_size = 1 + MAX (size_grouped_len, 11);
-  int progress_size = bp->width - (4 + 2 + dlbytes_size + 8 + 13);
+  int progress_size = bp->width - (4 + 2 + dlbytes_size + 8 + 14);
 
   if (progress_size < 5)
     progress_size = 0;
 
   if (progress_size < 5)
     progress_size = 0;