cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl with sftp support

From: Satish Mittal <satish.mittal_at_gmail.com>
Date: Wed, 8 Nov 2006 20:50:38 +0530

On 11/8/06, Daniel Stenberg <daniel_at_haxx.se> wrote:
>
> On Tue, 7 Nov 2006, Satish Mittal wrote:
>
> > Quite recently I have been noticing efforts to put sftp client support
> into
> > libcurl (using libssh2 library). Has it been incorporated into any
> recent
> > release of libcurl? Is there any libcurl release somewhere that I can
> grab
> > and try out the sftp functionality?
>
> James Housley has been working on this, and his great work on SCP support
> has
> already been committed and is available from CVS and recent daily
> snapshots.
> He also posted a few questions yesterday about his work on SFTP, so I
> guess
> you have a chance to tell your opinions and ideas and perhaps affect how
> this
> is done in libcurl.

O.K. so is the libssh2 supported code still in private build mode with
James? I can see SCP support in recent CVS activities at libcurl site.

> I have been using libcurl quite happily in my product. Now I need to add
> > SSH2 based sftp client support to it, and I was trying out writing my
> own
> > wrapper over libssh2 for this purpose. But I am seeing some issues. May
> be
> > people out here have a workable code. I would be quite happy to see sftp
> > going into libcurl as soon as possible.
>
> We certainly will appreciate your help to bring this to libcurl.
>
> AFAICS, libssh2 may have a few issues we might need to sort out, but
> unfortunately the libssh2 project seems close to stalled.

There are quite a few bugs in libssh2 that I have come across, and I am
sure others too will see them sooner than later. The main ones are:
1. In the call to libssh2_session_startup() I get a crash randomly, because
the call to libssh2_blocking_read() fails. This looks to be some bug at
protocol level. Since many times the same client succeeds while connecting
to the same sftp server. I have posted the stack trace and the relevant code
at lissh2 mailing list.
2. In libssh2_session_startup() there is an indefinite hang.

Besides there are some small issues:
1. At many places, a variable of type unsigned long gets assigned a function
return value, which could be -1. This fails subsequent checks like val < 0.
I had to replace unsigned long with long.
2. I just noticed that at many places (mainly in debug prints) a char is
typecased to int and printed as %d. This prints 4 chars instead of the
desired 1 char. Perhaps author wanted something like atoi() there.
3. On windows, error code ENOTCONN is not present in VC7 any more. I had to
replace it with EBADF to compile it.

Thanks,
Satish

--
>   Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
>
-- 
"The happiest of people donĀ“t necessarily have the best of everything, they
just make the most of everything that comes along their way."
Received on 2006-11-08