Index: net/base/cookie_monster.cc |
diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc |
index 6d9afcb0330de0fddfa872f38980907049c635fc..288ea0f4c0d2c94a551395e31744348f88183b4b 100644 |
--- a/net/base/cookie_monster.cc |
+++ b/net/base/cookie_monster.cc |
@@ -259,8 +259,12 @@ static bool GetCookieDomainKey(const GURL& url, |
const CookieMonster::ParsedCookie& pc, |
std::string* cookie_domain_key) { |
const std::string url_host(url.host()); |
- if (!pc.HasDomain() || pc.Domain().empty()) { |
- // No domain was specified in cookie -- default to host cookie. |
+ |
+ // If no domain was specified in the cookie, default to a host cookie. |
+ // We match IE/Firefox in allowing a domain=IPADDR if it matches the url |
+ // ip address hostname exactly. It should be treated as a host cookie. |
+ if (!pc.HasDomain() || pc.Domain().empty() || |
+ (url.HostIsIPAddress() && url_host == pc.Domain())) { |
*cookie_domain_key = url_host; |
DCHECK((*cookie_domain_key)[0] != '.'); |
return true; |