cookie: remove expired cookies before listing

Closes #18299
This commit is contained in:
xfangfang 2025-08-16 18:15:42 +08:00 committed by Daniel Stenberg
parent a5f0ab7995
commit de89b86046
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -1615,6 +1615,9 @@ static struct curl_slist *cookie_list(struct Curl_easy *data)
if(!data->cookies || (data->cookies->numcookies == 0))
return NULL;
/* at first, remove expired cookies */
remove_expired(data->cookies);
for(i = 0; i < COOKIE_HASH_SIZE; i++) {
for(n = Curl_llist_head(&data->cookies->cookielist[i]); n;
n = Curl_node_next(n)) {