CURLOPT_PROXY_CAINFO.md (2358B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_PROXY_CAINFO 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_CAINFO (3) 9 - CURLOPT_CAINFO_BLOB (3) 10 - CURLOPT_CAPATH (3) 11 - CURLOPT_PROXY_CAINFO_BLOB (3) 12 - CURLOPT_PROXY_CAPATH (3) 13 - CURLOPT_PROXY_SSL_VERIFYHOST (3) 14 - CURLOPT_PROXY_SSL_VERIFYPEER (3) 15 - CURLOPT_SSL_VERIFYHOST (3) 16 - CURLOPT_SSL_VERIFYPEER (3) 17 Protocol: 18 - TLS 19 TLS-backend: 20 - All 21 Added-in: 7.52.0 22 --- 23 24 # NAME 25 26 CURLOPT_PROXY_CAINFO - path to proxy Certificate Authority (CA) bundle 27 28 # SYNOPSIS 29 30 ~~~c 31 #include <curl/curl.h> 32 33 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_CAINFO, char *path); 34 ~~~ 35 36 # DESCRIPTION 37 38 This option is for connecting to an HTTPS proxy, not an HTTPS server. 39 40 Pass a char pointer to a null-terminated string naming a file holding one or 41 more certificates to verify the HTTPS proxy with. 42 43 If CURLOPT_PROXY_SSL_VERIFYPEER(3) is zero and you avoid verifying the 44 server's certificate, CURLOPT_PROXY_CAINFO(3) need not even indicate an 45 accessible file. 46 47 This option is by default set to the system path where libcurl's CA 48 certificate bundle is assumed to be stored, as established at build time. 49 50 The application does not have to keep the string around after setting this 51 option. 52 53 Using this option multiple times makes the last set string override the 54 previous ones. Set it to NULL to disable its use again and switches back to 55 internal default. 56 57 The default value for this can be figured out with CURLINFO_CAINFO(3). 58 59 # DEFAULT 60 61 Built-in system specific 62 63 # %PROTOCOLS% 64 65 # EXAMPLE 66 67 ~~~c 68 int main(void) 69 { 70 CURL *curl = curl_easy_init(); 71 if(curl) { 72 CURLcode res; 73 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 74 /* using an HTTPS proxy */ 75 curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost:443"); 76 curl_easy_setopt(curl, CURLOPT_PROXY_CAINFO, "/etc/certs/cabundle.pem"); 77 res = curl_easy_perform(curl); 78 curl_easy_cleanup(curl); 79 } 80 } 81 ~~~ 82 83 # NOTES 84 85 For TLS backends that do not support certificate files, the 86 CURLOPT_PROXY_CAINFO(3) option is ignored. Refer to 87 https://curl.se/docs/ssl-compared.html 88 89 # %AVAILABILITY% 90 91 # RETURN VALUE 92 93 curl_easy_setopt(3) returns a CURLcode indicating success or error. 94 95 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 96 libcurl-errors(3).