summaryrefslogtreecommitdiff
path: root/lib/cookie.c
diff options
context:
space:
mode:
authorTim Rühsen <tim.ruehsen@gmx.de>2016-03-02 11:07:16 +0100
committerKamil Dudka <kdudka@redhat.com>2016-03-08 15:27:43 +0100
commitc140bd7891488993f09ff7454e106b724e9b85d5 (patch)
tree02c9d59302ffe99059a2ff46283144792b6b7108 /lib/cookie.c
parentcb222bcfef3d95e1fb04ca85b2e82e62bb92dfd3 (diff)
downloadcurl-c140bd7891488993f09ff7454e106b724e9b85d5.tar.gz
cookie: do not refuse cookies for localhost
Closes #658
Diffstat (limited to 'lib/cookie.c')
-rw-r--r--lib/cookie.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/cookie.c b/lib/cookie.c
index 558b6a7f2..de871b75e 100644
--- a/lib/cookie.c
+++ b/lib/cookie.c
@@ -797,10 +797,12 @@ Curl_cookie_add(struct SessionHandle *data,
#ifdef USE_LIBPSL
/* Check if the domain is a Public Suffix and if yes, ignore the cookie.
This needs a libpsl compiled with builtin data. */
- if(co->domain && !isip(co->domain) && (psl = psl_builtin()) != NULL) {
- if(psl_is_public_suffix(psl, co->domain)) {
- infof(data, "cookie '%s' dropped, domain '%s' is a public suffix\n",
- co->name, co->domain);
+ if(domain && co->domain && !isip(co->domain)) {
+ if(((psl = psl_builtin()) != NULL)
+ && !psl_is_cookie_domain_acceptable(psl, domain, co->domain)) {
+ infof(data,
+ "cookie '%s' dropped, domain '%s' must not set cookies for '%s'\n",
+ co->name, domain, co->domain);
freecookie(co);
return NULL;
}