On Mon, Oct 20, 2014 at 7:39 AM, Ray Satiro <[email protected]> wrote:
> On 10/19/2014 4:43 AM, Daniel Karunairatnam wrote: > > Hi guys, > > I'm trying to use libcurl in Visual Studio Express C++ 2010 (Windows 8) > to upload and append files to an sftp server. > I am using the following code (taken from > http://curl.haxx.se/libcurl/c/sftpget.html, with a few changes). > > ... > > curl_easy_setopt(curl, CURLOPT_URL, > "10.1.1.4"); > curl_easy_setopt(curl, CURLOPT_PORT, 22); > > > That's just like writing http://10.1.1.4:22 it's going override the port > as 22 but it's still HTTP. You need the sftp:// just like in the example. > If sftp and your port is 22 you don't need to specify it either in the URL > or via CURLOPT_PORT. > > #ifndef DISABLE_SSH_AGENT > /* We activate ssh agent. For this to work you need > to have ssh-agent running (type set | grep SSH_AGENT to check) or > pageant on Windows (there is an icon in systray if so) */ > curl_easy_setopt(curl, CURLOPT_SSH_AUTH_TYPES, CURLSSH_AUTH_AGENT); > #endif > > > Do you have an ssh agent? The example undefs DISABLE_SSH_AGENT so even if > you define it it's undefined. If you don't have an SSH agent change line 29 > to #define DISABLE_SSH_AGENT. > I had pageant running. > > I have similar experiences using both the private server I need to > connect to, and a server I set up using freeSSHd. > If I use sftp:// before the ip address/hostname, i get a stack error. it > says the stack around variable hash is corrupt. > > > freeSSHd may not set the home directory in a way that can't be understood > so click the SFTP tab and change the home directory to something other than > $HOME like your desktop. Also if you are running freeSSHd as a service try > disabling the service and running it directly from the GUI. > > I don't know why you're seeing stack errors but I tried your code and > connected to a freeSSHd 1.2.6 server and it seemed to work ok to download a > file and read the directory. However on this computer I only have an older > version of libcurl to test with that wasn't compiled using visual studio. > It can be found on the downloads page (7.34.0, libcurl, SSL, Günter Knauf). > curl 7.34.0 (i386-pc-win32) libcurl/7.34.0 OpenSSL/1.0.0l zlib/1.2.8 > libidn/1.18 > libssh2/1.4.3 librtmp/2.3 > Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s > rtmp > rtsp scp sftp smtp smtps telnet tftp > Features: AsynchDNS GSS-Negotiate IDN Largefile NTLM SPNEGO SSL SSPI libz > is it the 3.34MB file under win32-generic on this page? http://curl.haxx.se/download.html are you running windows 8? Thanks for the help > > > ------------------------------------------------------------------- > 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
