mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
now strdups the cookielist inpointer before passed on, as the cookie function
modifies it
This commit is contained in:
parent
1c388a52a5
commit
ec3f269d1f
23
lib/url.c
23
lib/url.c
@ -780,32 +780,37 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
case CURLOPT_COOKIELIST:
|
||||
argptr = va_arg(param, char *);
|
||||
|
||||
if (argptr == NULL)
|
||||
if(argptr == NULL)
|
||||
break;
|
||||
|
||||
if (strequal(argptr, "ALL")) {
|
||||
if (data->cookies == NULL) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
if(strequal(argptr, "ALL")) {
|
||||
if(data->cookies) {
|
||||
/* clear all cookies */
|
||||
Curl_cookie_freelist(data->cookies->cookies);
|
||||
data->cookies->cookies = NULL;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!data->cookies)
|
||||
if(!data->cookies)
|
||||
/* if cookie engine was not running, activate it */
|
||||
data->cookies = Curl_cookie_init(data, NULL, NULL, TRUE);
|
||||
|
||||
if (checkprefix("Set-Cookie:", argptr))
|
||||
argptr = strdup(argptr);
|
||||
if(!argptr) {
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
break;
|
||||
}
|
||||
|
||||
if(checkprefix("Set-Cookie:", argptr))
|
||||
/* HTTP Header format line */
|
||||
Curl_cookie_add(data, data->cookies, TRUE, argptr + 11, NULL, NULL);
|
||||
|
||||
else
|
||||
/* Netscape format line */
|
||||
Curl_cookie_add(data, data->cookies, FALSE, argptr, NULL, NULL);
|
||||
|
||||
free(argptr);
|
||||
break;
|
||||
#endif /* CURL_DISABLE_COOKIES */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user