CURLOPT_LOW_SPEED_TIME.md (1422B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_LOW_SPEED_TIME 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_LOW_SPEED_LIMIT (3) 9 - CURLOPT_TIMEOUT (3) 10 Protocol: 11 - All 12 Added-in: 7.1 13 --- 14 15 # NAME 16 17 CURLOPT_LOW_SPEED_TIME - low speed limit time period 18 19 # SYNOPSIS 20 21 ~~~c 22 #include <curl/curl.h> 23 24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_LOW_SPEED_TIME, 25 long speedtime); 26 ~~~ 27 28 # DESCRIPTION 29 30 Pass a long as parameter. It contains the time in number seconds that the 31 transfer speed should be below the CURLOPT_LOW_SPEED_LIMIT(3) for the 32 library to consider it too slow and abort. 33 34 # DEFAULT 35 36 0, disabled 37 38 # %PROTOCOLS% 39 40 # EXAMPLE 41 42 ~~~c 43 int 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 64 # RETURN VALUE 65 66 curl_easy_setopt(3) returns a CURLcode indicating success or error. 67 68 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 69 libcurl-errors(3).