1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_MAX_RECV_SPEED_LARGE
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_LOW_SPEED_LIMIT (3)
9  - CURLOPT_MAX_SEND_SPEED_LARGE (3)
10  - CURLOPT_TIMEOUT (3)
11Protocol:
12  - All
13Added-in: 7.15.5
14---
15
16# NAME
17
18CURLOPT_MAX_RECV_SPEED_LARGE - rate limit data download speed
19
20# SYNOPSIS
21
22~~~c
23#include <curl/curl.h>
24
25CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAX_RECV_SPEED_LARGE,
26                          curl_off_t maxspeed);
27~~~
28
29# DESCRIPTION
30
31Pass a curl_off_t as parameter. If a download exceeds this *maxspeed*
32(counted in bytes per second) the transfer pauses to keep the average speed
33less than or equal to the parameter value. Defaults to unlimited speed.
34
35This is not an exact science. libcurl attempts to keep the average speed below
36the given threshold over a period time.
37
38If you set *maxspeed* to a value lower than CURLOPT_BUFFERSIZE(3),
39libcurl might download faster than the set limit initially.
40
41This option does not affect transfer speeds done with FILE:// URLs.
42
43# DEFAULT
44
450, disabled
46
47# %PROTOCOLS%
48
49# EXAMPLE
50
51~~~c
52int main(void)
53{
54  CURL *curl = curl_easy_init();
55  if(curl) {
56    CURLcode ret;
57    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
58    /* cap the download speed to 31415 bytes/sec */
59    curl_easy_setopt(curl, CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t)31415);
60    ret = curl_easy_perform(curl);
61  }
62}
63~~~
64
65# %AVAILABILITY%
66
67# RETURN VALUE
68
69Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
70