]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cookie: remove expired cookies before listing
authorxfangfang <2553041586@qq.com>
Sat, 16 Aug 2025 10:15:42 +0000 (18:15 +0800)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 17 Aug 2025 20:25:25 +0000 (22:25 +0200)
Closes #18299

lib/cookie.c

index b72dd99bce9ba2c8b7bb3062a904541cd219358e..99b5e43d648b4e30ec4e4c27c65c52d3be114889 100644 (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)) {