curl-library
RE: Reflection for Secure IT Server
Date: Thu, 6 May 2010 09:08:41 +0800
> -----Original Message-----
> From: curl-library-bounces_at_cool.haxx.se
> [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of
> Daniel Stenberg
> Sent: Wednesday, May 05, 2010 5:19 PM
> To: libcurl development
> Cc: peter_at_stuge.se
> Subject: RE: Reflection for Secure IT Server
>
> So the problem is then most likely in the server end, as I
> don't believe libssh2 ever uses any illegal packet sizes. You
> could of course try the non-blocking libssh2 SFTP example
> snippet with a 16KB buffer to see what happens. If this
> theory holds, it should fail...
I have tried libssh2 SFTP example sftp_write_nonblock.c, changing the buffer mem[1024] to mem[16384]. Yes, it fails:
==============================================
[libssh2] 8.227832 SFTP: Closing handle
[libssh2] 8.227839 Conn: Writing 14 bytes on channel 0/0, stream #0
[libssh2] 8.227850 Socket: Error recving 16384 bytes to 0x95695e0+0: 11
[libssh2] 8.227856 Failure Event: -7 - Unable to send FXP_CLOSE command
[libssh2] 8.227864 Conn: Freeing channel 0/0 resources
[libssh2] 8.227869 Conn: Sending EOF on channel 0/0
==============================================
Regrettably, I can't see the error msg "packet too long" spit from the server. Maybe this is because libcurl shows what is received from the server, while this example doesn't. Anyway, the result is the same. Still 16KB (actually, this time a bit less, it is 16,304 bytes) is transferred to the destination. And the error code is the same, -7 means LIBSSH2_ERROR_SOCKET_SEND.
From these results, I think we can conclude the problem arises the fact that the server doesn't like a write buffer as big as 16KB. In my testing, it shows that 12KB (12,288 bytes) still works. That means, if CURL_MAX_WRITE_SIZE is changed from 16384 to 12288, libcurl is still doing well.
> I would also encourage you to contact whoever makes that SFTP
> server and confront them with these facts and ask them about
> specific details on why it says/does this and what we and
> they can do about the situation. Building a custom libcurl
> with a smaller buffer may be a solution for you, right now,
> but it certainly is not even a half-baked work-around for the
> long term - and I'm in this game long term...
This buffer size limit is probably a built-in requirement at the server's end, coz I can't find any setting related to buffer size. Anyway, I'll try to let them know and see whether they are willing to make some change to the server.
By the way, from the comment above defining CURL_MAX_WRITE_SIZE to 16384, it seems you have met some similar problems with Windows SFTP server, esp. when it comes to uploading. Could you tell me the full story behind it? It seems to me that the original buffer size limit is 20KB, and it is changed to 16KB later.
Thanks,
Xu Qiang
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-05-06