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/base/sdch_manager.h" | 5 #include "net/base/sdch_manager.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 */ | 102 */ |
103 | 103 |
104 // TODO(jar): Redirects in dictionary fetches might plausibly be problematic, | 104 // TODO(jar): Redirects in dictionary fetches might plausibly be problematic, |
105 // and hence the conservative approach is to not allow any redirects (if there | 105 // and hence the conservative approach is to not allow any redirects (if there |
106 // were any... then don't allow the dictionary to be set). | 106 // were any... then don't allow the dictionary to be set). |
107 | 107 |
108 if (domain.empty()) { | 108 if (domain.empty()) { |
109 SdchErrorRecovery(DICTIONARY_MISSING_DOMAIN_SPECIFIER); | 109 SdchErrorRecovery(DICTIONARY_MISSING_DOMAIN_SPECIFIER); |
110 return false; // Domain is required. | 110 return false; // Domain is required. |
111 } | 111 } |
112 if (RegistryControlledDomainService::GetDomainAndRegistry(domain).empty()) { | 112 if (RegistryControlledDomainService::GetDomainAndRegistry( |
| 113 domain, RCDS::EXCLUDE_PRIVATE_REGISTRIES).empty()) { |
113 SdchErrorRecovery(DICTIONARY_SPECIFIES_TOP_LEVEL_DOMAIN); | 114 SdchErrorRecovery(DICTIONARY_SPECIFIES_TOP_LEVEL_DOMAIN); |
114 return false; // domain was a TLD. | 115 return false; // domain was a TLD. |
115 } | 116 } |
116 if (!Dictionary::DomainMatch(dictionary_url, domain)) { | 117 if (!Dictionary::DomainMatch(dictionary_url, domain)) { |
117 SdchErrorRecovery(DICTIONARY_DOMAIN_NOT_MATCHING_SOURCE_URL); | 118 SdchErrorRecovery(DICTIONARY_DOMAIN_NOT_MATCHING_SOURCE_URL); |
118 return false; | 119 return false; |
119 } | 120 } |
120 | 121 |
121 std::string referrer_url_host = dictionary_url.host(); | 122 std::string referrer_url_host = dictionary_url.host(); |
122 size_t postfix_domain_index = referrer_url_host.rfind(domain); | 123 size_t postfix_domain_index = referrer_url_host.rfind(domain); |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 case '/': | 556 case '/': |
556 (*output)[i] = '_'; | 557 (*output)[i] = '_'; |
557 continue; | 558 continue; |
558 default: | 559 default: |
559 continue; | 560 continue; |
560 } | 561 } |
561 } | 562 } |
562 } | 563 } |
563 | 564 |
564 } // namespace net | 565 } // namespace net |
OLD | NEW |