mirror of
https://github.com/curl/curl.git
synced 2026-08-25 06:23:30 +03:00
cookies: same domain handling changed to match browser behavior
Cokie with the same domain but different tailmatching property are now considered different and do not replace each other. If header contains following lines then two cookies will be set: Set-Cookie: foo=bar; domain=.foo.com; expires=Thu Mar 3 GMT 8:56:27 2033 Set-Cookie: foo=baz; domain=foo.com; expires=Thu Mar 3 GMT 8:56:27 2033 This matches Chrome, Opera, Safari, and Firefox behavior. When sending stored tokens to foo.com Chrome, Opera, Firefox store send them in the stored order, while Safari pre-sort the cookies. Closes #1050
This commit is contained in:
parent
2a1d538963
commit
54e48b14e1
2 changed files with 34 additions and 23 deletions
|
|
@ -817,7 +817,8 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||
/* the names are identical */
|
||||
|
||||
if(clist->domain && co->domain) {
|
||||
if(Curl_raw_equal(clist->domain, co->domain))
|
||||
if(Curl_raw_equal(clist->domain, co->domain) &&
|
||||
(clist->tailmatch == co->tailmatch))
|
||||
/* The domains are identical */
|
||||
replace_old=TRUE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue