1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_LOW_SPEED_LIMIT
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_LOW_SPEED_TIME (3)
9  - CURLOPT_MAX_RECV_SPEED_LARGE (3)
10  - CURLOPT_MAX_SEND_SPEED_LARGE (3)
11  - CURLOPT_TIMEOUT (3)
12Protocol:
13  - All
14Added-in: 7.1
15---
16
17# NAME
18
19CURLOPT_LOW_SPEED_LIMIT - low speed limit in bytes per second
20
21# SYNOPSIS
22
23~~~c
24#include <curl/curl.h>
25
26CURLcode curl_easy_setopt(CURL *handle, CURLOPT_LOW_SPEED_LIMIT,
27                          long speedlimit);
28~~~
29
30# DESCRIPTION
31
32Pass a long as parameter. It contains the average transfer speed in bytes per
33second that the transfer should be below during
34CURLOPT_LOW_SPEED_TIME(3) seconds for libcurl to consider it to be too
35slow and abort.
36
37# DEFAULT
38
390, disabled
40
41# %PROTOCOLS%
42
43# EXAMPLE
44
45~~~c
46int main(void)
47{
48  CURL *curl = curl_easy_init();
49  if(curl) {
50    CURLcode res;
51    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
52    /* abort if slower than 30 bytes/sec during 60 seconds */
53    curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 60L);
54    curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 30L);
55    res = curl_easy_perform(curl);
56    if(CURLE_OPERATION_TIMEDOUT == res) {
57      printf("Timeout.\n");
58    }
59    /* always cleanup */
60    curl_easy_cleanup(curl);
61  }
62}
63~~~
64
65# %AVAILABILITY%
66
67# RETURN VALUE
68
69Returns CURLE_OK
70