quickjs-tart

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

CURLINFO_SSL_VERIFYRESULT.md (1603B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLINFO_SSL_VERIFYRESULT
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLINFO_PROXY_SSL_VERIFYRESULT (3)
      9   - curl_easy_getinfo (3)
     10   - curl_easy_setopt (3)
     11 Protocol:
     12   - TLS
     13 TLS-backend:
     14   - OpenSSL
     15   - GnuTLS
     16 Added-in: 7.5
     17 ---
     18 
     19 # NAME
     20 
     21 CURLINFO_SSL_VERIFYRESULT - get the result of the certificate verification
     22 
     23 # SYNOPSIS
     24 
     25 ~~~c
     26 #include <curl/curl.h>
     27 
     28 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SSL_VERIFYRESULT,
     29                            long *result);
     30 ~~~
     31 
     32 # DESCRIPTION
     33 
     34 Pass a pointer to a long to receive the result of the server SSL certificate
     35 verification that was requested (using the CURLOPT_SSL_VERIFYPEER(3)
     36 option).
     37 
     38 0 is a positive result. Non-zero is an error.
     39 
     40 # %PROTOCOLS%
     41 
     42 # EXAMPLE
     43 
     44 ~~~c
     45 int main(void)
     46 {
     47   CURL *curl = curl_easy_init();
     48   if(curl) {
     49     CURLcode res;
     50     long verifyresult;
     51 
     52     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
     53 
     54     res = curl_easy_perform(curl);
     55     if(res) {
     56       printf("error: %s\n", curl_easy_strerror(res));
     57       curl_easy_cleanup(curl);
     58       return 1;
     59     }
     60 
     61     res = curl_easy_getinfo(curl, CURLINFO_SSL_VERIFYRESULT,
     62                             &verifyresult);
     63     if(!res) {
     64       printf("The peer verification said %s\n",
     65              (verifyresult ? "bad" : "fine"));
     66     }
     67     curl_easy_cleanup(curl);
     68   }
     69 }
     70 ~~~
     71 
     72 # %AVAILABILITY%
     73 
     74 # RETURN VALUE
     75 
     76 curl_easy_getinfo(3) returns a CURLcode indicating success or error.
     77 
     78 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     79 libcurl-errors(3).