]> sjero.net Git - wget/commitdiff
[svn] ftp.c (getftp): Applied Piotr Sulecki <Piotr.Sulecki@ios.krakow.pl>'s
authordan <devnull@localhost>
Fri, 20 Oct 2000 07:28:57 +0000 (00:28 -0700)
committerdan <devnull@localhost>
Fri, 20 Oct 2000 07:28:57 +0000 (00:28 -0700)
        patch to work around FTP servers that incorrectly respond to the
           "REST" command with the remaining size rather than the total
           file size.

src/ChangeLog
src/ftp.c

index 8bcf7308531a14361d69d8a7097aefa6e3c9a40c..7d74f276afcaeec8aab47ad853ecee3bb2905bb7 100644 (file)
@@ -1,6 +1,9 @@
 2000-10-19  Dan Harkless  <dan-wget@dilvish.speed.net>
 
        * ftp.c (ftp_loop_internal): downloaded_file() enumerators changed.
+       (getftp): Applied Piotr Sulecki <Piotr.Sulecki@ios.krakow.pl>'s
+       patch to work around FTP servers that incorrectly respond to the
+       "REST" command with the remaining size rather than the total file size.
                
        * http.c (gethttp): Improved a comment and added code to tack on
        ".html" to text/html files without that extension when -E specified.
index bfb4e0284d6f2a4d9f605bb1369bd47ac6c71f65..6d549a3e1e30932a6a45839780c1db37a4bae1eb 100644 (file)
--- a/src/ftp.c
+++ b/src/ftp.c
@@ -686,6 +686,15 @@ Error in server response, closing control connection.\n"));
     }
   else
     fp = opt.dfp;
+  
+  /* Some FTP servers return the total length of file after REST command,
+     others just return the remaining size. */  
+  if (*len && restval && expected_bytes
+      && (expected_bytes == *len - restval))
+  {
+    DEBUGP (("Lying FTP server found, adjusting.\n"));
+    expected_bytes = *len;
+  }
 
   if (*len)
     {