now strdups the cookielist inpointer before passed on, as the cookie function
modifies it
This commit is contained in:
parent
1c388a52a5
commit
ec3f269d1f
15
lib/url.c
15
lib/url.c
@ -784,21 +784,24 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
if(strequal(argptr, "ALL")) {
|
if(strequal(argptr, "ALL")) {
|
||||||
if (data->cookies == NULL) {
|
if(data->cookies) {
|
||||||
break;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* clear all cookies */
|
/* clear all cookies */
|
||||||
Curl_cookie_freelist(data->cookies->cookies);
|
Curl_cookie_freelist(data->cookies->cookies);
|
||||||
data->cookies->cookies = NULL;
|
data->cookies->cookies = NULL;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!data->cookies)
|
if(!data->cookies)
|
||||||
/* if cookie engine was not running, activate it */
|
/* if cookie engine was not running, activate it */
|
||||||
data->cookies = Curl_cookie_init(data, NULL, NULL, TRUE);
|
data->cookies = Curl_cookie_init(data, NULL, NULL, TRUE);
|
||||||
|
|
||||||
|
argptr = strdup(argptr);
|
||||||
|
if(!argptr) {
|
||||||
|
result = CURLE_OUT_OF_MEMORY;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if(checkprefix("Set-Cookie:", argptr))
|
if(checkprefix("Set-Cookie:", argptr))
|
||||||
/* HTTP Header format line */
|
/* HTTP Header format line */
|
||||||
Curl_cookie_add(data, data->cookies, TRUE, argptr + 11, NULL, NULL);
|
Curl_cookie_add(data, data->cookies, TRUE, argptr + 11, NULL, NULL);
|
||||||
@ -806,6 +809,8 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
|||||||
else
|
else
|
||||||
/* Netscape format line */
|
/* Netscape format line */
|
||||||
Curl_cookie_add(data, data->cookies, FALSE, argptr, NULL, NULL);
|
Curl_cookie_add(data, data->cookies, FALSE, argptr, NULL, NULL);
|
||||||
|
|
||||||
|
free(argptr);
|
||||||
break;
|
break;
|
||||||
#endif /* CURL_DISABLE_COOKIES */
|
#endif /* CURL_DISABLE_COOKIES */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user