New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FTP with CURLOPT_NOBODY different behavior when performing on non-existing files #5953
Comments
I think if you also do: curl_easy_setopt(hnd, CURLOPT_FILETIME, 1L); ... it might actually do what you expected it. As a work-around. |
and returns CURLE_FTP_COULDNT_RETR_FILE. This is primarily interesting for cases where CURLOPT_NOBODY is set as otherwise curl would not return an error for this case. This is how libcurl already acts on a 550 as a MDTM response (when CURLOPT_FILETIME is set). If CURLOPT_NOBODY is not set, the error will happen subsequently anyway since the RETR command will also fail with it. Reported-by: Tomas Berger Fixes #5953
setting With verbose without setting After compiling #5957 It does indeed now actually return |
Hm. I think I was too quick and you're right. It should rather use |
This is primarily interesting for cases where CURLOPT_NOBODY is set as otherwise curl would not return an error for this case. MDTM getting 550 now also returns this error in order to unify return codes for missing files across protocols and specific FTP commands. libcurl already returns error on a 550 as a MDTM response (when CURLOPT_FILETIME is set). If CURLOPT_NOBODY is not set, the error will happen subsequently anyway since the RETR command will also fail with it. Add test 1913 and 1914 to verify. Updated several tests accordingly. Reported-by: Tomas Berger Fixes #5953
I did this
I tried to make a function in libcurl that checks if a file exist on server:
However, because I use the
CURLOPT_NOBODY
option, perform returnsCURLE_OK
(If I don't use the no body option it returnCURLE_REMOTE_FILE_NOT_FOUND
) . However, on SFTP calls in reruns as I expect:I expected the following
I expect them both to return
CURLE_REMOTE_FILE_NOT_FOUND
or at least have the same behaviourcurl/libcurl version
7.72.0
operating system
Linux togtja-ubuntu 5.4.0-47-generic #51~18.04.1-Ubuntu SMP Sat Sep 5 14:35:50 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: