quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLOPT_LOW_SPEED_LIMIT.md (1533B)


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