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