CURLSHOPT_UNSHARE(3)

πŸ’… CURLSHOPT_UNSHARE(3) β€” the un-share era

okay so this is a page from the Library Functions Manual, bestie, and it's about CURLSHOPT_UNSHARE β€” the iconique little option that lets you stop sharing stuff. yes, you heard me. we're breaking up with shared data today. πŸŽ€


🌸 NAME

CURLSHOPT_UNSHARE β€” remove data to share

(no cap, that's literally the whole job: un-share the share.)


✨ SYNOPSIS

#include <curl/curl.h>

CURLSHcode curl_share_setopt(CURLSH *share, CURLSHOPT_UNSHARE, long type);

πŸ’– DESCRIPTION

okay so the type parameter tells curl exactly what data should no longer be shared and kept in the share object that was created with curl_share_init(3). in other words: stop sharing that data in this shared object. periodt. 🫢

the given type must be one of the values described down below. and here's the cute part β€” you can call CURLSHOPT_UNSHARE(3) multiple times with different data arguments to remove multiple types from the shared object. very demure, very modular. and whenever you want it back, you just add data to share again with CURLSHOPT_SHARE(3). πŸ’«

  • CURL_LOCK_DATA_COOKIE β€” cookie data is no longer shared across the easy handles using this shared object. bye bye cookie sharing πŸͺ
  • CURL_LOCK_DATA_DNS β€” cached DNS hosts are no longer shared across the easy handles using this shared object. the DNS cache is on its own now, main character energy πŸ’…
  • CURL_LOCK_DATA_SSL_SESSION β€” SSL session IDs are no longer shared across the easy handles using this shared object. no more session-ID hand-me-downs πŸ”
  • CURL_LOCK_DATA_CONNECT β€” the connection cache is no longer shared. that's it, that's the whole thing πŸ¦‹
  • CURL_LOCK_DATA_PSL β€” the Public Suffix List is no longer shared. PSL said "I'm independent now" ✨

🌈 PROTOCOLS

this functionality affects all supported protocols. every single one. no exceptions, no gatekeeping. πŸ‘‘


πŸ“ EXAMPLE

int main(void)
{
  CURLSHcode sh;
  CURLSH *share = curl_share_init();
  sh = curl_share_setopt(share, CURLSHOPT_UNSHARE, CURL_LOCK_DATA_COOKIE);
  if(sh)
    printf("Error: %s\n", curl_share_strerror(sh));
}

look at her go 😭 init the share, un-share the cookies, check the return code like a responsible legend.


🧚 AVAILABILITY

added in curl 7.10.3 β€” vintage but still serving looks πŸ’œ


⭐ RETURN VALUE

CURLSHE_OK (zero) means that the option was set properly β€” slay. anything non-zero means an error occurred, which is not the vibe. see libcurl-errors(3) for the full list with descriptions. πŸ“‹


πŸŽ€ SEE ALSO

go read them, they're all part of the same friend group 🫢


lowkey reminder: if a type isn't one of the values listed above, you're not doing it right. the page said "must be one of the values described below" and she meant it, fr fr. πŸ’€

and that's the whole page, bestie! brought to you by libcurl, dated 2026-10-12, manual page CURLSHOPT_UNSHARE(3) β€” now go forth and un-share responsibly πŸŒΈπŸ’–

πŸ“¦ where this page comes from