aboutsummaryrefslogtreecommitdiff
path: root/lib/cookie.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cookie.c')
-rw-r--r--lib/cookie.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/cookie.c b/lib/cookie.c
index b24aaf718..44851a52f 100644
--- a/lib/cookie.c
+++ b/lib/cookie.c
@@ -816,8 +816,6 @@ Curl_cookie_add(struct Curl_easy *data,
co->domain = strdup(ptr);
if(!co->domain)
badcookie = TRUE;
- else if(bad_domain(co->domain))
- badcookie = TRUE;
break;
case 1:
/* This field got its explanation on the 23rd of May 2001 by
@@ -946,20 +944,18 @@ Curl_cookie_add(struct Curl_easy *data,
if(!noexpire)
remove_expired(c);
- if(domain && co->domain && !isip(co->domain)) {
- int acceptable;
#ifdef USE_LIBPSL
+ /* Check if the domain is a Public Suffix and if yes, ignore the cookie. */
+ if(domain && co->domain && !isip(co->domain)) {
const psl_ctx_t *psl = Curl_psl_use(data);
+ int acceptable;
- /* Check if the domain is a Public Suffix and if yes, ignore the cookie. */
if(psl) {
acceptable = psl_is_cookie_domain_acceptable(psl, domain, co->domain);
Curl_psl_release(data);
}
else
-#endif
- /* Without libpsl, do the best we can. */
- acceptable = !bad_domain(co->domain);
+ acceptable = !bad_domain(domain);
if(!acceptable) {
infof(data, "cookie '%s' dropped, domain '%s' must not "
@@ -968,6 +964,7 @@ Curl_cookie_add(struct Curl_easy *data,
return NULL;
}
}
+#endif
myhash = cookiehash(co->domain);
clist = c->cookies[myhash];