• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_MAX_SEND_SPEED_LARGE
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_LOW_SPEED_LIMIT (3)
9  - CURLOPT_MAX_RECV_SPEED_LARGE (3)
10---
11
12# NAME
13
14CURLOPT_MAX_SEND_SPEED_LARGE - rate limit data upload speed
15
16# SYNOPSIS
17
18~~~c
19#include <curl/curl.h>
20
21CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAX_SEND_SPEED_LARGE,
22                          curl_off_t maxspeed);
23~~~
24
25# DESCRIPTION
26
27Pass a curl_off_t as parameter with the *maxspeed*. If an upload exceeds
28this speed (counted in bytes per second) the transfer pauses to keep the
29average speed less than or equal to the parameter value. Defaults to unlimited
30speed.
31
32This is not an exact science. libcurl attempts to keep the average speed below
33the given threshold over a period time.
34
35If you set *maxspeed* to a value lower than
36CURLOPT_UPLOAD_BUFFERSIZE(3), libcurl might "shoot over" the limit on
37its first send and still send off a full buffer.
38
39This option does not affect transfer speeds done with FILE:// URLs.
40
41# DEFAULT
42
430, disabled
44
45# PROTOCOLS
46
47All except file://
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 upload speed to 1000 bytes/sec */
59    curl_easy_setopt(curl, CURLOPT_MAX_SEND_SPEED_LARGE, (curl_off_t)1000);
60    /* (set some upload options as well!) */
61    ret = curl_easy_perform(curl);
62  }
63}
64~~~
65
66# AVAILABILITY
67
68Added in 7.15.5
69
70# RETURN VALUE
71
72Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
73