3 /***************************************************************************
5 * Project ___| | | | _ \| |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
10 * Copyright (C) 1998 - 2003, Daniel Stenberg, <daniel@haxx.se>, et al.
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
14 * are also available at http://curl.haxx.se/docs/copyright.html.
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
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 long expires; /* expires = <this> */
42 char *expirestr; /* the plain text version */
43 bool tailmatch; /* weather we do tail-matchning of the domain name */
45 /* RFC 2109 keywords. Version=1 means 2109-compliant cookie sending */
46 char *version; /* Version = <value> */
47 char *maxage; /* Max-Age = <value> */
49 bool secure; /* whether the 'secure' keyword was used */
50 bool livecookie; /* updated from a server, not a stored file */
54 /* linked list of cookies we know of */
55 struct Cookie *cookies;
57 char *filename; /* file we read from/write to */
58 bool running; /* state info, for cookie adding information */
59 long numcookies; /* number of cookies in the "jar" */
60 bool newsession; /* new session, discard session cookies on load */
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"
73 * Add a cookie to the internal list of cookies. The domain and path arguments
74 * are only used if the header boolean is TRUE.
77 struct Cookie *Curl_cookie_add(struct SessionHandle *data,
78 struct CookieInfo *, bool header, char *line,
79 char *domain, char *path);
81 struct CookieInfo *Curl_cookie_init(struct SessionHandle *data,
82 char *, struct CookieInfo *, bool);
83 struct Cookie *Curl_cookie_getlist(struct CookieInfo *, char *, char *, bool);
84 void Curl_cookie_freelist(struct Cookie *);
85 void Curl_cookie_cleanup(struct CookieInfo *);
86 int Curl_cookie_output(struct CookieInfo *, char *);