1CURLOPT_COOKIESESSION(3) curl_easy_setopt options CURLOPT_COOKIESESSION(3)
2
3
4
6 CURLOPT_COOKIESESSION - start a new cookie session
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_COOKIESESSION, long
12 init);
13
15 Pass a long set to 1 to mark this as a new cookie "session". It will
16 force libcurl to ignore all cookies it is about to load that are "ses‐
17 sion cookies" from the previous session. By default, libcurl always
18 stores and loads all cookies, independent if they are session cookies
19 or not. Session cookies are cookies without expiry date and they are
20 meant to be alive and existing for this "session" only.
21
22 A "session" is usually defined in browser land for as long as you have
23 your browser up, more or less.
24
26 0
27
29 HTTP
30
32 CURL *curl = curl_easy_init();
33 if(curl) {
34 curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
35
36 /* new "session", don't load session cookies */
37 curl_easy_setopt(curl, CURLOPT_COOKIESESSION, 1L);
38
39 /* get the (non session) cookies from this file */
40 curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "/tmp/cookies.txt");
41
42 ret = curl_easy_perform(curl);
43
44 curl_easy_cleanup(curl);
45 }
46
48 Along with HTTP
49
51 Returns CURLE_OK
52
54 CURLOPT_COOKIEFILE(3), CURLOPT_COOKIE(3),
55
56
57
58libcurl 7.66.0 May 05, 2017 CURLOPT_COOKIESESSION(3)