Subject: SFTP issues

SFTP issues

From: Alexander Lamaison <>
Date: Thu, 2 Feb 2012 00:42:07 +0000

SFTP reading is completely broken for me in 1.4.0 (though it has been
for a while). The last release that works for me is 1.2.7.

Some revisions cause a read with a buffer larger than 65-130k to
block. Other revisions cause reads to return 0 prematurely indicating
the end of the file (usually around the 200k mark). Recent revisions
do the latter.

Using my usual test script (attached) and git bisect I've narrowed
down the offending commits. Apparently, premature EOF is caused by
03ca9020756a4e16f0294e5b35e9826ee6af2364 [1] and blocking is caused by
90b4b4073f34919aa72deff61a5c9bc188c47c95 [2]. It's difficult to know
how accurate these are as there were several overlapping, interacting
bugs and attempts to fix them that kept changing the SFTP behaviour.

This is all on Windows 7 64-bit. To try the script yourself, run it as:
    libssh2_bigread ip_address username password path
If you run it with something like /dev/zero as the path, the expected
behaviour is that it will try reading from that path with increasing
buffer sizes up to about 8MB.

Daniel, liuzl: we went through this process in September and you guys
made some fixes which I though had solved it. I've changed both the
Windows and Linux machines I'm testing on since then so I don't know
if that's why the problems are back. I don't understand enough about
the SFTP layer to suggest a fix but, as usual, I'll happily test any




Received on 2012-02-02