quickjs-tart

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

CURLOPT_TIMEOUT.md (2511B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_TIMEOUT
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLOPT_CONNECTTIMEOUT (3)
      9   - CURLOPT_LOW_SPEED_LIMIT (3)
     10   - CURLOPT_TCP_KEEPALIVE (3)
     11   - CURLOPT_TIMEOUT_MS (3)
     12 Protocol:
     13   - All
     14 Added-in: 7.1
     15 ---
     16 
     17 # NAME
     18 
     19 CURLOPT_TIMEOUT - maximum time the transfer is allowed to complete
     20 
     21 # SYNOPSIS
     22 
     23 ~~~c
     24 #include <curl/curl.h>
     25 
     26 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEOUT, long timeout);
     27 ~~~
     28 
     29 # DESCRIPTION
     30 
     31 Pass a long as parameter containing *timeout* - the maximum time in
     32 seconds that you allow the entire transfer operation to take. The whole thing,
     33 from start to end. Normally, name lookups can take a considerable time and
     34 limiting operations risk aborting perfectly normal operations.
     35 
     36 CURLOPT_TIMEOUT_MS(3) is the same function but set in milliseconds.
     37 
     38 If both CURLOPT_TIMEOUT(3) and CURLOPT_TIMEOUT_MS(3) are set, the
     39 value set last is used.
     40 
     41 Since this option puts a hard limit on how long time a request is allowed to
     42 take, it has limited use in dynamic use cases with varying transfer
     43 times. That is especially apparent when using the multi interface, which may
     44 queue the transfer, and that time is included. You are advised to explore
     45 CURLOPT_LOW_SPEED_LIMIT(3), CURLOPT_LOW_SPEED_TIME(3) or using
     46 CURLOPT_PROGRESSFUNCTION(3) to implement your own timeout logic.
     47 
     48 The connection timeout set with CURLOPT_CONNECTTIMEOUT(3) is included in
     49 this general all-covering timeout.
     50 
     51 With CURLOPT_CONNECTTIMEOUT(3) set to 3 and CURLOPT_TIMEOUT(3) set
     52 to 5, the operation can never last longer than 5 seconds.
     53 
     54 With CURLOPT_CONNECTTIMEOUT(3) set to 4 and CURLOPT_TIMEOUT(3) set
     55 to 2, the operation can never last longer than 2 seconds.
     56 
     57 This option may cause libcurl to use the SIGALRM signal to timeout system
     58 calls on builds not using asynch DNS. In Unix-like systems, this might cause
     59 signals to be used unless CURLOPT_NOSIGNAL(3) is set.
     60 
     61 # DEFAULT
     62 
     63 0 (zero) which means it never times out during transfer.
     64 
     65 # %PROTOCOLS%
     66 
     67 # EXAMPLE
     68 
     69 ~~~c
     70 int main(void)
     71 {
     72   CURL *curl = curl_easy_init();
     73   if(curl) {
     74     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
     75 
     76     /* complete within 20 seconds */
     77     curl_easy_setopt(curl, CURLOPT_TIMEOUT, 20L);
     78 
     79     curl_easy_perform(curl);
     80   }
     81 }
     82 ~~~
     83 
     84 # %AVAILABILITY%
     85 
     86 # RETURN VALUE
     87 
     88 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     89 
     90 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     91 libcurl-errors(3).