curl / Mailing Lists / curl-library / Single Mail


Re: Ftp client commands

From: Andrew <>
Date: Mon, 30 Apr 2018 17:23:03 -0700

On 4/30/2018 7:09 AM, Alexander Eisenhuth wrote:
> Hello Everybody,
> I'm writing a ftp client in c++ with the easy interface, that has beside
> the upload/download functionality others like:
> mkdir(dirName)
> rmdir(dieName)
> rm(fileName)
> cd(dirName)
> I used for that the CURLOPT_CUSTOMREQUEST option in the way
> curl_easy_setopt(mCurl, CURLOPT_CUSTOMREQUEST, "rmdir /anydir"))
> Basicly it works, but in the debug traces I can see that libcurl is
> expecting a tranfer as it is sending the PORT command

CURLOPT_CUSTOMREQUEST is used to replace the literal command string
without affecting libcurl's behavior otherwise. So libcurl is acting
like it should do a download even though it's sending "rmdir /anydir" as
the FTP command.

To send custom FTP command sequences use CURLOPT_QUOTE,
CURLOPT_PREQUOTE, or CURLOPT_POSTQUOTE; you may also want to set
CURLOPT_NOBODY to indicate that libcurl shouldn't expect a download.

Andrew Lambert
Received on 2018-05-01