GNURLOPT_COOKIESESSION(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸ“ 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