From d8e39b0864595c15a886ddd2efe42702de2b46e3 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Tue, 7 Jul 2020 23:47:17 -0500 Subject: [PATCH] SFTP: change upload packet size from 4KB to 32KB --- phpseclib/Net/SFTP.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpseclib/Net/SFTP.php b/phpseclib/Net/SFTP.php index 7165b57a..9baca991 100644 --- a/phpseclib/Net/SFTP.php +++ b/phpseclib/Net/SFTP.php @@ -2085,8 +2085,8 @@ class Net_SFTP extends Net_SSH2 $sent = 0; $size = $size < 0 ? ($size & 0x7FFFFFFF) + 0x80000000 : $size; - $sftp_packet_size = 4096; // PuTTY uses 4096 - // make the SFTP packet be exactly 4096 bytes by including the bytes in the NET_SFTP_WRITE packets "header" + $sftp_packet_size = $this->max_sftp_packet; + // make the SFTP packet be exactly the SFTP packet size by including the bytes in the NET_SFTP_WRITE packets "header" $sftp_packet_size-= strlen($handle) + 25; $i = $j = 0; while ($dataCallback || ($size === 0 || $sent < $size)) {