summaryrefslogtreecommitdiff
path: root/lib/ftp.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2008-09-30 09:51:58 +0000
committerDaniel Stenberg <daniel@haxx.se>2008-09-30 09:51:58 +0000
commit038542ea3ef5be195ae30b8d655fcec34dfba9e2 (patch)
tree5215c9f15780d70a65d7439a0e52c55e61a9cc11 /lib/ftp.c
parentbeb14ca6d6758985b389f13040d4ef8d5c798a7b (diff)
downloadcurl-038542ea3ef5be195ae30b8d655fcec34dfba9e2.tar.gz
- The libcurl FTP code now returns CURLE_REMOTE_FILE_NOT_FOUND error when SIZE
gets a 550 response back for the cases where a download (or NOBODY) is wanted. It still allows a 550 as response if the SIZE is used as part of an upload process (like if resuming an upload is requested and the file isn't there before the upload). I also modified the FTP test server and a few test cases accordingly to match this modified behavior.
Diffstat (limited to 'lib/ftp.c')
-rw-r--r--lib/ftp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 1ec4091cb..e495a2cef 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -2188,6 +2188,10 @@ static CURLcode ftp_state_size_resp(struct connectdata *conn,
curl_off_t filesize;
char *buf = data->state.buffer;
+ if((instate != FTP_STOR_SIZE) && (ftpcode == 550))
+ /* the file doesn't exist and we're not about to upload */
+ return CURLE_REMOTE_FILE_NOT_FOUND;
+
/* get the size from the ascii string: */
filesize = (ftpcode == 213)?curlx_strtoofft(buf+4, NULL, 0):-1;
@@ -3165,6 +3169,7 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
case CURLE_UPLOAD_FAILED:
case CURLE_REMOTE_ACCESS_DENIED:
case CURLE_FILESIZE_EXCEEDED:
+ case CURLE_REMOTE_FILE_NOT_FOUND:
/* the connection stays alive fine even though this happened */
/* fall-through */
case CURLE_OK: /* doesn't affect the control connection's status */