cookie jar adjustments

This commit is contained in:
Daniel Stenberg
2001-08-29 09:32:18 +00:00
parent b6526af442
commit a2b6ef3478
4 changed files with 75 additions and 40 deletions

View File

@@ -178,6 +178,10 @@ CURLcode Curl_close(struct UrlData *data)
/* the URL is allocated, free it! */
free(data->url);
if(data->cookiejar)
/* we have a "destination" for all the cookies to get dumped to */
Curl_cookie_output(data->cookies, data->cookiejar);
Curl_cookie_cleanup(data->cookies);
/* free the connection cache */
@@ -488,12 +492,19 @@ CURLcode Curl_setopt(struct UrlData *data, CURLoption option, ...)
case CURLOPT_COOKIEFILE:
/*
* Set cookie file to read and parse.
* Set cookie file to read and parse. Can be used multiple times.
*/
cookiefile = (char *)va_arg(param, void *);
if(cookiefile)
data->cookies = Curl_cookie_init(cookiefile, data->cookies);
break;
case CURLOPT_COOKIEJAR:
/*
* Set cookie file name to dump all cookies to when we're done.
*/
data->cookiejar = cookiefile = (char *)va_arg(param, void *);
break;
case CURLOPT_WRITEHEADER:
/*
* Custom pointer to pass the header write callback function