cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE : How to catch SFTP commands result ?

From: muller_b <quentin.muller_at_epitech.eu>
Date: Fri, 9 Mar 2012 15:17:21 +0000

As I expected to be confirmed, SFTP is indeed a binary protocol, thanks to your answer! I tried with using the CURLOPT_HEADERFUNCTION callback function, and this is working perfectly. My problem is solved, so, good job and keep up the good work!

Regards,

--
Quentin Muller
________________________________________
De : curl-library-bounces_at_cool.haxx.se [curl-library-bounces_at_cool.haxx.se] de la part de Dan Fandrich [dan_at_coneharvesters.com]
Date d'envoi : jeudi 8 mars 2012 23:58
À : curl-library_at_cool.haxx.se
Objet : Re: How to catch SFTP commands result ?
On Thu, Mar 08, 2012 at 10:20:59PM +0000, muller_b wrote:
> I have a problem using libcurl as a SFTP client; I am pointing a path via the
> url and I would want to do operations on files.
> I am using curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &func) which allows me
> to get the file listing of the directory as text in my func method.
> This works, but when I send a command like curl_easy_setopt(curl,
> CURLOPT_QUOTE, "pwd") for instance, then I dont know where the data stream is
> redirected and it does not seem to be towards my func method.
> The CURLOPT_VERBOSE mode might be the source of what I can read in the shell
> (something like ">PWD \n< /printing/working/dir") but, in that case I would
> like to get the "/printing/working/dir" servers answer.
SFTP is a binary protocol, and libcurl doesn't provide access to the raw
commands and responses sent. Instead, it emulates FTP to some degree and
converts quote commands and responses into FTP-like text responses. You
should be able to access them in the same was as normal FTP headers,
that is, using the CURLOPT_HEADERFUNCTION callback function.
>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-03-09