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

Unified Diff: net/cookies/canonical_cookie.cc

Issue 11308272: Add IncludeForRequestURL method to CanonicalCookie (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 8 years 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/canonical_cookie.h ('k') | net/cookies/canonical_cookie_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cookies/canonical_cookie.cc
diff --git a/net/cookies/canonical_cookie.cc b/net/cookies/canonical_cookie.cc
index 83e0e6023f753015bea039c253ddee8d88d5495e..4b864dbc520835fe01653afd40f86ef100547d56 100644
--- a/net/cookies/canonical_cookie.cc
+++ b/net/cookies/canonical_cookie.cc
@@ -371,6 +371,26 @@ bool CanonicalCookie::IsDomainMatch(const std::string& host) const {
domain_.length(), domain_) == 0);
}
+bool CanonicalCookie::IncludeForRequestURL(const GURL& url,
+ const CookieOptions& options) const {
+ // Filter out HttpOnly cookies, per options.
+ if (options.exclude_httponly() && IsHttpOnly())
+ return false;
+ // Secure cookies should not be included in requests for URLs with an
+ // insecure scheme.
+ if (IsSecure() && !url.SchemeIsSecure())
+ return false;
+ // Don't include cookies for requests that don't apply to the cookie domain.
+ if (!IsDomainMatch(url.host()))
+ return false;
+ // Don't include cookies for requests with a url path that does not path
+ // match the cookie-path.
+ if (!IsOnPath(url.path()))
+ return false;
+
+ return true;
+}
+
std::string CanonicalCookie::DebugString() const {
return base::StringPrintf(
"name: %s value: %s domain: %s path: %s creation: %"
« no previous file with comments | « net/cookies/canonical_cookie.h ('k') | net/cookies/canonical_cookie_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698