VirtualBox

source: vbox/trunk/src/libs/curl-7.64.0/lib/cookie.h@ 95000

Last change on this file since 95000 was 85671, checked in by vboxsync, 4 years ago

Export out internal curl copy to make it a lot simpler to build VBox (OSE) on Windows. bugref:9814

  • Property svn:eol-style set to native
File size: 4.4 KB
Line 
1#ifndef HEADER_CURL_COOKIE_H
2#define HEADER_CURL_COOKIE_H
3/***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
9 *
10 * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
11 *
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 https://curl.haxx.se/docs/copyright.html.
15 *
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.
19 *
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
22 *
23 ***************************************************************************/
24#include "curl_setup.h"
25
26#include <curl/curl.h>
27
28struct Cookie {
29 struct Cookie *next; /* next in the chain */
30 char *name; /* <this> = value */
31 char *value; /* name = <this> */
32 char *path; /* path = <this> which is in Set-Cookie: */
33 char *spath; /* sanitized cookie path */
34 char *domain; /* domain = <this> */
35 curl_off_t expires; /* expires = <this> */
36 char *expirestr; /* the plain text version */
37 bool tailmatch; /* whether we do tail-matching of the domain name */
38
39 /* RFC 2109 keywords. Version=1 means 2109-compliant cookie sending */
40 char *version; /* Version = <value> */
41 char *maxage; /* Max-Age = <value> */
42
43 bool secure; /* whether the 'secure' keyword was used */
44 bool livecookie; /* updated from a server, not a stored file */
45 bool httponly; /* true if the httponly directive is present */
46 int creationtime; /* time when the cookie was written */
47};
48
49#define COOKIE_HASH_SIZE 256
50
51struct CookieInfo {
52 /* linked list of cookies we know of */
53 struct Cookie *cookies[COOKIE_HASH_SIZE];
54
55 char *filename; /* file we read from/write to */
56 bool running; /* state info, for cookie adding information */
57 long numcookies; /* number of cookies in the "jar" */
58 bool newsession; /* new session, discard session cookies on load */
59 int lastct; /* last creation-time used in the jar */
60};
61
62/* This is the maximum line length we accept for a cookie line. RFC 2109
63 section 6.3 says:
64
65 "at least 4096 bytes per cookie (as measured by the size of the characters
66 that comprise the cookie non-terminal in the syntax description of the
67 Set-Cookie header)"
68
69 We allow max 5000 bytes cookie header. Max 4095 bytes length per cookie
70 name and value. Name + value may not exceed 4096 bytes.
71
72*/
73#define MAX_COOKIE_LINE 5000
74
75/* This is the maximum length of a cookie name or content we deal with: */
76#define MAX_NAME 4096
77#define MAX_NAME_TXT "4095"
78
79struct Curl_easy;
80/*
81 * Add a cookie to the internal list of cookies. The domain and path arguments
82 * are only used if the header boolean is TRUE.
83 */
84
85struct Cookie *Curl_cookie_add(struct Curl_easy *data,
86 struct CookieInfo *, bool header, bool noexpiry,
87 char *lineptr,
88 const char *domain, const char *path,
89 bool secure);
90
91struct Cookie *Curl_cookie_getlist(struct CookieInfo *, const char *,
92 const char *, bool);
93void Curl_cookie_freelist(struct Cookie *cookies);
94void Curl_cookie_clearall(struct CookieInfo *cookies);
95void Curl_cookie_clearsess(struct CookieInfo *cookies);
96
97#if defined(CURL_DISABLE_HTTP) || defined(CURL_DISABLE_COOKIES)
98#define Curl_cookie_list(x) NULL
99#define Curl_cookie_loadfiles(x) Curl_nop_stmt
100#define Curl_cookie_init(x,y,z,w) NULL
101#define Curl_cookie_cleanup(x) Curl_nop_stmt
102#define Curl_flush_cookies(x,y) Curl_nop_stmt
103#else
104void Curl_flush_cookies(struct Curl_easy *data, int cleanup);
105void Curl_cookie_cleanup(struct CookieInfo *);
106struct CookieInfo *Curl_cookie_init(struct Curl_easy *data,
107 const char *, struct CookieInfo *, bool);
108struct curl_slist *Curl_cookie_list(struct Curl_easy *data);
109void Curl_cookie_loadfiles(struct Curl_easy *data);
110#endif
111
112#endif /* HEADER_CURL_COOKIE_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette