| |
|
|
|
cURL Mailing List Monthly Index Single Mail
curl-library Mailing List Archives
AW: AW: SCP/SFTP and persistency, bug #1823487
From: Enrico Stark <Enrico.Stark_at_bsgclearing.com>
Date: Thu, 29 Nov 2007 11:17:52 -0600
I just adopted the ftp upload example. The source directory contains 512 files that should be uploaded.
#include <stdio.h>
#include <curl/curl.h>
#define REMOTE_URL "scp://user@host/curl/upload/"
int main(int argc, char **argv)
/* In windows, this will init the winsock stuff */
/* get a curl handle */
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 60) ;
curl_easy_setopt(curl, CURLOPT_SSH_PUBLIC_KEYFILE, "/keyDir/.ssh/dsa-key.pub");
curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "passwd") ;
/* enable uploading */
if (NULL==(p_directory=opendir(srcdir))) {
while ((p_direntry=readdir(p_directory)) != NULL) {
snprintf(localFile, sizeof(localFile), "%s/%s", srcdir,p_direntry->d_name);
/* check if it is a regular file */
curl_easy_setopt(curl, CURLOPT_INFILESIZE,
/* get a FILE * of the same file, could also be made with
snprintf(remoteUrl, sizeof(remoteUrl), "%s%s.tmp", REMOTE_URL, p_direntry->d_name);
/* specify target */
/* now specify which file to upload */
/* Now run off and do what you've been told! */
/* now extract transfer info */
fprintf(stderr, "Speed: %.3f bytes/sec during %.3f seconds\n",
fclose(hd_src); /* close the local file */
closedir(p_directory);
/* always cleanup */
-----Ursprüngliche Nachricht-----
On Wed, 28 Nov 2007, Enrico Stark wrote:
> I tried yesterday snapshot (libcurl 7.17.2-20071127) for a short test
Thanks for the report, but I can't repeat it. I did this command line:
curl -T CHANGES scp://localhost/~/tmp/removeme -T README
... and it re-used the same connection for all transfers!
How did you do it?
> * Channel failed to close
I found out that this particular error message (which really should be shown since it isn't an error) is due to a bug in libssh2 that I have fixed now...
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2007-11-29 These mail archives are generated by hypermail. |
Page updated November 12, 2010.
web site info