curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

FTP with CURLOPT_NOBODY different behavior when performing onnon-existing files #5953

From: Lukas Friembichler via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 15 Dec 2020 16:00:10 +0100

Hi all,

I have run into a problem when updating to the most recent CURL release
(7_74, I was on 7_70 before) - it seems I can no longer rename
directories on my ftp server, I suspect due to issue #5953

Basically, what I'm doing is to upload a few files into a temporary
folder on my FTP, then, once everything has been successfully uploaded,
rename the folder using a CURLOPT_QUOTE call. This used to work fine but
now I get a 550 error, aborting the execution of my command queue.

My quote commands are
[0] = "RNFR upload_81813aad-24c4-47b2-af23-4fc75ed60db5"
[1] = "RNTO 81813aad-24c4-47b2-af23-4fc75ed60db5"

(ie basically remove the 'upload_' string from the directory name), and
verbose CURL logs out the following:

* STATE: CONNECT => DO handle 0x24313c0; line 1708 (connection #0)
* DO phase starts
> CWD /
* FTP 0x244d070 (line 875) state change from STOP to CWD
* ftp_perform ends with SECONDARY: 0
* STATE: DO => DOING handle 0x24313c0; line 1927 (connection #0)
< 250 Directory successfully changed.
> SIZE upload_81813aad-24c4-47b2-af23-4fc75ed60db5
* FTP 0x244d070 (line 1412) state change from CWD to SIZE
< 550 Could not get file size.
* The file does not exist
* DO phase failed
* multi_done
* Remembering we are in dir ""

Below I quote the output when using 7_70:

* STATE: CONNECT => DO handle 0x233b7e0; line 1672 (connection #0)
* DO phase starts
> CWD /
* FTP 0x2347220 (line 880) state change from STOP to CWD
* ftp_perform ends with SECONDARY: 0
* STATE: DO => DOING handle 0x233b7e0; line 1875 (connection #0)
< 250 Directory successfully changed.
> SIZE upload_81813aad-24c4-47b2-af23-4fc75ed60db5
* FTP 0x2347220 (line 1413) state change from CWD to SIZE
< 550 Could not get file size.
> REST 0
* FTP 0x2347220 (line 1393) state change from SIZE to REST
< 350 Restart position accepted (0).
Accept-ranges: bytes
* FTP 0x2347220 (line 1347) state change from REST to RETR_PREQUOTE
* FTP 0x2347220 (line 1721) state change from RETR_PREQUOTE to STOP
* DO phase is complete2
* STATE: DOING => DO_DONE handle 0x233b7e0; line 1959 (connection #0)
* STATE: DO_DONE => DONE handle 0x233b7e0; line 2017 (connection #0)
* multi_done
* Remembering we are in dir ""
> RNFR upload_81813aad-24c4-47b2-af23-4fc75ed60db5
< 350 Ready for RNTO.
> RNTO 81813aad-24c4-47b2-af23-4fc75ed60db5
< 250 Rename successful.

I confess that I'm not a FTP guru by any means, so is my approach simply
invalid and should I do something else? Or is this indeed an unwanted
side effect of treating 550 as an error now?

I would be grateful for any pointers, I can of course provide more
information if needed!

Thank you,
Lukas
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html
Received on 2020-12-15