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) |