Skip to content

Commit

Permalink
SFTP: change upload packet size from 4KB to 32KB
Browse files Browse the repository at this point in the history
  • Loading branch information
terrafrost committed Jul 8, 2020
1 parent 6537e74 commit d8e39b0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions phpseclib/Net/SFTP.php
Expand Up @@ -2085,8 +2085,8 @@ function put($remote_file, $data, $mode = NET_SFTP_STRING, $start = -1, $local_s
$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)) {
Expand Down

0 comments on commit d8e39b0

Please sign in to comment.