CURLINFO_CAPATH(3)

πŸ’… CURLINFO_CAPATH β€” the "where's my default CA folder at" of curl

okay bestie, this is CURLINFO_CAPATH, and it lives in the Library Functions Manual section of the curl universe. it's a curl_easy_getinfo thing, and honestly? kind of a vibe. let's get into it πŸŽ€


✨ SYNOPSIS ✨

grab the header like the icon you are:

#include <curl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CAPATH, char **path);

🌸 DESCRIPTION 🌸

so here's the tea: you pass a pointer to a char pointer, and it comes back holding a pointer to a null-terminated string. that string is the default built-in path used for the CURLOPT_CAPATH(3) option β€” like, unless the user set their own. iykyk πŸ’…

⚠️ heads up bestie: if libcurl was built to support multiple TLS libraries, this option might hand you a string even if the specific TLS library currently set to be used does not support CURLOPT_CAPATH(3). so like… don't get too comfy with it, ok? πŸ™ˆ

this is a path identifying a directory. that's it. that's the whole thing. a directory. πŸ—‚οΈ

and if there's no default path? the path pointer gets set to NULL. periodt. NULL. 😭


πŸ¦‹ PROTOCOLS πŸ¦‹

this functionality affects all TLS based protocols β€” like HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. all of them. the whole squad. πŸ”₯

this option works only with the following TLS backends:

  • GnuTLS
  • OpenSSL
  • mbedTLS
  • wolfSSL

⭐ EXAMPLE ⭐

here's a lil sample, so you can copy-paste and feel iconic:

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    char *capath = NULL;
    curl_easy_getinfo(curl, CURLINFO_CAPATH, &capath);
    if(capath) {
      printf("default ca path: %s\n", capath);
    }
    curl_easy_cleanup(curl);
  }
}

look at it go 🫢


🌈 AVAILABILITY 🌈

added in curl 7.84.0 β€” so if your curl is older than that, sorry bestie, no capath lore for you πŸ’€


πŸ‘‘ RETURN VALUE πŸ‘‘

curl_easy_getinfo(3) returns a CURLcode β€” indicating success or error, as one does.

  • CURLE_OK (0) means everything was OK. slay. ✨
  • non-zero means an error occurred β€” peep libcurl-errors(3) for the deets.

πŸ’– SEE ALSO πŸ’–


and that's the whole page, bestie β€” brought to you by libcurl, dated 2026-10-12, filed under CURLINFO_CAPATH(3). mwah πŸ’‹

πŸ“¦ where this page comes from