cURL / Mailing Lists / curl-library / Single Mail


Re: libcurl: SFTP return quote command failure (21)

From: Nick Zitzmann <>
Date: Tue, 26 Feb 2013 00:05:51 -0700

On Feb 25, 2013, at 9:35 PM, chu ngoc hung <> wrote:

> I use CURLOPT_QUOTE command to list content of a directory. Here is my code:
> // set url
> //...
> headerlist = curl_slist_append(headerlist, buf_0);
> const char *buf_1 = "CWD /hungcn";

That is not a valid SFTP quote command. Go check the man page for curl_easy_setopt for the list of valid commands. I wrote this code a long time ago, and when I did it used the same command names as OpenSSH's sftp tool, but that might have changed. Also, note that all of the commands are lower-case.

> curl_easy_setopt(_curl, CURLOPT_CUSTOMREQUEST, "LIST");

The CURLOPT_CUSTOMREQUEST command is for sending custom HTTP request commands, like WebDAV's OPTIONS or PROPFIND commands. It has no effect with SFTP URLs.

Nick Zitzmann

List admin:
Received on 2013-02-26