]> granicus.if.org Git - curl/commitdiff
Revert "cookies: extend domain checks to non psl builds"
authorDaniel Stenberg <daniel@haxx.se>
Fri, 8 Mar 2019 15:55:27 +0000 (16:55 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 9 Mar 2019 11:59:20 +0000 (12:59 +0100)
This reverts commit 3773de378d48b06c09931e44dca4d274d0bfdce0.

Regression shipped in 7.64.0
Fixes #3649

lib/cookie.c
tests/data/test8

index b24aaf718c5435274d8bc8cc34dd4a83de8ab826..44851a52f544bc18b99eb1cae5ae8a89fd6f3984 100644 (file)
@@ -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];
index e6d0f500e092aa03baa8e6ca48744441cb0d08f9..2fc19006097f8db5131a3a7bc7f2a236d121a373 100644 (file)
@@ -46,7 +46,6 @@ Set-Cookie: trailingspace    = removed; path=/we/want;
 Set-Cookie: nocookie=yes; path=/WE;
 Set-Cookie: blexp=yesyes; domain=%HOSTIP; domain=%HOSTIP; expiry=totally bad;
 Set-Cookie: partialip=nono; domain=.0.0.1;
-Set-Cookie: chocolate=chip; domain=curl; path=/we/want;
 
 </file>
 <precheck>