diff options
Diffstat (limited to 'docs/examples/cookie_interface.c')
-rw-r--r-- | docs/examples/cookie_interface.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/docs/examples/cookie_interface.c b/docs/examples/cookie_interface.c index 9f1e629e..28ee7817 100644 --- a/docs/examples/cookie_interface.c +++ b/docs/examples/cookie_interface.c @@ -1,12 +1,25 @@ -/***************************************************************************** +/*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * This example shows usage of simple cookie interface. - */ + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* This example shows usage of simple cookie interface. */ #include <stdio.h> #include <string.h> @@ -76,14 +89,19 @@ main(void) #endif /* Netscape format cookie */ snprintf(nline, sizeof(nline), "%s\t%s\t%s\t%s\t%lu\t%s\t%s", - ".google.com", "TRUE", "/", "FALSE", time(NULL) + 31337, "PREF", "hello google, i like you very much!"); + ".google.com", "TRUE", "/", "FALSE", (unsigned long)time(NULL) + 31337UL, "PREF", "hello google, i like you very much!"); res = curl_easy_setopt(curl, CURLOPT_COOKIELIST, nline); if (res != CURLE_OK) { fprintf(stderr, "Curl curl_easy_setopt failed: %s\n", curl_easy_strerror(res)); return 1; } - /* HTTP-header style cookie */ + /* HTTP-header style cookie. If you use the Set-Cookie format and don't + specify a domain then the cookie is sent for any domain and will not be + modified, likely not what you intended. Starting in 7.43.0 any-domain + cookies will not be exported either. For more information refer to the + CURLOPT_COOKIELIST documentation. + */ snprintf(nline, sizeof(nline), "Set-Cookie: OLD_PREF=3d141414bf4209321; " "expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com"); |