diff --git a/CHANGES b/CHANGES index c202ed2e20eb4b0284a2c4cfa32c9a2a7575d545..b5ba5c56303fd9a4ea717422d00d46cb94f9178a 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,14 @@ Changelog +Daniel Stenberg (30 Sep 2008) +- 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. + Daniel Stenberg (29 Sep 2008) - Daniel Egger provided a patch that allows you to disable proxy support in libcurl to somewhat reduce the size of the binary. Run configure diff --git a/RELEASE-NOTES b/RELEASE-NOTES index bbf950931de19d75b22045dac110bd96494e11f9..3336c5b72af82d4aa33ebce380ae24c04b0c21e7 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -31,6 +31,7 @@ This release includes the following bugfixes: o HTTP Digest with a blank realm did wrong o CURLINFO_REDIRECT_URL didn't work with the multi interface o CURLOPT_RANGE now works for SFTP downloads + o FTP SIZE response 550 now causes CURLE_REMOTE_FILE_NOT_FOUND This release includes the following known bugs: diff --git a/lib/ftp.c b/lib/ftp.c index 1ec4091cb17b186f56d85a16ab41be4d6709d484..e495a2cef43b96d42e0f063b17ce2a9e4fdb3d53 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 */ diff --git a/tests/data/test118 b/tests/data/test118 index 6cd086ca239b839c9a7d9ee17fad96ea655f03d6..b2b10c2355e54ca1c7f2b3525e097c48cf673669 100644 --- a/tests/data/test118 +++ b/tests/data/test118 @@ -9,6 +9,9 @@ FAILURE # Server-side + +1 + REPLY RETR 314 bluah you f00l! REPLY EPSV 314 bluah you f00l! diff --git a/tests/data/test533 b/tests/data/test533 index f4446cbe0058db0c0ec334279f8d7e1b72f602a9..a7a57b9a7346a20e5153ff43ff3a251fb71f798c 100644 --- a/tests/data/test533 +++ b/tests/data/test533 @@ -45,10 +45,8 @@ CWD path EPSV TYPE I SIZE 533 -RETR 533 EPSV SIZE 533 -RETR 533 QUIT diff --git a/tests/data/test534 b/tests/data/test534 index 52bb1e2604f8703e398ce3f5d409cbd32196d9fa..1f02df5519844b481f8597723cd0b3fbd72938c8 100644 --- a/tests/data/test534 +++ b/tests/data/test534 @@ -45,7 +45,6 @@ CWD path EPSV TYPE I SIZE 534 -RETR 534 QUIT diff --git a/tests/data/test546 b/tests/data/test546 index 1dd1cd41e44bef1df1b476cd489f026cc818fd15..415848792c22f45c9257b9272d13daaf070e1300 100644 --- a/tests/data/test546 +++ b/tests/data/test546 @@ -19,8 +19,6 @@ works -REPLY RETR 550 the file doesn't exist -COUNT RETR 1 REPLY SIZE 550 Can't check for file existence COUNT SIZE 1 @@ -52,7 +50,6 @@ CWD path EPSV TYPE I SIZE 546 -RETR 546 EPSV SIZE 546 RETR 546 diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index 3841e1f327a2876b2d528bafb98aa5f1ffda3b49..52092337d5de67f9b57e542ce3479089c27f669a 100644 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -389,12 +389,14 @@ sub SIZE_command { my $size = $data[0]; - if($size) { + if($size ne "") { + # we check for "" to be able to explictly set the size to 0 and yet have + # that send a 213 if($size > -1) { sendcontrol "213 $size\r\n"; } else { - sendcontrol "550 $testno: No such file or directory.\r\n"; + sendcontrol "350 $testno: SIZE is not supported.\r\n"; } } else { @@ -407,7 +409,7 @@ sub SIZE_command { sendcontrol "213 $size\r\n"; } else { - sendcontrol "550 $testno: No such file or directory.\r\n"; + sendcontrol "350 $testno: SIZE is not supported.\r\n"; } } return 0;