]> sjero.net Git - wget/blobdiff - src/retr.c
[svn] Move extern declarations to .h files.
[wget] / src / retr.c
index 30b81a881a7e489f3428ef37b3f45d9e62d62418..450619360b639bdac49a4353a7c8a52ee32e01e0 100644 (file)
@@ -45,6 +45,7 @@ so, delete this exception statement from your version.  */
 #include "url.h"
 #include "recur.h"
 #include "ftp.h"
+#include "http.h"
 #include "host.h"
 #include "connect.h"
 #include "hash.h"
@@ -52,7 +53,10 @@ so, delete this exception statement from your version.  */
 #include "ptimer.h"
 
 /* Total size of downloaded files.  Used to enforce quota.  */
-LARGE_INT total_downloaded_bytes;
+SUM_SIZE_INT total_downloaded_bytes;
+
+/* Total download time in milliseconds. */
+double total_download_time;
 
 /* If non-NULL, the stream to which output should be written.  This
    stream is initialized when `-O' is used.  */
@@ -495,18 +499,18 @@ fd_read_line (int fd)
   return fd_read_hunk (fd, line_terminator, 128, FD_READ_LINE_MAX);
 }
 \f
-/* Return a printed representation of the download rate, as
-   appropriate for the speed.  If PAD is true, strings will be padded
-   to the width of 7 characters (xxxx.xx).  */
-char *
-retr_rate (wgint bytes, double msecs, bool pad)
+/* Return a printed representation of the download rate, along with
+   the units appropriate for the download speed.  */
+
+const char *
+retr_rate (wgint bytes, double msecs)
 {
   static char res[20];
   static const char *rate_names[] = {"B/s", "KB/s", "MB/s", "GB/s" };
   int units = 0;
 
   double dlrate = calc_rate (bytes, msecs, &units);
-  sprintf (res, pad ? "%7.2f %s" : "%.2f %s", dlrate, rate_names[units]);
+  sprintf (res, "%.2f %s", dlrate, rate_names[units]);
 
   return res;
 }
@@ -660,14 +664,16 @@ retrieve_url (const char *origurl, char **file, char **newloc,
     }
   else if (u->scheme == SCHEME_FTP)
     {
-      /* If this is a redirection, we must not allow recursive FTP
-        retrieval, so we save recursion to oldrec, and restore it
-        later.  */
-      bool oldrec = opt.recursive;
+      /* If this is a redirection, temporarily turn off opt.ftp_glob
+        and opt.recursive, both being undesirable when following
+        redirects.  */
+      bool oldrec = opt.recursive, oldglob = opt.ftp_glob;
       if (redirection_count)
-       opt.recursive = false;
+       opt.recursive = opt.ftp_glob = false;
+
       result = ftp_loop (u, dt, proxy_url);
       opt.recursive = oldrec;
+      opt.ftp_glob = oldglob;
 
       /* There is a possibility of having HTTP being redirected to
         FTP.  In these cases we must decide whether the text is HTML