1 #ifndef HEADER_CURL_COOKIE_H
2 #define HEADER_CURL_COOKIE_H
3 /***************************************************************************
5 * Project ___| | | | _ \| |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
10 * Copyright (C) 1998 - 2011, 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.
23 ***************************************************************************/
29 #ifdef HAVE_SYS_TIME_H
34 #include <curl/curl.h>
37 struct Cookie *next; /* next in the chain */
38 char *name; /* <this> = value */
39 char *value; /* name = <this> */
40 char *path; /* path = <this> */
41 char *domain; /* domain = <this> */
42 curl_off_t expires; /* expires = <this> */
43 char *expirestr; /* the plain text version */
44 bool tailmatch; /* weather we do tail-matchning of the domain name */
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 */
52 bool httponly; /* true if the httponly directive is present */
56 /* linked list of cookies we know of */
57 struct Cookie *cookies;
59 char *filename; /* file we read from/write to */
60 bool running; /* state info, for cookie adding information */
61 long numcookies; /* number of cookies in the "jar" */
62 bool newsession; /* new session, discard session cookies on load */
65 /* This is the maximum line length we accept for a cookie line. RFC 2109
68 "at least 4096 bytes per cookie (as measured by the size of the characters
69 that comprise the cookie non-terminal in the syntax description of the
73 #define MAX_COOKIE_LINE 5000
74 #define MAX_COOKIE_LINE_TXT "4999"
76 /* This is the maximum length of a cookie name we deal with: */
78 #define MAX_NAME_TXT "1023"
82 * Add a cookie to the internal list of cookies. The domain and path arguments
83 * are only used if the header boolean is TRUE.
86 struct Cookie *Curl_cookie_add(struct SessionHandle *data,
87 struct CookieInfo *, bool header, char *lineptr,
88 const char *domain, const char *path);
90 struct Cookie *Curl_cookie_getlist(struct CookieInfo *, const char *,
92 void Curl_cookie_freelist(struct Cookie *cookies, bool cookiestoo);
93 void Curl_cookie_clearall(struct CookieInfo *cookies);
94 void Curl_cookie_clearsess(struct CookieInfo *cookies);
96 #if defined(CURL_DISABLE_HTTP) || defined(CURL_DISABLE_COOKIES)
97 #define Curl_cookie_list(x) NULL
98 #define Curl_cookie_loadfiles(x) do { } while (0)
99 #define Curl_cookie_init(x,y,z,w) NULL
100 #define Curl_cookie_cleanup(x) do { } while (0)
101 #define Curl_flush_cookies(x,y)
103 void Curl_flush_cookies(struct SessionHandle *data, int cleanup);
104 void Curl_cookie_cleanup(struct CookieInfo *);
105 struct CookieInfo *Curl_cookie_init(struct SessionHandle *data,
106 const char *, struct CookieInfo *, bool);
107 struct curl_slist *Curl_cookie_list(struct SessionHandle *data);
108 void Curl_cookie_loadfiles(struct SessionHandle *data);
111 #endif /* HEADER_CURL_COOKIE_H */