RE: An SFTP Upload Problem. Data transfer.
Date: Wed, 23 Apr 2008 23:50:08 +0200 (CEST)
On Tue, 22 Apr 2008, Pavel Shalagin wrote:
>> That sounds like a libssh2 bug then? I mean, if the socket reports
>> writable then certainly it should write at least something?
> I could hardly imagine, what difference could be between SFTP servers that
> could cause that problem. I sent you problem SFTP account auth data in
> private letter (that I sent to daniel_at_haxx.se). Could you please try to
> upload some file to that server to see what happens?
Thanks, using the account and server you gave me I could easily repeat this
and it makes it perfectly clear to me what this is.
The problem is that even though the socket reports itself as writable (thus
causing libcurl to act on it) the libssh2 function returns immediately with
EAGAIN and then libcurl loops since the socket is still writable so libssh2
When I single-stepped through the libssh2 code for this, it was obvious that
perhaps the socket would rather be checked for readability during some of this
time, as the SFTP subsystem needs to read from the socket too and some of the
EAGAIN returns is actually because it waits for data to read, not write.
libcurl clearly doesn't adapt to this.
So, while libcurl should be fixed to better deal with the read/write status of
what libssh2 is waiting for I'm not sure libssh2 exports that information
easily, nor am I sure that libssh2 is doing all this in a correct manner.
The proper thing to do here is to start addressing one flaw at a time I think,
and when one is fixed see what else there is left to do. First out: fix the
readability/writeability waiting. May require some tweak in libssh2 as well.
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2008-04-23