add options to set maximum download rate

- -r/--limit-rate as cmdline option
- downloader.http.rate as config option

This implementation very roughly uses the idea of the token bucket
algorithm [1] and mostly uses Wget's approach [2] as inspiration.

[1] https://en.wikipedia.org/wiki/Token_bucket
[2] http://git.savannah.gnu.org/cgit/wget.git/tree/src/retr.c?h=v1.19.2&id=ba6b44f6745b14dce414761a8e4b35d31b176bba#n111
This commit is contained in:
Mike Fährmann
2017-12-02 01:47:26 +01:00
parent a718c6c6cd
commit 8f518e03f8
4 changed files with 43 additions and 1 deletions

View File

@@ -120,6 +120,20 @@ Description Alternate location for ``.part`` files.
=========== =====
downloader.http.rate
--------------------
=========== =====
Type ``string``
Default ``null``
Examples ``"32000"``, ``"500k"``, ``"2.5M"``
Description Maximum download rate in bytes per second.
Possible values are valid integer or floating-point numbers
optionally followed by one of ``k``, ``m``. ``g``, ``t`` or ``p``.
These suffixes are case-insensitive.
=========== =====
downloader.http.retries
-----------------------
=========== =====

View File

@@ -7,6 +7,7 @@
"part-directory": null,
"http":
{
"rate": null,
"retries": 5,
"timeout": 30,
"verify": true