aboutsummaryrefslogtreecommitdiff
path: root/lib/cookie.c
diff options
context:
space:
mode:
authorSergei Kuzmin <sergeikuzmin@gmail.com>2016-10-02 21:34:59 -0700
committerDaniel Stenberg <daniel@haxx.se>2016-10-03 16:49:35 +0200
commit54e48b14e1ecf399149b137bb741cf84a73b1f32 (patch)
treef16031e237366916571cc986d38025b1b9135902 /lib/cookie.c
parent2a1d538963c5861d729eea2b4bb271fad03217d1 (diff)
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
Diffstat (limited to 'lib/cookie.c')
-rw-r--r--lib/cookie.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/cookie.c b/lib/cookie.c
index d5a83fd66..0f05da200 100644
--- a/lib/cookie.c
+++ b/lib/cookie.c
@@ -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;
}