libssh: Remove write limit capping for newer libssh versions.

Since version 0.11.0, libssh has started applying
read/write length capping appropriately for both
its sync and async API.

The limit applied by libssh would be as per what the
server imposes if the server supports sharing this info,
otherwise the limits would be according to the protocol
specified minimum limit that the servers should support.

Hence, the calling code does not need to bother applying
these limits as per the sftp protocol (libssh's newer
versions since 0.11.0 would handle that)

Signed-off-by: Eshan Kelkar <eshankelkar@galorithm.com>
This commit is contained in:
Eshan Kelkar 2025-05-24 02:28:01 +05:30
parent a2f93579b7
commit 1a655aee4e

View file

@ -3030,11 +3030,6 @@ static CURLcode sftp_send(struct Curl_easy *data, int sockindex,
if(!sshc)
return CURLE_FAILED_INIT;
/* limit the writes to the maximum specified in Section 3 of
* https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-02
*/
if(len > 32768)
len = 32768;
#if LIBSSH_VERSION_INT > SSH_VERSION_INT(0, 11, 0)
switch(sshc->sftp_send_state) {
case 0:
@ -3067,6 +3062,17 @@ static CURLcode sftp_send(struct Curl_easy *data, int sockindex,
return CURLE_SEND_ERROR;
}
#else
/*
* limit the writes to the maximum specified in Section 3 of
* https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-02
*
* libssh started applying appropriate read/write length limits
* internally since version 0.11.0, hence such an operation is
* not needed for versions after (and including) 0.11.0.
*/
if(len > 32768)
len = 32768;
nwrite = sftp_write(sshc->sftp_file, mem, len);
myssh_block2waitfor(conn, sshc, FALSE);