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

@ -913,11 +913,9 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)
goto fail;
}
/* duplicate all values in 'change' */
if(data->state.cookielist) {
outcurl->state.cookielist =
Curl_slist_duplicate(data->state.cookielist);
if(!outcurl->state.cookielist)
if(data->set.cookielist) {
outcurl->set.cookielist = Curl_slist_duplicate(data->set.cookielist);
if(!outcurl->set.cookielist)
goto fail;
}
#endif
@ -1003,8 +1001,8 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)
if(outcurl) {
#ifndef CURL_DISABLE_COOKIES
curl_slist_free_all(outcurl->state.cookielist);
outcurl->state.cookielist = NULL;
curl_slist_free_all(outcurl->set.cookielist);
outcurl->set.cookielist = NULL;
#endif
Curl_safefree(outcurl->state.buffer);
Curl_dyn_free(&outcurl->state.headerb);