summaryrefslogtreecommitdiffstats
path: root/net/base/cookie_monster.cc
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-04 17:38:20 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-04 17:38:20 +0000
commitbfcaed4a2f6a8ec579f26ea0f072b0dcc909ffda (patch)
tree9a5d15a664b9e28427a9a6ff1c4edac96714ff3b /net/base/cookie_monster.cc
parent6015b89218a24dba57f0c3f20aff861da0af083e (diff)
downloadchromium_src-bfcaed4a2f6a8ec579f26ea0f072b0dcc909ffda.zip
chromium_src-bfcaed4a2f6a8ec579f26ea0f072b0dcc909ffda.tar.gz
chromium_src-bfcaed4a2f6a8ec579f26ea0f072b0dcc909ffda.tar.bz2
Add path filtering into the GetAllCookiesForURL.
Review URL: http://codereview.chromium.org/573011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38112 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/cookie_monster.cc')
-rw-r--r--net/base/cookie_monster.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc
index 805bfc1..6cda7e5 100644
--- a/net/base/cookie_monster.cc
+++ b/net/base/cookie_monster.cc
@@ -810,7 +810,7 @@ CookieMonster::CookieList CookieMonster::GetAllCookiesForURL(const GURL& url) {
// Query for the full host, For example: 'a.c.blah.com'.
std::string key(url.host());
- FindRawCookies(key, secure, &cookie_list);
+ FindRawCookies(key, secure, url.path(), &cookie_list);
// See if we can search for domain cookies, i.e. if the host has a TLD + 1.
const std::string domain(GetEffectiveDomain(url.scheme(), key));
@@ -822,7 +822,7 @@ CookieMonster::CookieList CookieMonster::GetAllCookiesForURL(const GURL& url) {
DCHECK_EQ(0, key.compare(key.length() - domain.length(), domain.length(),
domain));
for (key = "." + key; key.length() > domain.length(); ) {
- FindRawCookies(key, secure, &cookie_list);
+ FindRawCookies(key, secure, url.path(), &cookie_list);
const size_t next_dot = key.find('.', 1); // Skip over leading dot.
key.erase(0, next_dot);
}
@@ -902,12 +902,16 @@ void CookieMonster::FindCookiesForKey(
void CookieMonster::FindRawCookies(const std::string& key,
bool include_secure,
+ const std::string& path,
CookieList* list) {
for (CookieMapItPair its = cookies_.equal_range(key);
its.first != its.second; ++its.first) {
CanonicalCookie* cc = its.first->second;
- if (include_secure || !cc->IsSecure())
- list->push_back(CookieListPair(key, *cc));
+ if (!include_secure && cc->IsSecure())
+ continue;
+ if (!cc->IsOnPath(path))
+ continue;
+ list->push_back(CookieListPair(key, *cc));
}
}