From: Leonid Petrov Date: Tue, 20 Jul 2010 11:09:43 +0000 (+0200) Subject: Fix symlinks resume via FTP. X-Git-Tag: v1.13~121 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=29c0b3cc07a54313a6485eb1d81162326ce2d4ca Fix symlinks resume via FTP. --- diff --git a/src/ChangeLog b/src/ChangeLog index fbfc34bd..30b6c9cc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-07-20 Leonid Petrov + + * 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 * http.c (gethttp): If -N is used, don't exit immediately if the content diff --git a/src/ftp.c b/src/ftp.c index 70137bed..42b0671e 100644 --- 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;