From: Daniel Stenberg Date: Mon, 20 Oct 2025 09:34:25 +0000 (+0200) Subject: cookie: only count accepted cookies in Curl_cookie_add X-Git-Tag: rc-8_17_0-3~73 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=48df7b29d905314c2c0c3b4b3f949569a490d3aa;p=thirdparty%2Fcurl.git cookie: only count accepted cookies in Curl_cookie_add The counter used to stop accepting cookies after a certain amount has been received in a single response would previously also count some cookies that were not actually accepted as they were discarded after the counter was increased. Starting now, the counter is increased only for cookies that were accepted. Pointed out by ZeroPath Closes #19157 --- diff --git a/lib/cookie.c b/lib/cookie.c index 98c13e6218..9b89b7df70 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -750,7 +750,6 @@ parse_cookie_header(struct Curl_easy *data, if(!co->name) return CERR_BAD; - data->req.setcookies++; return CERR_OK; } @@ -1140,6 +1139,9 @@ Curl_cookie_add(struct Curl_easy *data, if(co->expires && (co->expires < ci->next_expiration)) ci->next_expiration = co->expires; + if(httpheader) + data->req.setcookies++; + return co; fail: freecookie(co);