sftp: Cap maximum SFTP write
The curl is using the sftp write without any chunking, which breaks on some servers having a limit on how large SFTP packets they can accept.
The SFTP specification suggests the maximum SFTP packet size in https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-02#section-3 and curl claims that this is not their issue https://github.com/curl/curl/pull/11804 so it looks like we will have to cap the maximum SFTP size inside of libssh.
There are different approaches proposed:
- simple caping and returning smaller than passed value is probably least intrusive
- cycling over the all passed data and sending it in separate packets can cause very short packets and more synchronization needed
I am open to other proposals.
Fixes: #215 (closed)
Checklist
-
Commits have Signed-off-by:
with name/author being identical to the commit author -
Code modified for feature -
Test suite updated with functionality tests -
Test suite updated with negative tests -
Documentation updated
Reviewer's checklist:
-
Any issues marked for closing are addressed -
There is a test suite reasonably covering new functionality or modifications -
Function naming, parameters, return values, types, etc., are consistent and according to CONTRIBUTING.md -
This feature/change has adequate documentation added -
No obvious mistakes in the code
Edited by Jakub Jelen