| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 return true; | 278 return true; |
| 279 } | 279 } |
| 280 | 280 |
| 281 // Get the normalized domain specified in cookie line. | 281 // Get the normalized domain specified in cookie line. |
| 282 // Note: The RFC says we can reject a cookie if the domain | 282 // Note: The RFC says we can reject a cookie if the domain |
| 283 // attribute does not start with a dot. IE/FF/Safari however, allow a cookie | 283 // attribute does not start with a dot. IE/FF/Safari however, allow a cookie |
| 284 // of the form domain=my.domain.com, treating it the same as | 284 // of the form domain=my.domain.com, treating it the same as |
| 285 // domain=.my.domain.com -- for compatibility we do the same here. Firefox | 285 // domain=.my.domain.com -- for compatibility we do the same here. Firefox |
| 286 // also treats domain=.....my.domain.com like domain=.my.domain.com, but | 286 // also treats domain=.....my.domain.com like domain=.my.domain.com, but |
| 287 // neither IE nor Safari do this, and we don't either. | 287 // neither IE nor Safari do this, and we don't either. |
| 288 std::string cookie_domain(net::CanonicalizeHost(pc.Domain(), NULL)); | 288 url_canon::CanonHostInfo ignored; |
| 289 std::string cookie_domain(net::CanonicalizeHost(pc.Domain(), &ignored)); |
| 289 if (cookie_domain.empty()) | 290 if (cookie_domain.empty()) |
| 290 return false; | 291 return false; |
| 291 if (cookie_domain[0] != '.') | 292 if (cookie_domain[0] != '.') |
| 292 cookie_domain = "." + cookie_domain; | 293 cookie_domain = "." + cookie_domain; |
| 293 | 294 |
| 294 // Ensure |url| and |cookie_domain| have the same domain+registry. | 295 // Ensure |url| and |cookie_domain| have the same domain+registry. |
| 295 const std::string url_domain_and_registry( | 296 const std::string url_domain_and_registry( |
| 296 RegistryControlledDomainService::GetDomainAndRegistry(url)); | 297 RegistryControlledDomainService::GetDomainAndRegistry(url)); |
| 297 if (url_domain_and_registry.empty()) | 298 if (url_domain_and_registry.empty()) |
| 298 return false; // IP addresses/intranet hosts can't set domain cookies. | 299 return false; // IP addresses/intranet hosts can't set domain cookies. |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 return true; | 1123 return true; |
| 1123 } | 1124 } |
| 1124 | 1125 |
| 1125 std::string CookieMonster::CanonicalCookie::DebugString() const { | 1126 std::string CookieMonster::CanonicalCookie::DebugString() const { |
| 1126 return StringPrintf("name: %s value: %s path: %s creation: %llu", | 1127 return StringPrintf("name: %s value: %s path: %s creation: %llu", |
| 1127 name_.c_str(), value_.c_str(), path_.c_str(), | 1128 name_.c_str(), value_.c_str(), path_.c_str(), |
| 1128 creation_date_.ToTimeT()); | 1129 creation_date_.ToTimeT()); |
| 1129 } | 1130 } |
| 1130 | 1131 |
| 1131 } // namespace | 1132 } // namespace |
| OLD | NEW |