]> sjero.net Git - wget/commitdiff
Fix symlinks resume via FTP.
authorLeonid Petrov <nouser@lpetrov.net>
Tue, 20 Jul 2010 11:09:43 +0000 (13:09 +0200)
committerGiuseppe Scrivano <gscrivano@gnu.org>
Tue, 20 Jul 2010 11:09:43 +0000 (13:09 +0200)
src/ChangeLog
src/ftp.c

index fbfc34bd35fa54bd36f3f8d6741a9df13b6a59b2..30b6c9cc7e908f32e92fb797f8708b0a94874589 100644 (file)
@@ -1,3 +1,9 @@
+2010-07-20  Leonid Petrov <nouser@lpetrov.net>
+
+       * ftp.c (getftp): Don't attempt to retrieve the file if it is already
+       completely.
+       (ftp_loop_internal): Force the length to be zero for symlinks.
+
 2010-07-18  Giuseppe Scrivano  <gscrivano@gnu.org>
 
        * http.c (gethttp): If -N is used, don't exit immediately if the content
index 70137bedbc889d229345adee2a97d3c29be344a6..42b0671e1c00510a5fbf426c46706ccffe0ceb73 100644 (file)
--- a/src/ftp.c
+++ b/src/ftp.c
@@ -767,6 +767,16 @@ Error in server response, closing control connection.\n"));
                      number_to_static_string (expected_bytes));
     }
 
+  if (cmd & DO_RETR && restval > 0 && restval == expected_bytes)
+    {
+      /* Server confirms that file has length restval. We should stop now.
+         Some servers (f.e. NcFTPd) return error when receive REST 0 */
+      logputs (LOG_VERBOSE, _("File has already been retrieved.\n"));
+      fd_close (csock);
+      con->csock = -1;
+      return RETRFINISHED;
+    }
+
   /* If anything is to be retrieved, PORT (or PASV) must be sent.  */
   if (cmd & (DO_LIST | DO_RETR))
     {
@@ -1459,7 +1469,7 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con, char **local_fi
           xfree (hurl);
         }
       /* Send getftp the proper length, if fileinfo was provided.  */
-      if (f)
+      if (f && f->type != FT_SYMLINK)
         len = f->size;
       else
         len = 0;