CURLOPT_PROXY_CAINFO(3)
π NAME π
okay so this is CURLOPT_PROXY_CAINFO(3) from libcurl β the manual page for the path to your proxy Certificate Authority (CA) bundle, bestie. Itβs giving βwhere do I find the certs to verify my HTTPS proxy?β energy, and weβre obsessed. π
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_CAINFO, char *path);
π¦ DESCRIPTION π¦
okay so first thing: this option is for connecting to an HTTPS proxy, not an HTTPS server. Important distinction, no cap. π«Ά
You pass a char pointer to a null-terminated string naming a file that holds one or more certificates, and those certs are what you use to verify the HTTPS proxy. Slay. β¨
Now, if CURLOPT_PROXY_SSL_VERIFYPEER(3) is zero and youβre avoiding verifying the serverβs certificate, then CURLOPT_PROXY_CAINFO(3) doesnβt even need to indicate an accessible file. Lowkey wild, but thatβs the deal. π
By default, this option is set to the system path where libcurlβs CA certificate bundle is assumed to be stored β as established at build time. Built-in system path vibes, periodt. πΈ
The application does not have to keep the string around after setting this option. So you can free that memory, bestie, itβs fine. π§
Using this option multiple times makes the last set string override the previous ones. Set it to NULL to disable its use again and switch back to the internal default. Main character override behavior, honestly. π
And if youβre wondering what the default value actually is, you can figure it out with CURLINFO_CAINFO(3). iykyk. π₯
π DEFAULT π
Built-in system specific. Thatβs the whole mood. π
π PROTOCOLS π
This functionality affects all TLS based protocols:
HTTPSFTPSIMAPSPOP3SSMTPS- etc.
All TLS backends support this option. Every single one. Slay. π
π EXAMPLE π
hereβs the code, bestie β copied exactly, no edits, because we donβt play with code blocks:
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
/* using an HTTPS proxy */
curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy.example:443");
curl_easy_setopt(curl, CURLOPT_PROXY_CAINFO, "/etc/certs/cabundle.pem");
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
}
π NOTES π
For TLS backends that do not support certificate files, the CURLOPT_PROXY_CAINFO(3) option is ignored. Not me finding out the hard way π β refer to https://curl.se/docs/ssl-compared.html for the deets.
β AVAILABILITY β
Added in curl 7.52.0. iconic behavior since way back. β
π§ RETURN VALUE π§
curl_easy_setopt(3) returns a CURLcode indicating success or error. Simple as that. πΈ
CURLE_OK (0) means everything was OK. Non-zero means an error occurred β see libcurl-errors(3) for the full tea. β
π SEE ALSO π
CURLOPT_CAINFO(3)CURLOPT_CAINFO_BLOB(3)CURLOPT_CAPATH(3)CURLOPT_PROXY_CAINFO_BLOB(3)CURLOPT_PROXY_CAPATH(3)CURLOPT_PROXY_SSL_VERIFYHOST(3)CURLOPT_PROXY_SSL_VERIFYPEER(3)CURLOPT_SSL_VERIFYHOST(3)CURLOPT_SSL_VERIFYPEER(3)
Signed, sealed, and delivered by libcurl on 2026-10-12 β CURLOPT_PROXY_CAINFO(3) out π
β¨
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms