From 60aa975610b2e72a6625888bb530a032963b2e9c Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 17 Apr 2001 13:21:13 +0000 Subject: [PATCH] Frederic Lepied's ftp download resume fix --- include/curl/curl.h | 3 ++- lib/ftp.c | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/curl/curl.h b/include/curl/curl.h index 5dbd7b4..95c6f99 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -146,7 +146,8 @@ typedef enum { CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */ CURLE_UNKNOWN_TELNET_OPTION, /* 48 - User specified an unknown option */ CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */ - + CURLE_ALREADY_COMPLETE, /* 50 - file to dowload is already complete */ + CURL_LAST /* never use! */ } CURLcode; diff --git a/lib/ftp.c b/lib/ftp.c index 701b497..8fda9f4 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -1504,7 +1504,7 @@ again:; data->resume_from = foundsize - downloadsize; } else { - if(foundsize <= data->resume_from) { + if(foundsize < data->resume_from) { failf(data, "Offset (%d) was beyond file size (%d)", data->resume_from, foundsize); return CURLE_FTP_BAD_DOWNLOAD_RESUME; @@ -1514,6 +1514,11 @@ again:; } } + if (downloadsize == 0) { + failf(data, "File already complete"); + return CURLE_ALREADY_COMPLETE; + } + /* Set resume file transfer offset */ infof(data, "Instructs server to resume from offset %d\n", data->resume_from); -- 2.7.4