-
Notifications
You must be signed in to change notification settings - Fork 70
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 directory created successfuly, but curl returns with error #319
Comments
I'm don't think using customrequest is really the way to create dirs. Use the CURLOPT_FTP_CREATE_MISSING_DIRS option, which I think is the same as For example this will create a new dir handle <- curl::new_handle(userpwd = "dlpuser:rNrKYTX9g7z3RgJRmxWuGHbeu", httpauth = 1, ftp_create_missing_dirs = 1L, verbose=T)
curl::curl_fetch_memory("ftp://ftp.dlptest.com/mytest3/", handle = handle) Or if your goal is to upload a file inside a new dir, you can do that in one command like so: curl::curl_upload('test.txt', "ftp://ftp.dlptest.com/mytest/test.txt",
userpwd = "dlpuser:rNrKYTX9g7z3RgJRmxWuGHbeu", httpauth = 1, ftp_create_missing_dirs = 1L) |
Thank you for looking into this and pointing this out. The amount of options can be overwhelming sometimes ;). For creating dirs I will use your suggested approach. Just out of curiousity: why would |
P.S., I'm asking because it would be nice to make use of other FTP features as well. For instance, the custom request h <- curl::handle_setopt(curl::new_handle(), userpwd = "dlpuser:rNrKYTX9g7z3RgJRmxWuGHbeu", httpauth = 1, customrequest = "FEAT", verbose = TRUE)
curl::curl_fetch_memory("ftp://ftp.dlptest.com/", handle = h)
# * Too old connection (143 seconds idle), disconnect it
# * Connection 1 seems to be dead
# * Closing connection 1
# * Trying 44.241.66.173:21...
# * Connected to ftp.dlptest.com (44.241.66.173) port 21 (#2)
# < 220 Welcome to the DLP Test FTP Server
# > USER dlpuser
# < 331 Please specify the password.
# > PASS rNrKYTX9g7z3RgJRmxWuGHbeu
# < 230 Login successful.
# > PWD
# < 257 "/"
# * Entry path is '/'
# * Request has same path as previous transfer
# > EPSV
# * Connect data stream passively
# * ftp_perform ends with SECONDARY: 0
# < 229 Entering Extended Passive Mode (|||1041|).
# * Trying 44.241.66.173:1041...
# * Connecting to 44.241.66.173 (44.241.66.173) port 1041
# * Connected to ftp.dlptest.com (44.241.66.173) port 21 (#2)
# > TYPE A
# < 200 Switching to ASCII mode.
# > FEAT
# < 211-Features:
# < AUTH TLS
# < EPRT
# < EPSV
# < MDTM
# < PASV
# < PBSZ
# < PROT
# < REST STREAM
# < SIZE
# < TVFS
# < UTF8
# < 211 End
# * RETR response: 211
# * Remembering we are in dir ""
# * Connection #2 to host ftp.dlptest.com left intact
# Error in curl::curl_fetch_memory("ftp://ftp.dlptest.com/", handle = h) :
#> Error in curl::curl_fetch_memory("ftp://ftp.dlptest.com/", handle = h): RETR response: 211 Created on 2023-11-06 with reprex v2.0.2 |
Currently, I'm working on some wrappers to facilitate (s)ftp access using the curl package (and httr2). I got most of it working. Creating a directory on an ftp server poses me with the following problem. Using the code below, I was able to create a directory successfully on the server, but
curl
stops with an error mentioning response status 257. However, this status is the server telling that it has succeeded (https://en.wikipedia.org/wiki/List_of_FTP_server_return_codes). Am I doing something wrong, or is this a bug incurl
? See the reprex below using the dlptest ftp test site. Note that you may need to change the dir-name if it already exists on the server.Created on 2023-11-05 with reprex v2.0.2
For completeness sake, my session info:
The text was updated successfully, but these errors were encountered: