Giter Club home page Giter Club logo

Comments (3)

jeroen avatar jeroen commented on June 14, 2024

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 --ftp-create-dirs in the command line.

For example this will create a new dir /test3

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)

from curl.

pepijn-devries avatar pepijn-devries commented on June 14, 2024

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 curl or the underpinning libcurl fail on my customrequest?

from curl.

pepijn-devries avatar pepijn-devries commented on June 14, 2024

P.S., I'm asking because it would be nice to make use of other FTP features as well. For instance, the custom request FEAT does print the server features in the verbose mode, but still returns with an error:

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

from curl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.