-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First buffer upload seem to ignore the send speed #5788
Comments
Clearly, when libcurl's been instructed to do the transfer slower (in bytes/sec) than the size of the upload/download buffer, it should rather limit the amount data to handle to the capped amount in order to better acknowledge the setting in the first network read/write. I think this is just an oversight as it only affects the first network operation and capping network speed has always been about being "roughly right over time", and not an exact science. Are you interested in writing a patch for this? |
I am willing to give it a shot, if I can get pointed to the right direction in the source code. |
Curl_fillreadbuffer reads data into the upload buffer The primary point in the code that reads data off the network in a download state is when |
I played around with it today, and as far as I can tell, CURL, calls This seems to be supported when I run the curl binary "Current Speed" stay at 0, for a long time, the jumps up for some few seconds, then back to 0 |
Yes that's how it currently works which has the effect on the first recv/send you described. Limiting the buffer sizes is of course a mitigating method. |
... in particular what happens if the maximum speed limit is set to a value that's smaller than the transfer buffer size in use. Reported-by: Tomas Berger Fixes #5788
I did this
When uploading files to an SFTP server, I limited the
CURLOPT_MAX_SEND_SPEED_LARGE
to 1024, and set theCURLOPT_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 theCURLOPT_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 loweredCURLOPT_BUFFERSIZE
to the same asCURLOPT_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
operating system
Windows 10 Enterprise
The text was updated successfully, but these errors were encountered: