Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1436)

Unified Diff: net/cookies/cookie_util.cc

Issue 1414603010: Treat exact domain match cookies on public suffixes as host cookies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cookies/cookie_store_unittest.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cookies/cookie_util.cc
diff --git a/net/cookies/cookie_util.cc b/net/cookies/cookie_util.cc
index b9c7e8d601f8ed2e3c4d8b3eb07c8e1d0c5ffdae..4071e6fd380f6482c71f06739fc6615934f995ec 100644
--- a/net/cookies/cookie_util.cc
+++ b/net/cookies/cookie_util.cc
@@ -63,8 +63,19 @@ bool GetCookieDomainWithString(const GURL& url,
const std::string url_scheme(url.scheme());
const std::string url_domain_and_registry(
GetEffectiveDomain(url_scheme, url_host));
- if (url_domain_and_registry.empty())
- return false; // IP addresses/intranet hosts can't set domain cookies.
+ if (url_domain_and_registry.empty()) {
+ // We match IE/Firefox by treating an exact match between the domain
+ // attribute and the request host to be treated as a host cookie.
+ if (url_host == domain_string) {
+ *result = url_host;
+ DCHECK(DomainIsHostOnly(*result));
+ return true;
+ }
+
+ // Otherwise, IP addresses/intranet hosts/public suffixes can't set
+ // domain cookies.
+ return false;
+ }
const std::string cookie_domain_and_registry(
GetEffectiveDomain(url_scheme, cookie_domain));
if (url_domain_and_registry != cookie_domain_and_registry)
« no previous file with comments | « net/cookies/cookie_store_unittest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698