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

Side by Side Diff: net/cookies/canonical_cookie.cc

Issue 2103863003: Make CanonicalCookie::Source() private. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@source
Patch Set: Merge Created 4 years, 5 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Portions of this code based on Mozilla: 5 // Portions of this code based on Mozilla:
6 // (netwerk/cookie/src/nsCookieService.cpp) 6 // (netwerk/cookie/src/nsCookieService.cpp)
7 /* ***** BEGIN LICENSE BLOCK ***** 7 /* ***** BEGIN LICENSE BLOCK *****
8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
9 * 9 *
10 * The contents of this file are subject to the Mozilla Public License Version 10 * The contents of this file are subject to the Mozilla Public License Version
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 212
213 std::string cookie_domain; 213 std::string cookie_domain;
214 if (!GetCookieDomain(url, parsed_cookie, &cookie_domain)) { 214 if (!GetCookieDomain(url, parsed_cookie, &cookie_domain)) {
215 VLOG(kVlogSetCookies) << "Create() failed to get a cookie domain"; 215 VLOG(kVlogSetCookies) << "Create() failed to get a cookie domain";
216 return nullptr; 216 return nullptr;
217 } 217 }
218 218
219 // Per 3.2.1 of "Deprecate modification of 'secure' cookies from non-secure 219 // Per 3.2.1 of "Deprecate modification of 'secure' cookies from non-secure
220 // origins", if the cookie's "secure-only-flag" is "true" and the requesting 220 // origins", if the cookie's "secure-only-flag" is "true" and the requesting
221 // URL does not have a secure scheme, the cookie should be thrown away. 221 // URL does not have a secure scheme, the cookie should be thrown away.
222 // https://tools.ietf.org/html/draft-west-leave-secure-cookies-alone 222 // https://tools.ietf.org/html/draft-ietf-httpbis-cookie-alone
223 if (options.enforce_strict_secure() && parsed_cookie.IsSecure() && 223 if (options.enforce_strict_secure() && parsed_cookie.IsSecure() &&
224 !url.SchemeIsCryptographic()) { 224 !url.SchemeIsCryptographic()) {
225 VLOG(kVlogSetCookies) 225 VLOG(kVlogSetCookies)
226 << "Create() is trying to create a secure cookie from an insecure URL"; 226 << "Create() is trying to create a secure cookie from an insecure URL";
227 return nullptr; 227 return nullptr;
228 } 228 }
229 229
230 std::string cookie_path = CanonicalCookie::CanonPath(url, parsed_cookie); 230 std::string cookie_path = CanonicalCookie::CanonPath(url, parsed_cookie);
231 Time server_time(creation_time); 231 Time server_time(creation_time);
232 if (options.has_server_time()) 232 if (options.has_server_time())
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 if (prefix == CanonicalCookie::COOKIE_PREFIX_SECURE) 512 if (prefix == CanonicalCookie::COOKIE_PREFIX_SECURE)
513 return parsed_cookie.IsSecure() && url.SchemeIsCryptographic(); 513 return parsed_cookie.IsSecure() && url.SchemeIsCryptographic();
514 if (prefix == CanonicalCookie::COOKIE_PREFIX_HOST) { 514 if (prefix == CanonicalCookie::COOKIE_PREFIX_HOST) {
515 return parsed_cookie.IsSecure() && url.SchemeIsCryptographic() && 515 return parsed_cookie.IsSecure() && url.SchemeIsCryptographic() &&
516 !parsed_cookie.HasDomain() && parsed_cookie.Path() == "/"; 516 !parsed_cookie.HasDomain() && parsed_cookie.Path() == "/";
517 } 517 }
518 return true; 518 return true;
519 } 519 }
520 520
521 } // namespace net 521 } // namespace net
OLDNEW
« 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