-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Description
I did this
When uploading files to an SFTP server, I limited the CURLOPT_MAX_SEND_SPEED_LARGE to 1024, and set the CURLOPT_UPLOAD_BUFFERSIZE to it's minimum of 16kb. When I upload a file of 25855 bytes it finished the first 16384 bytes nearly instantly, then takes some time for the rest. It spends totally 16 seconds uploading something that should take 25855/1024 = 25 seconds give or take. Leaving the CURLOPT_UPLOAD_BUFFERSIZE to the default 64kb makes the entire upload happen instantly.
I also noticed something similar for download as well, if I set CURLOPT_BUFFERSIZE to say 131072 bytes (CURL_MAX_READ_SIZE/4), the entire download happens instantly. If I lowered CURLOPT_BUFFERSIZE to the same as CURLOPT_MAX_RECV_SPEED_LARGE it would take the expected time to download.
I expected the following
I expect that even if the buffer size is larger than the max speed, the max speed would be upheld.
curl/libcurl version
curl 7.71.1 (Windows) libcurl/7.71.1 OpenSSL/1.1.1g libssh2/1.9.0_DEV
Release-Date: 2020-07-01
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS HTTPS-proxy IPv6 Largefile NTLM SSL
operating system
Windows 10 Enterprise