CURLOPT_SSL_SESSIONID_CACHE(3)

πŸ’… CURLOPT_SSL_SESSIONID_CACHE(3) β€” like, the SSL session-ID cache one, bestie

okay so this is a page from the Library Functions Manual, and it's literally all about CURLOPT_SSL_SESSIONID_CACHE β€” the option that decides whether libcurl gets to use the SSL session-ID cache. yes bestie, that's the whole vibe πŸŽ€


✨ NAME ✨

CURLOPT_SSL_SESSIONID_CACHE β€” use the SSL session-ID cache πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_SESSIONID_CACHE,
                         long enabled);

🌸 DESCRIPTION 🌸

so you pass a long here, and it's giving very much a switch. set it to 0 and you disable libcurl's use of SSL session-ID caching. set it to 1 and you enable it. that's it, that's the whole thing 🫢

by default, all transfers are done with the cache enabled. and like β€” nothing ever should get hurt by attempting to reuse SSL session-IDs, no cap. but apparently there seem to be, or have been, broken SSL implementations out in the wild 😭 and those might require you to disable this in order for you to succeed. so if something's acting cursed, this is your girl. iykyk.


πŸ‘‘ DEFAULT πŸ‘‘

1

like, enabled. on. slaying by default πŸ’…


🌈 PROTOCOLS 🌈

this functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. β€” literally the whole TLS friend group πŸ’œ

all TLS backends support this option. every single one. periodt.


πŸ“ EXAMPLE πŸ“

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
    /* switch off session-id use */
    curl_easy_setopt(curl, CURLOPT_SSL_SESSIONID_CACHE, 0L);
    result = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
  }
}

see that comment in there? /* switch off session-id use */ β€” that's the moment she turns it off. iconic behavior honestly ✨


⭐ AVAILABILITY ⭐

added in curl 7.16.0 β€” she's been around a minute, an OG fr πŸŽ€


πŸ”₯ RETURN VALUE πŸ”₯

curl_easy_setopt(3) returns a CURLcode indicating success or error.

CURLE_OK (0) means everything was OK. non-zero means an error occurred β€” go check libcurl-errors(3) for the deets πŸ’€


πŸ’– SEE ALSO πŸ’–

go read those next bestie, they're all in the same little cache-and-connection cinematic universe 🌸


okay that's the whole page!! written by the libcurl girlies, dated 2026-10-12, and the manual page is CURLOPT_SSL_SESSIONID_CACHE(3) in case you forgot already (you didn't, you're a main character). mwah πŸ’‹

πŸ“¦ where this page comes from