OLD | NEW |
---|---|
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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
364 if (domain_.compare(1, std::string::npos, host) == 0) | 364 if (domain_.compare(1, std::string::npos, host) == 0) |
365 return true; | 365 return true; |
366 | 366 |
367 // A pure suffix of the host (ok since we know the domain already | 367 // A pure suffix of the host (ok since we know the domain already |
368 // starts with a ".") | 368 // starts with a ".") |
369 return (host.length() > domain_.length() && | 369 return (host.length() > domain_.length() && |
370 host.compare(host.length() - domain_.length(), | 370 host.compare(host.length() - domain_.length(), |
371 domain_.length(), domain_) == 0); | 371 domain_.length(), domain_) == 0); |
372 } | 372 } |
373 | 373 |
374 bool CanonicalCookie::IncludeForRequestURL(const GURL& url, | |
375 const CookieOptions& options) const { | |
376 // Filter out HttpOnly cookies, per options. | |
377 if (options.exclude_httponly() && IsHttpOnly()) | |
378 return false; | |
379 // Secure cookies should not be included in requests for URLs with an | |
380 // unsecure scheme. | |
erikwright (departed)
2012/12/05 19:43:36
unsecure -> insecure
markusheintz_
2012/12/06 10:10:43
Done.
| |
381 if (IsSecure() && !url.SchemeIsSecure()) | |
382 return false; | |
383 // Don't include cookies for requests that don't apply to the cookie domain. | |
384 if (!IsDomainMatch(url.host())) | |
385 return false; | |
386 // Don't include cookies for requests that | |
erikwright (departed)
2012/12/05 19:43:36
incomplete comment.
markusheintz_
2012/12/06 10:10:43
Done.
| |
387 if (!IsOnPath(url.path())) | |
388 return false; | |
389 | |
390 return true; | |
391 } | |
392 | |
374 std::string CanonicalCookie::DebugString() const { | 393 std::string CanonicalCookie::DebugString() const { |
375 return base::StringPrintf( | 394 return base::StringPrintf( |
376 "name: %s value: %s domain: %s path: %s creation: %" | 395 "name: %s value: %s domain: %s path: %s creation: %" |
377 PRId64, | 396 PRId64, |
378 name_.c_str(), value_.c_str(), | 397 name_.c_str(), value_.c_str(), |
379 domain_.c_str(), path_.c_str(), | 398 domain_.c_str(), path_.c_str(), |
380 static_cast<int64>(creation_date_.ToTimeT())); | 399 static_cast<int64>(creation_date_.ToTimeT())); |
381 } | 400 } |
382 | 401 |
383 } // namespace net | 402 } // namespace net |
OLD | NEW |