| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/base/sdch_dictionary.h" | 5 #include "net/base/sdch_dictionary.h" |
| 6 | 6 |
| 7 #include "base/time/clock.h" | 7 #include "base/time/clock.h" |
| 8 #include "base/time/default_clock.h" | 8 #include "base/time/default_clock.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 10 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 */ | 121 */ |
| 122 if (!DomainMatch(target_url, domain_)) | 122 if (!DomainMatch(target_url, domain_)) |
| 123 return SDCH_DICTIONARY_FOUND_HAS_WRONG_DOMAIN; | 123 return SDCH_DICTIONARY_FOUND_HAS_WRONG_DOMAIN; |
| 124 | 124 |
| 125 if (!ports_.empty() && 0 == ports_.count(target_url.EffectiveIntPort())) | 125 if (!ports_.empty() && 0 == ports_.count(target_url.EffectiveIntPort())) |
| 126 return SDCH_DICTIONARY_FOUND_HAS_WRONG_PORT_LIST; | 126 return SDCH_DICTIONARY_FOUND_HAS_WRONG_PORT_LIST; |
| 127 | 127 |
| 128 if (path_.size() && !PathMatch(target_url.path(), path_)) | 128 if (path_.size() && !PathMatch(target_url.path(), path_)) |
| 129 return SDCH_DICTIONARY_FOUND_HAS_WRONG_PATH; | 129 return SDCH_DICTIONARY_FOUND_HAS_WRONG_PATH; |
| 130 | 130 |
| 131 if (target_url.SchemeIsSecure() != url_.SchemeIsSecure()) | 131 if (target_url.SchemeIsCryptographic() != url_.SchemeIsCryptographic()) |
| 132 return SDCH_DICTIONARY_FOUND_HAS_WRONG_SCHEME; | 132 return SDCH_DICTIONARY_FOUND_HAS_WRONG_SCHEME; |
| 133 | 133 |
| 134 // TODO(jar): Remove overly restrictive failsafe test (added per security | 134 // TODO(jar): Remove overly restrictive failsafe test (added per security |
| 135 // review) when we have a need to be more general. | 135 // review) when we have a need to be more general. |
| 136 if (!target_url.SchemeIsHTTPOrHTTPS()) | 136 if (!target_url.SchemeIsHTTPOrHTTPS()) |
| 137 return SDCH_ATTEMPT_TO_DECODE_NON_HTTP_DATA; | 137 return SDCH_ATTEMPT_TO_DECODE_NON_HTTP_DATA; |
| 138 | 138 |
| 139 return SDCH_OK; | 139 return SDCH_OK; |
| 140 } | 140 } |
| 141 | 141 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 155 if (0 != path.compare(0, prefix_length, restriction)) | 155 if (0 != path.compare(0, prefix_length, restriction)) |
| 156 return false; | 156 return false; |
| 157 return restriction[prefix_length - 1] == '/' || path[prefix_length] == '/'; | 157 return restriction[prefix_length - 1] == '/' || path[prefix_length] == '/'; |
| 158 } | 158 } |
| 159 | 159 |
| 160 bool SdchDictionary::Expired() const { | 160 bool SdchDictionary::Expired() const { |
| 161 return base::Time::Now() > expiration_; | 161 return base::Time::Now() > expiration_; |
| 162 } | 162 } |
| 163 | 163 |
| 164 } // namespace net | 164 } // namespace net |
| OLD | NEW |