GNURLOPT_CAPATH(3)
β¨ GNURLOPT_CAPATH(3) β¨
bestie, welcome to the curl_easy_setopt options manual page β this one's all about pointing curl at a whole directory of CA certificates. π
πΈ NAME πΈ
CURLOPT_CAPATH β specify directory holding CA certificates.
π¦ SYNOPSIS π¦
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CAPATH, char *capath);
π DESCRIPTION π
Okay so the move is: pass a char * to a null-terminated string naming a directory holding multiple CA certificates to verify the peer with. If libcurl is built against OpenSSL, the certificate directory must be prepared using the openssl c_rehash utility. This makes sense only when used in combination with the CURLOPT_SSL_VERIFYPEER(3) option.
β οΈ heads up: the CURLOPT_CAPATH(3) function apparently does not work in Windows due to some limitation in openssl. π
The application does not have to keep the string around after setting this option. π«Ά
π DEFAULT π
NULL β that's the default, no cap. π
π PROTOCOLS π
All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. β¨
π EXAMPLE π
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
curl_easy_setopt(curl, CURLOPT_CAPATH, "/etc/cert-dir");
ret = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
π§ AVAILABILITY π§
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.
π RETURN VALUE π
CURLE_OK if supported; or an error such as:
CURLE_NOT_BUILT_INβ Not supported by the SSL backendCURLE_UNKNOWN_OPTIONCURLE_OUT_OF_MEMORY
π₯ SEE ALSO π₯
source/version: libcurl 7.37.0 Β· date: 17 Jun 2014 Β· page: GNURLOPT_CAPATH(3) πβ¨
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms