curl-library
Re: ftp_perform problem
Date: Fri, 07 Mar 2003 10:20:11 -0800
Hi Daniel,
I'm sorry, I sometime focus on the details and forget to provide
significant information.
The code that didn't work was:
// setup connection url
curl_easy_setopt(theCurlHandle, CURLOPT_URL, "user:password_at_myftpserver/");
//^^^^
// note that you don't really get dropped into the FTP root directory
// here; instead you get dropped into an initial directory related to
// your login name
// setup postquote commands for connect operation
curl_slist *someFTPCommands = NULL;
someFTPCommands = curl_slist_append(someFTPCommands, "CWD ../otherdir/"");
someFTPCommands = curl_slist_append(someFTPCommands, "PWD");
// connect and execute postquote commands
CURLcode aCURLcode = curl_easy_perform(theCurlHandle);
// set a url for a custom request LIST command
curl_easy_setopt(theCurlHandle, CURLOPT_URL,
"ftp://myftpserver/home/mygroup/otherdir/");
// ^^^^
// this url is significant for my problem
// setup the custom request for a LIST command
curl_easy_setopt(theCurlHandle, CURLOPT_CUSTOMREQUEST, "LIST
/home/mygroup/otherdir/");
// execute the LIST command
CURLcode aCURLcode = curl_easy_perform(theCurlHandle);
------------------
The code that worked was similar, except that I changed the url for the
custom request list command to this:
curl_easy_setopt(theCurlHandle, CURLOPT_URL, "ftp://myftpserver/");
------------------
Using the first code snippet caused the custom request LIST command to
fail because libcurl was interpreting "/home/mygroup/otherdir/" as a
relative url, "home/mygroup/otherdir," relative to the inital login
directory.
This problem appears to be related to using an FTP server that is setup
so that connecting to the ftp root doesn't really drop you into the ftp
root.
Dave Halbakken
daniel_at_haxx.se wrote:
>
> Sorry for being dense, but what did you do that didn't work and what made it
> work and then what is your question again?
>
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger
for complex code. Debugging C/C++ programs can leave you feeling lost and
disoriented. TotalView can help you find your way. Available on major UNIX
and Linux platforms. Try it free. www.etnus.com
Received on 2003-03-07