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

Unified Diff: net/base/cookie_monster.cc

Issue 18657: Support domain=IPADDR if it matches the url ip address exactly. (Closed)
Patch Set: Created 11 years, 11 months 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 | « no previous file | net/base/cookie_monster_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | net/base/cookie_monster_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698