speed caps: not based on average speeds anymore

Speed limits (from CURLOPT_MAX_RECV_SPEED_LARGE &
CURLOPT_MAX_SEND_SPEED_LARGE) were applied simply by comparing limits
with the cumulative average speed of the entire transfer; While this
might work at times with good/constant connections, in other cases it
can result to the limits simply being "ignored" for more than "short
bursts" (as told in man page).

Consider a download that goes on much slower than the limit for some
time (because bandwidth is used elsewhere, server is slow, whatever the
reason), then once things get better, curl would simply ignore the limit
up until the average speed (since the beginning of the transfer) reached
the limit.  This could prove the limit useless to effectively avoid
using the entire bandwidth (at least for quite some time).

So instead, we now use a "moving starting point" as reference, and every
time at least as much as the limit as been transferred, we can reset
this starting point to the current position. This gets a good limiting
effect that applies to the "current speed" with instant reactivity (in
case of sudden speed burst).

Closes #971
9 files changed
tree: 46e47059805dc88774d9a29e5210c6496e031c37
  1. .github/
  2. CMake/
  3. docs/
  4. include/
  5. lib/
  6. m4/
  7. packages/
  8. projects/
  9. scripts/
  10. src/
  11. tests/
  12. winbuild/
  13. .dir-locals.el
  14. .gitattributes
  15. .gitignore
  16. .travis.yml
  17. acinclude.m4
  18. appveyor.yml
  19. buildconf
  20. buildconf.bat
  21. CHANGES
  22. CHANGES.0
  23. CMakeLists.txt
  24. configure.ac
  25. COPYING
  26. CTestConfig.cmake
  27. curl-config.in
  28. GIT-INFO
  29. libcurl.pc.in
  30. MacOSX-Framework
  31. Makefile.am
  32. Makefile.dist
  33. maketgz
  34. README
  35. README.md
  36. RELEASE-NOTES
README.md

curl logo CII Best Practices

Curl is a command-line tool for transferring data specified with URL syntax. Find out how to use curl by reading the curl.1 man page or the MANUAL document. Find out how to install Curl by reading the INSTALL document.

libcurl is the library curl is using to do its job. It is readily available to be used by your software. Read the libcurl.3 man page to learn how!

You find answers to the most frequent questions we get in the FAQ document.

Study the COPYING file for distribution terms and similar. If you distribute curl binaries or other binaries that involve libcurl, you might enjoy the LICENSE-MIXING document.

Contact

If you have problems, questions, ideas or suggestions, please contact us by posting to a suitable mailing list.

All contributors to the project are listed in the THANKS document.

Website

Visit the curl web site for the latest news and downloads.

Git

To download the very latest source off the Git server do this:

git clone https://github.com/curl/curl.git

(you'll get a directory named curl created, filled with the source code)

Notice

Curl contains pieces of source code that is Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan. This notice is included here to comply with the distribution terms.