mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
the new cookie functions that require 'data' passed in
This commit is contained in:
parent
2dd1518d63
commit
96e217b496
@ -68,14 +68,18 @@ struct CookieInfo {
|
|||||||
#define MAX_NAME 256
|
#define MAX_NAME 256
|
||||||
#define MAX_NAME_TXT "255"
|
#define MAX_NAME_TXT "255"
|
||||||
|
|
||||||
|
struct SessionHandle;
|
||||||
/*
|
/*
|
||||||
* Add a cookie to the internal list of cookies. The domain and path arguments
|
* Add a cookie to the internal list of cookies. The domain and path arguments
|
||||||
* are only used if the header boolean is TRUE.
|
* are only used if the header boolean is TRUE.
|
||||||
*/
|
*/
|
||||||
struct Cookie *Curl_cookie_add(struct CookieInfo *, bool header, char *line,
|
|
||||||
|
struct Cookie *Curl_cookie_add(struct SessionHandle *data,
|
||||||
|
struct CookieInfo *, bool header, char *line,
|
||||||
char *domain, char *path);
|
char *domain, char *path);
|
||||||
|
|
||||||
struct CookieInfo *Curl_cookie_init(char *, struct CookieInfo *, bool);
|
struct CookieInfo *Curl_cookie_init(struct SessionHandle *data,
|
||||||
|
char *, struct CookieInfo *, bool);
|
||||||
struct Cookie *Curl_cookie_getlist(struct CookieInfo *, char *, char *, bool);
|
struct Cookie *Curl_cookie_getlist(struct CookieInfo *, char *, char *, bool);
|
||||||
void Curl_cookie_freelist(struct Cookie *);
|
void Curl_cookie_freelist(struct Cookie *);
|
||||||
void Curl_cookie_cleanup(struct CookieInfo *);
|
void Curl_cookie_cleanup(struct CookieInfo *);
|
||||||
|
@ -319,7 +319,8 @@ CURL *curl_easy_duphandle(CURL *incurl)
|
|||||||
if(data->cookies)
|
if(data->cookies)
|
||||||
/* If cookies are enabled in the parent handle, we enable them
|
/* If cookies are enabled in the parent handle, we enable them
|
||||||
in the clone as well! */
|
in the clone as well! */
|
||||||
outcurl->cookies = Curl_cookie_init(data->cookies->filename,
|
outcurl->cookies = Curl_cookie_init(data,
|
||||||
|
data->cookies->filename,
|
||||||
outcurl->cookies,
|
outcurl->cookies,
|
||||||
data->set.cookiesession);
|
data->set.cookiesession);
|
||||||
|
|
||||||
|
@ -132,8 +132,8 @@ void curl_slist_free_all(struct curl_slist *list)
|
|||||||
|
|
||||||
void Curl_infof(struct SessionHandle *data, const char *fmt, ...)
|
void Curl_infof(struct SessionHandle *data, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
if(data && data->set.verbose) {
|
||||||
if(data->set.verbose) {
|
va_list ap;
|
||||||
char print_buffer[1024 + 1];
|
char print_buffer[1024 + 1];
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vsnprintf(print_buffer, 1024, fmt, ap);
|
vsnprintf(print_buffer, 1024, fmt, ap);
|
||||||
|
@ -79,7 +79,7 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
|
|||||||
|
|
||||||
case CURL_LOCK_DATA_COOKIE:
|
case CURL_LOCK_DATA_COOKIE:
|
||||||
if (!share->cookies) {
|
if (!share->cookies) {
|
||||||
share->cookies = Curl_cookie_init( NULL, NULL, TRUE );
|
share->cookies = Curl_cookie_init(NULL, NULL, NULL, TRUE );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -709,7 +709,8 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
|||||||
checkprefix("Set-Cookie:", k->p)) {
|
checkprefix("Set-Cookie:", k->p)) {
|
||||||
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE,
|
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE,
|
||||||
CURL_LOCK_ACCESS_SINGLE);
|
CURL_LOCK_ACCESS_SINGLE);
|
||||||
Curl_cookie_add(data->cookies, TRUE, k->p+11,
|
Curl_cookie_add(data,
|
||||||
|
data->cookies, TRUE, k->p+11,
|
||||||
/* If there is a custom-set Host: name, use it
|
/* If there is a custom-set Host: name, use it
|
||||||
here, or else use real peer host name. */
|
here, or else use real peer host name. */
|
||||||
conn->allocptr.cookiehost?
|
conn->allocptr.cookiehost?
|
||||||
@ -1514,7 +1515,8 @@ CURLcode Curl_pretransfer(struct SessionHandle *data)
|
|||||||
struct curl_slist *list = data->change.cookielist;
|
struct curl_slist *list = data->change.cookielist;
|
||||||
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
|
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
|
||||||
while(list) {
|
while(list) {
|
||||||
data->cookies = Curl_cookie_init(list->data,
|
data->cookies = Curl_cookie_init(data,
|
||||||
|
list->data,
|
||||||
data->cookies,
|
data->cookies,
|
||||||
data->set.cookiesession);
|
data->set.cookiesession);
|
||||||
list = list->next;
|
list = list->next;
|
||||||
|
@ -617,7 +617,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
|
|||||||
* Activate the cookie parser. This may or may not already
|
* Activate the cookie parser. This may or may not already
|
||||||
* have been made.
|
* have been made.
|
||||||
*/
|
*/
|
||||||
data->cookies = Curl_cookie_init(NULL, data->cookies,
|
data->cookies = Curl_cookie_init(data, NULL, data->cookies,
|
||||||
data->set.cookiesession);
|
data->set.cookiesession);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@ -1210,7 +1210,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
|
|||||||
|
|
||||||
/* check cookie list is set */
|
/* check cookie list is set */
|
||||||
if(!data->cookies)
|
if(!data->cookies)
|
||||||
data->cookies = Curl_cookie_init( NULL, NULL, TRUE );
|
data->cookies = Curl_cookie_init(data, NULL, NULL, TRUE );
|
||||||
|
|
||||||
/* check for host cache not needed,
|
/* check for host cache not needed,
|
||||||
* it will be done by curl_easy_perform */
|
* it will be done by curl_easy_perform */
|
||||||
|
Loading…
Reference in New Issue
Block a user