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
14---
15
16# NAME
17
18CURLOPT_LOW_SPEED_LIMIT - low speed limit in bytes per second
19
20# SYNOPSIS
21
22~~~c
23#include <curl/curl.h>
24
25CURLcode curl_easy_setopt(CURL *handle, CURLOPT_LOW_SPEED_LIMIT,
26                          long speedlimit);
27~~~
28
29# DESCRIPTION
30
31Pass a long as parameter. It contains the average transfer speed in bytes per
32second that the transfer should be below during
33CURLOPT_LOW_SPEED_TIME(3) seconds for libcurl to consider it to be too
34slow and abort.
35
36# DEFAULT
37
380, disabled
39
40# EXAMPLE
41
42~~~c
43int main(void)
44{
45  CURL *curl = curl_easy_init();
46  if(curl) {
47    CURLcode res;
48    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
49    /* abort if slower than 30 bytes/sec during 60 seconds */
50    curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 60L);
51    curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 30L);
52    res = curl_easy_perform(curl);
53    if(CURLE_OPERATION_TIMEDOUT == res) {
54      printf("Timeout!\n");
55    }
56    /* always cleanup */
57    curl_easy_cleanup(curl);
58  }
59}
60~~~
61
62# AVAILABILITY
63
64Always
65
66# RETURN VALUE
67
68Returns CURLE_OK
69