quickjs-tart

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

CURLINFO_OS_ERRNO.md (1726B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLINFO_OS_ERRNO
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - curl_easy_getinfo (3)
      9   - curl_easy_setopt (3)
     10 Protocol:
     11   - All
     12 Added-in: 7.12.2
     13 ---
     14 
     15 # NAME
     16 
     17 CURLINFO_OS_ERRNO - get errno number from last connect failure
     18 
     19 # SYNOPSIS
     20 
     21 ~~~c
     22 #include <curl/curl.h>
     23 
     24 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_OS_ERRNO, long *errnop);
     25 ~~~
     26 
     27 # DESCRIPTION
     28 
     29 Pass a pointer to a long to receive the errno variable from a connect failure.
     30 Note that the value is only set on failure, it is not reset upon a successful
     31 operation. The number is OS and system specific.
     32 
     33 libcurl network-related errors that may have a saved errno are:
     34 CURLE_COULDNT_CONNECT, CURLE_FAILED_INIT, CURLE_INTERFACE_FAILED,
     35 CURLE_OPERATION_TIMEDOUT, CURLE_RECV_ERROR, CURLE_SEND_ERROR.
     36 
     37 Since 8.8.0 libcurl clears the easy handle's saved errno before performing the
     38 transfer. Prior versions did not clear the saved errno, which means if a saved
     39 errno is retrieved it could be from a previous transfer on the same handle.
     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     res = curl_easy_perform(curl);
     53     if(res != CURLE_OK) {
     54       long error;
     55       res = curl_easy_getinfo(curl, CURLINFO_OS_ERRNO, &error);
     56       if(!res && error) {
     57         printf("Errno: %ld\n", error);
     58       }
     59     }
     60     curl_easy_cleanup(curl);
     61   }
     62 }
     63 ~~~
     64 
     65 # %AVAILABILITY%
     66 
     67 # RETURN VALUE
     68 
     69 curl_easy_getinfo(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).