Daniel,

I did run curl now with libssh2 debug and it seems to be another error than
the mentioned one in libssh2-devel.

[libssh2] Failure Event: -25 - Packet contains more data than we offered to
receive, truncating

The client is requesting in maximal 16384 bytes with SSH_FXP_READ, but
receives 16397 bytes, which shouldn't happen. So I guess it is a server bug
or is there any requirement of the length given in SSH_FXP_READ being
smaller by a set amount (e.g. 13 bytes for some headers ?) than
LIBSSH2_CHANNEL_PACKET_DEFAULT ?
If I change the max length in the SSH_FXP_READ to

if (bytes_requested > buffer_maxlen -13) {
    bytes_requested = buffer_maxlen -13;
}

I get the file.   (13 is based on seen read  bytes (16397) - request bytes
(16384)  = 13 and comments about 13 bytes of header length)

Markus

BTW:  The server identifies itself with
debug1: Remote protocol version 2.0, remote software version 1.36_sshlib
afts.


[libssh2] SFTP Subsystem: Asking for 105 packet
[libssh2] SFTP Subsystem: Reading 16384 bytes from SFTP handle
[libssh2] SFTP Subsystem: Requesting 16384 bytes from SFTP handle
[libssh2] Connection: Writing 26 bytes on channel 0/0, stream #0
[libssh2] Connection: Sending 26 bytes on channel 0/0, stream_id=0
[libssh2] SFTP Subsystem: _requirev(): Initialize timeout
[libssh2] SFTP Subsystem: Waiting for packet
[libssh2] Connection: Attempting to read 4 bytes from channel 0/0 stream #0
[libssh2] SFTP Subsystem: Asking for 103 packet
[libssh2] SFTP Subsystem: Asking for 101 packet
[libssh2] SFTP Subsystem: Waiting for packet
  % Total    % Received % Xferd  Average Speed   Time    Time     Time
Current
                                 Dload  Upload   Total   Spent    Left
Speed

  0  370k    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--
0
[libssh2] SFTP Subsystem: Requesting 16384 bytes from SFTP handle
[libssh2] SFTP Subsystem: Asking for 103 packet
[libssh2] SFTP Subsystem: Asking for 101 packet
[libssh2] SFTP Subsystem: Waiting for packet
[libssh2] Transport: Packet type 94 received, length=16406
[libssh2] Connection: 16397 bytes received for channel 0/0 stream #0
[libssh2] Failure Event: -25 - Packet contains more data than we offered to
receive, truncating
[libssh2] Connection: Reading 4 of buffered data from 0/0/0
[libssh2] SFTP Subsystem: Data begin - Packet Length: 16393
[libssh2] Connection: Attempting to read 16393 bytes from channel 0/0 stream
#0
[libssh2] Connection: Reading 16380 of buffered data from 0/0/0
[libssh2] Connection: Unlinking empty packet buffer from channel 0/0
[libssh2] Connection: Adjusting window 16467 bytes for data flushed from
channel 0/0
[libssh2] Connection: Attempting to read 13 bytes from channel 0/0 stream #0
[libssh2] SFTP Subsystem: Requesting 16384 bytes from SFTP handle
[libssh2] SFTP Subsystem: Asking for 103 packet
[libssh2] SFTP Subsystem: Asking for 101 packet
[libssh2] SFTP Subsystem: Waiting for packet

  0  370k    0     0    0     0      0      0 --:--:--  0:00:04 --:--:--
0
[libssh2] SFTP Subsystem: Requesting 16384 bytes from SFTP handle
[libssh2] SFTP Subsystem: Asking for 103 packet
[libssh2] SFTP Subsystem: Asking for 101 packet
[libssh2] SFTP Subsystem: Waiting for packet

  0  370k    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--
0
[libssh2] SFTP Subsystem: Requesting 16384 bytes from SFTP handle
[libssh2] SFTP Subsystem: Asking for 103 packet
[libssh2] SFTP Subsystem: Asking for 101 packet
[libssh2] SFTP Subsystem: Waiting for packet



"Markus Moeller" <hua...@moeller.plus.com> wrote in 
message news:gi12or$9q...@ger.gmane.org...
> The test from Alexander works. I need to check on the curl issue again.
> Unfortunately the server I had the issue with isn't available at the 
> moment
> and it didn't happen always.
>
> Markus
>
> "Daniel Stenberg" <dan...@haxx.se> wrote in message
> news:alpine.lrh.2.00.0812132012520.15...@yvahk3.pbagnpgbe.fr...
>> On Sat, 13 Dec 2008, Markus Moeller wrote:
>>
>> (Please trim your quotes)
>>
>>> The server can only answer with a size which was set before by the 
>>> client
>>> (otherwise it is a server bug).  As far as I understand the buffer size
>>> is
>>> send as part of the SSH_FXP_READ request which is set in sftp.c in line
>>> 1025.  Here the max buffer is set to buffer_maxlen (the user set value),
>>> but
>>> I think it can't be more than bytes_requested =
>>> LIBSSH2_SFTP_PACKET_MAXLEN -
>>> 10
>>
>> So does things work fine for you if you make sure it never sends a 
>> maximum
>> value larger than LIBSSH2_SFTP_PACKET_MAXLEN - 10 ?
>>
>> -- 
>>
>>  / daniel.haxx.se
>>
>> ------------------------------------------------------------------------------
>> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
>> Nevada.
>> The future of the web can't happen without you.  Join us at MIX09 to help
>> pave the way to the Next Web now. Learn more and register at
>> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
>
>
>
> ------------------------------------------------------------------------------
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, 
> Nevada.
> The future of the web can't happen without you.  Join us at MIX09 to help
> pave the way to the Next Web now. Learn more and register at
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ 



------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
libssh2-devel mailing list
libssh2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel

Reply via email to