3 /*****************************************************************************
5 * Project ___| | | | _ \| |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
10 * Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
12 * In order to be useful for every potential user, curl and libcurl are
13 * dual-licensed under the MPL and the MIT/X-derivate licenses.
15 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
16 * copies of the Software, and permit persons to whom the Software is
17 * furnished to do so, under the terms of the MPL or the MIT/X-derivate
18 * licenses. You may pick one of these licenses.
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
24 *****************************************************************************/
33 #include <curl/curl.h>
36 struct Cookie *next; /* next in the chain */
37 char *name; /* <this> = value */
38 char *value; /* name = <this> */
39 char *path; /* path = <this> */
40 char *domain; /* domain = <this> */
41 time_t expires; /* expires = <this> */
42 char *expirestr; /* the plain text version */
44 char field1; /* read from a cookie file, 1 => FALSE, 2=> TRUE */
46 /* RFC 2109 keywords. Version=1 means 2109-compliant cookie sending */
47 char *version; /* Version = <value> */
48 char *maxage; /* Max-Age = <value> */
50 bool secure; /* whether the 'secure' keyword was used */
51 bool livecookie; /* updated from a server, not a stored file */
55 /* linked list of cookies we know of */
56 struct Cookie *cookies;
58 char *filename; /* file we read from/write to */
59 bool running; /* state info, for cookie adding information */
60 long numcookies; /* number of cookies in the "jar" */
63 /* This is the maximum line length we accept for a cookie line */
64 #define MAX_COOKIE_LINE 2048
65 #define MAX_COOKIE_LINE_TXT "2047"
67 /* This is the maximum length of a cookie name we deal with: */
69 #define MAX_NAME_TXT "255"
72 * Add a cookie to the internal list of cookies. The domain argument is only
73 * used if the header boolean is TRUE.
75 struct Cookie *Curl_cookie_add(struct CookieInfo *, bool header, char *line,
78 struct CookieInfo *Curl_cookie_init(char *, struct CookieInfo *);
79 struct Cookie *Curl_cookie_getlist(struct CookieInfo *, char *, char *, bool);
80 void Curl_cookie_freelist(struct Cookie *);
81 void Curl_cookie_cleanup(struct CookieInfo *);
82 int Curl_cookie_output(struct CookieInfo *, char *);