urldata: move the cookefilelist to the 'set' struct

The cookiefile entries are set into the handle and should remain set for
the lifetime of the handle so that duplicating it also duplicates the
list. Therefore, the struct field is moved from 'state' to 'set'.

Fixes #10133
Closes #10134
This commit is contained in:
Daniel Stenberg 2022-12-22 13:09:16 +01:00
parent e4505a1915
commit af5999a674
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
7 changed files with 24 additions and 37 deletions

View file

@ -760,18 +760,18 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
return CURLE_BAD_FUNCTION_ARGUMENT;
/* append the cookie file name to the list of file names, and deal with
them later */
cl = curl_slist_append(data->state.cookielist, argptr);
cl = curl_slist_append(data->set.cookielist, argptr);
if(!cl) {
curl_slist_free_all(data->state.cookielist);
data->state.cookielist = NULL;
curl_slist_free_all(data->set.cookielist);
data->set.cookielist = NULL;
return CURLE_OUT_OF_MEMORY;
}
data->state.cookielist = cl; /* store the list for later use */
data->set.cookielist = cl; /* store the list for later use */
}
else {
/* clear the list of cookie files */
curl_slist_free_all(data->state.cookielist);
data->state.cookielist = NULL;
curl_slist_free_all(data->set.cookielist);
data->set.cookielist = NULL;
if(!data->share || !data->share->cookies) {
/* throw away all existing cookies if this isn't a shared cookie