www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples

Archive Index This month's Index

Subject: a problem when downloading sftp

a problem when downloading sftp

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 26 Aug 2011 08:47:20 +0200 (CEST)

Hi friends,

I got a bug report regarding curl and SFTP download yesterday, and while
tracking it I wrote this libssh2-using app that closer mimics how curl uses
libssh2 - see attachment. It is similar to sftp_nonblock.c but not identical.

It turns out this code very frequently fails for me, indicating a problem in
the sftp_read() function. I'm working on it, but I thought I'd let you in on
it...

I'm downloading a 700K text file from localhost for my test and it fails in
more than 50% of the cases. The sympthom of the failure is that not the entire
file is transferred. A few K of the end is never read by the application.

There seems to be a problem when we pass in a smallish buffer size to get the
final data chunks (the size should be exact the amount that is left to get if
things work). If I modify the code to always ask for 16K in every read (which
is what the sftp_nonblock.c example does) it works just fine!

-- 
  / daniel.haxx.se


_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Received on 2011-08-26

the libssh2 team