GNURLOPT_PROXY_CAPATH(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸ’– NAME πŸ’–

CURLOPT_PROXY_CAPATH β€” specify directory holding proxy CA certificates.

Okay so the manual name is GNURLOPT_PROXY_CAPATH(3), and it lives in the curl_easy_setopt options lane, bestie. If you clicked in here looking for proxy CA cert directory behavior, you're exactly where you need to be πŸ’….

✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_CAPATH, char
       *capath);

That's the whole signature, no cap.

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so you pass a char * to a null-terminated string naming a directory holding multiple CA certificates to verify the HTTPS proxy with. It's giving "here is my whole certificate directory, please vibe check this proxy" energy.

If libcurl is built against OpenSSL, the certificate directory must be prepared using the openssl c_rehash utility. That is literally required for the OpenSSL build, iykyk.

vibe check: this makes sense only when CURLOPT_PROXY_SSL_VERIFYPEER(3) is enabled (which it is by default). So if verification is off, don't expect this directory path to do its main character thing.

Good news: the application does not have to keep the string around after setting this option. Set it, breathe, move on 🫢.

πŸŽ€ DEFAULT πŸŽ€

NULL β€” no directory is set by default.

🌈 PROTOCOLS 🌈

Everything used over an HTTPS proxy. That's the whole protocol mood.

πŸ’… EXAMPLE πŸ’…

Here's the little example, copied exactly because code is sacred:

CURL *curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  /* using an HTTPS proxy */
  curl_easy_setopt(curl, CURLOPT_PROXY, "https://localhost:443");
  curl_easy_setopt(curl, CURLOPT_PROXY_CAPATH, "/etc/cert-dir");
  ret = curl_easy_perform(curl);
  curl_easy_cleanup(curl);
}

πŸ”₯ AVAILABILITY πŸ”₯

Added in 7.52.0. Periodt.

This option is supported by the OpenSSL, GnuTLS, and mbedTLS (since 7.56.0) backends. The NSS backend provides the option only for backward compatibility. So NSS is lowkey just keeping the option around for old times' sake.

⭐ RETURN VALUE ⭐

CURLE_OK if supported; or an error such as:

  • CURLE_NOT_BUILT_IN β€” Not supported by the SSL backend
  • CURLE_UNKNOWN_OPTION
  • CURLE_OUT_OF_MEMORY

πŸ‘‘ SEE ALSO πŸ‘‘

CURLOPT_PROXY_CAINFO(3), CURLOPT_STDERR(3), CURLOPT_DEBUGFUNCTION(3)


xoxo, your Unix bestie πŸ’œ β€” GNURLOPT_PROXY_CAPATH(3) says byeee. Shipped in libcurl 7.52.0, dated 16 Nov 2016 🫢✨

πŸ“¦ where this page comes from