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

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

Issue 1101173004: Switch remaining functions from SchemeIsSecure() to SchemeIsCryptographic(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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/base/sdch_manager.cc ('k') | net/http/http_auth_controller.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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 180
181 CanonicalCookie::~CanonicalCookie() { 181 CanonicalCookie::~CanonicalCookie() {
182 } 182 }
183 183
184 std::string CanonicalCookie::GetCookieSourceFromURL(const GURL& url) { 184 std::string CanonicalCookie::GetCookieSourceFromURL(const GURL& url) {
185 if (url.SchemeIsFile()) 185 if (url.SchemeIsFile())
186 return url.spec(); 186 return url.spec();
187 187
188 url::Replacements<char> replacements; 188 url::Replacements<char> replacements;
189 replacements.ClearPort(); 189 replacements.ClearPort();
190 if (url.SchemeIsSecure()) 190 if (url.SchemeIsCryptographic())
191 replacements.SetScheme("http", url::Component(0, 4)); 191 replacements.SetScheme("http", url::Component(0, 4));
192 192
193 return url.GetOrigin().ReplaceComponents(replacements).spec(); 193 return url.GetOrigin().ReplaceComponents(replacements).spec();
194 } 194 }
195 195
196 // static 196 // static
197 std::string CanonicalCookie::CanonPath(const GURL& url, 197 std::string CanonicalCookie::CanonPath(const GURL& url,
198 const ParsedCookie& pc) { 198 const ParsedCookie& pc) {
199 std::string path_string; 199 std::string path_string;
200 if (pc.HasPath()) 200 if (pc.HasPath())
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 domain_.length(), domain_) == 0); 388 domain_.length(), domain_) == 0);
389 } 389 }
390 390
391 bool CanonicalCookie::IncludeForRequestURL(const GURL& url, 391 bool CanonicalCookie::IncludeForRequestURL(const GURL& url,
392 const CookieOptions& options) const { 392 const CookieOptions& options) const {
393 // Filter out HttpOnly cookies, per options. 393 // Filter out HttpOnly cookies, per options.
394 if (options.exclude_httponly() && IsHttpOnly()) 394 if (options.exclude_httponly() && IsHttpOnly())
395 return false; 395 return false;
396 // Secure cookies should not be included in requests for URLs with an 396 // Secure cookies should not be included in requests for URLs with an
397 // insecure scheme. 397 // insecure scheme.
398 if (IsSecure() && !url.SchemeIsSecure()) 398 if (IsSecure() && !url.SchemeIsCryptographic())
palmer 2015/04/24 19:55:11 This is a semantic change. It might be a change fr
399 return false; 399 return false;
400 // Don't include cookies for requests that don't apply to the cookie domain. 400 // Don't include cookies for requests that don't apply to the cookie domain.
401 if (!IsDomainMatch(url.host())) 401 if (!IsDomainMatch(url.host()))
402 return false; 402 return false;
403 // Don't include cookies for requests with a url path that does not path 403 // Don't include cookies for requests with a url path that does not path
404 // match the cookie-path. 404 // match the cookie-path.
405 if (!IsOnPath(url.path())) 405 if (!IsOnPath(url.path()))
406 return false; 406 return false;
407 407
408 // Include first-party-only cookies iff |options| tells us to include all of 408 // Include first-party-only cookies iff |options| tells us to include all of
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 if (IsSecure() != other.IsSecure()) 454 if (IsSecure() != other.IsSecure())
455 return IsSecure(); 455 return IsSecure();
456 456
457 if (IsHttpOnly() != other.IsHttpOnly()) 457 if (IsHttpOnly() != other.IsHttpOnly())
458 return IsHttpOnly(); 458 return IsHttpOnly();
459 459
460 return Priority() < other.Priority(); 460 return Priority() < other.Priority();
461 } 461 }
462 462
463 } // namespace net 463 } // namespace net
OLDNEW
« no previous file with comments | « net/base/sdch_manager.cc ('k') | net/http/http_auth_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698