GNURLOPT_COOKIESESSION(3)
π NAME π
okay so this is GNURLOPT_COOKIESESSION(3), one of the curl_easy_setopt options, and it's literally about starting a new cookie session. CURLOPT_COOKIESESSION - start a new cookie session, fr fr.
π SYNOPSIS π
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_COOKIESESSION, long
init);
π DESCRIPTION π
Pass a long set to 1 to mark this as a new cookie "session". That will force libcurl to ignore all cookies it is about to load that are "session cookies" from the previous session. No cap, this is the cookie reset button vibe.
By default, libcurl always stores and loads all cookies, independent if they are session cookies or not. Session cookies are cookies without expiry date, and they are meant to be alive and existing for this "session" only β like, they literally have no expiry date, bestie.
A "session" is usually defined in browser land for as long as you have your browser up, more or less. That's the whole definition. π¦
πΈ DEFAULT πΈ
0 β yes, zero. That's the default, periodt.
π PROTOCOLS π
HTTP β that's the one, bestie.
π§ EXAMPLE π§
Here's the exact lil example, no edits:
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
/* new "session", don't load session cookies */
curl_easy_setopt(curl, CURLOPT_COOKIESESSION, 1L);
/* get the (non session) cookies from this file */
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "/tmp/cookies.txt");
ret = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
π¦ AVAILABILITY π¦
Along with HTTP, bestie.
π RETURN VALUE π
Returns CURLE_OK β that's the whole return value tea.
π SEE ALSO π
xoxo, bestie π β source/version: libcurl 7.37.0; date: 17 Jun 2014; page: GNURLOPT_COOKIESESSION(3). mwah π
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2017, 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