]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cookie: treat cookie name case sensitively
authorDaniel Stenberg <daniel@haxx.se>
Wed, 6 Nov 2024 10:26:25 +0000 (11:26 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 6 Nov 2024 12:09:20 +0000 (13:09 +0100)
Extend test 31 to verify

Reported-by: delogicsreal on github
Fixes #15492
Closes #15493

lib/cookie.c
tests/data/test31

index ca8c3c5967ee1d3c1397be3abeb078d168ff67ea..e37d58f1d6e2b34f3343d8a1cdf877344c58eb33 100644 (file)
@@ -989,7 +989,7 @@ replace_existing(struct Curl_easy *data,
   size_t myhash = cookiehash(co->domain);
   for(n = Curl_llist_head(&ci->cookielist[myhash]); n; n = Curl_node_next(n)) {
     struct Cookie *clist = Curl_node_elem(n);
-    if(strcasecompare(clist->name, co->name)) {
+    if(!strcmp(clist->name, co->name)) {
       /* the names are identical */
       bool matching_domains = FALSE;
 
@@ -1029,7 +1029,7 @@ replace_existing(struct Curl_easy *data,
       }
     }
 
-    if(!replace_n && strcasecompare(clist->name, co->name)) {
+    if(!replace_n && !strcmp(clist->name, co->name)) {
       /* the names are identical */
 
       if(clist->domain && co->domain) {
index d9d073996bef25ab162c673c85cf3c3d0806396d..2d411b5cd9308c34e212dedeec4b37373e8be1d5 100644 (file)
@@ -26,6 +26,7 @@ Set-Cookie: blankdomain=sure; domain=; path=/
 %if !hyper
 Set-Cookie: foobar=name; domain=anything.com; path=/ ; secure\r
 Set-Cookie:ismatch=this  ; domain=test31.curl; path=/silly/\r
+Set-Cookie:ISMATCH=this  ; domain=test31.curl; path=/silly/\r
 Set-Cookie: overwrite=this  ; domain=test31.curl; path=/overwrite/\r
 Set-Cookie: overwrite=this2  ; domain=test31.curl; path=/overwrite\r
 Set-Cookie: sec1value=secure1  ; domain=test31.curl; path=/secure1/ ; secure\r
@@ -75,6 +76,7 @@ Set-Cookie: securewithspace=after    ; secure =
 %else
 Set-Cookie: foobar=name; domain=anything.com; path=/ ; secure\r
 Set-Cookie: ismatch=this  ; domain=test31.curl; path=/silly/\r
+Set-Cookie:ISMATCH=this  ; domain=test31.curl; path=/silly/\r
 Set-Cookie: overwrite=this  ; domain=test31.curl; path=/overwrite/\r
 Set-Cookie: overwrite=this2  ; domain=test31.curl; path=/overwrite\r
 Set-Cookie: sec1value=secure1  ; domain=test31.curl; path=/secure1/ ; secure\r
@@ -181,6 +183,7 @@ test31.curl FALSE   /we/want/       FALSE   2118138987      nodomain        value
 #HttpOnly_.test31.curl TRUE    /p2/    FALSE   0       httpo2  value2
 #HttpOnly_.test31.curl TRUE    /p1/    FALSE   0       httpo1  value1
 .test31.curl   TRUE    /overwrite      FALSE   0       overwrite       this2
+.test31.curl   TRUE    /silly/ FALSE   0       ISMATCH this
 .test31.curl   TRUE    /silly/ FALSE   0       ismatch this
 test31.curl    FALSE   /       FALSE   0       blankdomain     sure
 </file>