| 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 #include "net/cookies/cookie_util.h" | 5 #include "net/cookies/cookie_util.h" |
| 6 | 6 |
| 7 #include <cstdio> | 7 #include <cstdio> |
| 8 #include <cstdlib> | 8 #include <cstdlib> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/string_tokenizer.h" | |
| 12 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/strings/string_tokenizer.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 15 #include "net/base/net_util.h" | 15 #include "net/base/net_util.h" |
| 16 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 16 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 namespace cookie_util { | 19 namespace cookie_util { |
| 20 | 20 |
| 21 bool DomainIsHostOnly(const std::string& domain_string) { | 21 bool DomainIsHostOnly(const std::string& domain_string) { |
| 22 return (domain_string.empty() || domain_string[0] != '.'); | 22 return (domain_string.empty() || domain_string[0] != '.'); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // characters as a delimiter. We can't treat : as a delimiter, because it | 96 // characters as a delimiter. We can't treat : as a delimiter, because it |
| 97 // is the delimiter for hh:mm:ss, and we want to keep this field together. | 97 // is the delimiter for hh:mm:ss, and we want to keep this field together. |
| 98 // We make sure to include - and +, since they could prefix numbers. | 98 // We make sure to include - and +, since they could prefix numbers. |
| 99 // If the cookie attribute came in in quotes (ex expires="XXX"), the quotes | 99 // If the cookie attribute came in in quotes (ex expires="XXX"), the quotes |
| 100 // will be preserved, and we will get them here. So we make sure to include | 100 // will be preserved, and we will get them here. So we make sure to include |
| 101 // quote characters, and also \ for anything that was internally escaped. | 101 // quote characters, and also \ for anything that was internally escaped. |
| 102 static const char* kDelimiters = "\t !\"#$%&'()*+,-./;<=>?@[\\]^_`{|}~"; | 102 static const char* kDelimiters = "\t !\"#$%&'()*+,-./;<=>?@[\\]^_`{|}~"; |
| 103 | 103 |
| 104 base::Time::Exploded exploded = {0}; | 104 base::Time::Exploded exploded = {0}; |
| 105 | 105 |
| 106 StringTokenizer tokenizer(time_string, kDelimiters); | 106 base::StringTokenizer tokenizer(time_string, kDelimiters); |
| 107 | 107 |
| 108 bool found_day_of_month = false; | 108 bool found_day_of_month = false; |
| 109 bool found_month = false; | 109 bool found_month = false; |
| 110 bool found_time = false; | 110 bool found_time = false; |
| 111 bool found_year = false; | 111 bool found_year = false; |
| 112 | 112 |
| 113 while (tokenizer.GetNext()) { | 113 while (tokenizer.GetNext()) { |
| 114 const std::string token = tokenizer.token(); | 114 const std::string token = tokenizer.token(); |
| 115 DCHECK(!token.empty()); | 115 DCHECK(!token.empty()); |
| 116 bool numerical = IsAsciiDigit(token[0]); | 116 bool numerical = IsAsciiDigit(token[0]); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // One of our values was out of expected range. For well-formed input, | 194 // One of our values was out of expected range. For well-formed input, |
| 195 // the following check would be reasonable: | 195 // the following check would be reasonable: |
| 196 // NOTREACHED() << "Cookie exploded expiration failed: " << time_string; | 196 // NOTREACHED() << "Cookie exploded expiration failed: " << time_string; |
| 197 | 197 |
| 198 return base::Time(); | 198 return base::Time(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 } // namespace cookie_utils | 201 } // namespace cookie_utils |
| 202 } // namespace net | 202 } // namespace net |
| 203 | 203 |
| OLD | NEW |