curl-library
Re: Asking about compiling libcurl with libssh2 in Windows VC98
Date: Thu, 27 Nov 2008 15:59:07 +0700
>
> Are you building libcurl yourself or using someone else's binary?
> Whether libcurl supports sftp or not is determined by the options in
> effect at the time that libcurl itself was built, not at the point where
> you use it in your code. Enabling those defines in your code after the
> fact will not (and can not) change anything. It sounds like you are
> using a pre-built libcurl binary that was did not have sftp support
> enabled, in which case you simply need to build it yourself with the
> desired configuration.
I'm using zlib, openssl and libssh2 binary from internet to build libcurl
myself , but nothing came out of it. I didn't know exactly how to build
libcurl with sftp supports :(
Yesterday one of my friends compiled libcurl with libssh2 successfully (by
adding new options to CFLAGS, LINKLIB and X_OBJS in Makefile.vc6). And now
the libcurl, which i'm using, supports sftp protocol. Everything's ok if we
use only password authentication. But when using public/private key
authentication, we got the error: *OpenSSL_Uplink: no OpenSSL_Applink*. Is
the problem in the libeay32.dll/ssleay32.dll or libcurl aren't built
correctly??
Here the code for test sftp:
...
hd_src = fopen("C:\\temp\\testFTP.txt", "rb");
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
curl_easy_setopt(curl,CURLOPT_URL,
"sftp://localhost/uploadfile.txt");
curl_easy_setopt(curl, CURLOPT_USERPWD, "test:test");
curl_easy_setopt(curl, CURLOPT_READDATA, hd_src);
curl_easy_setopt(curl, CURLOPT_SSH_AUTH_TYPES,
CURLSSH_AUTH_PUBLICKEY);
curl_easy_setopt(curl, CURLOPT_SSH_PUBLIC_KEYFILE,
"C:\\cygwin\\home\\test\\.ssh\\authorized_keys");
curl_easy_setopt(curl, CURLOPT_SSH_PRIVATE_KEYFILE,
"C:\\cygwin\\home\\test\\.ssh\\id_rsa");
res = curl_easy_perform(curl);
if(CURLE_OK != res) {
fprintf(stderr, "curl told us %d\n", res);
}
curl_easy_cleanup(curl);
}
...
Thanks for any help!
Phuong.Ngo
Received on 2008-11-27