Peteris Krumins added CURLOPT_COOKIELIST and CURLINFO_COOKIELIST, which is a

simple interface to extracting and setting cookies in libcurl's internal
"cookie jar". See the new cookie_interface.c example code.
This commit is contained in:
Daniel Stenberg 2005-07-27 22:17:14 +00:00
parent 463c0f7096
commit 2236ba0d20
12 changed files with 252 additions and 23 deletions

View file

@ -773,6 +773,37 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
*/
data->set.cookiesession = (bool)va_arg(param, long);
break;
case CURLOPT_COOKIELIST:
argptr = va_arg(param, char *);
if (argptr == NULL)
break;
if (strequal(argptr, "ALL")) {
if (data->cookies == NULL) {
break;
}
else {
/* clear all cookies */
Curl_cookie_freelist(data->cookies->cookies);
data->cookies->cookies = NULL;
break;
}
}
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))
/* 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);
break;
#endif /* CURL_DISABLE_COOKIES */
case CURLOPT_HTTPGET: