1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_COOKIESESSION 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_COOKIE (3) 9 - CURLOPT_COOKIEFILE (3) 10 - CURLOPT_COOKIEJAR (3) 11Protocol: 12 - HTTP 13--- 14 15# NAME 16 17CURLOPT_COOKIESESSION - start a new cookie session 18 19# SYNOPSIS 20 21~~~c 22#include <curl/curl.h> 23 24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_COOKIESESSION, long init); 25~~~ 26 27# DESCRIPTION 28 29Pass a long set to 1 to mark this as a new cookie "session". It forces libcurl 30to ignore all cookies it is about to load that are "session cookies" from the 31previous session. By default, libcurl always loads all cookies, independent if 32they are session cookies or not. Session cookies are cookies without expiry 33date and they are meant to be alive and existing for this "session" only. 34 35A "session" is usually defined in browser land for as long as you have your 36browser up, more or less. libcurl needs the application to use this option to 37tell it when a new session starts, otherwise it assumes everything is still in 38the same session. 39 40# DEFAULT 41 420 43 44# EXAMPLE 45 46~~~c 47int main(void) 48{ 49 CURL *curl = curl_easy_init(); 50 if(curl) { 51 CURLcode res; 52 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin"); 53 54 /* new "session", do not load session cookies */ 55 curl_easy_setopt(curl, CURLOPT_COOKIESESSION, 1L); 56 57 /* get the (non session) cookies from this file */ 58 curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "/tmp/cookies.txt"); 59 60 res = curl_easy_perform(curl); 61 62 curl_easy_cleanup(curl); 63 } 64} 65~~~ 66 67# AVAILABILITY 68 69Along with HTTP 70 71# RETURN VALUE 72 73Returns CURLE_OK 74