]> sjero.net Git - wget/blobdiff - src/retr.c
[svn] Fixed a timeout problem in src/retr.c:fd_read_body when using http_proxy.
[wget] / src / retr.c
index 3415ff02d5feb3c3accf2996fc64c25fd389cdef..605db8316e31bee892df334139c42cb8936f4306 100644 (file)
@@ -283,6 +283,13 @@ fd_read_body (int fd, FILE *out, long toread, long startpos,
        }
       ret = fd_read (fd, dlbuf, rdsize, tmout);
 
+      /* when retrieving from http-proxy wget sometimes does not trust the 
+       * file length reported by server.
+       * this check is to tell wget not to stubbornly try to read again and 
+       * again until another errno code was received. */
+      if ( ret == -1 && errno == ETIMEDOUT && sum_read == toread && toread > 0 )
+       break;
+
       if (ret == 0 || (ret < 0 && errno != ETIMEDOUT))
        break;                  /* read error */
       else if (ret < 0)
@@ -311,7 +318,7 @@ fd_read_body (int fd, FILE *out, long toread, long startpos,
       if (progress)
        progress_update (progress, ret, wtimer_read (timer));
 #ifdef WINDOWS
-      if (toread > 0)
+      if (toread > 0 && !opt.quiet)
        ws_percenttitle (100.0 *
                         (startpos + sum_read) / (startpos + toread));
 #endif
@@ -485,7 +492,7 @@ char *
 retr_rate (long bytes, double msecs, int pad)
 {
   static char res[20];
-  static char *rate_names[] = {"B/s", "KB/s", "MB/s", "GB/s" };
+  static const char *rate_names[] = {"B/s", "KB/s", "MB/s", "GB/s" };
   int units = 0;
 
   double dlrate = calc_rate (bytes, msecs, &units);