OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 */ | 99 */ |
100 | 100 |
101 // TODO(jar): Redirects in dictionary fetches might plausibly be problematic, | 101 // TODO(jar): Redirects in dictionary fetches might plausibly be problematic, |
102 // and hence the conservative approach is to not allow any redirects (if there | 102 // and hence the conservative approach is to not allow any redirects (if there |
103 // were any... then don't allow the dictionary to be set). | 103 // were any... then don't allow the dictionary to be set). |
104 | 104 |
105 if (domain.empty()) { | 105 if (domain.empty()) { |
106 SdchErrorRecovery(DICTIONARY_MISSING_DOMAIN_SPECIFIER); | 106 SdchErrorRecovery(DICTIONARY_MISSING_DOMAIN_SPECIFIER); |
107 return false; // Domain is required. | 107 return false; // Domain is required. |
108 } | 108 } |
109 if (RegistryControlledDomainService::GetDomainAndRegistry(domain).size() | 109 if (RegistryControlledDomainService::GetDomainAndRegistry(domain).empty()) { |
110 == 0) { | |
111 SdchErrorRecovery(DICTIONARY_SPECIFIES_TOP_LEVEL_DOMAIN); | 110 SdchErrorRecovery(DICTIONARY_SPECIFIES_TOP_LEVEL_DOMAIN); |
112 return false; // domain was a TLD. | 111 return false; // domain was a TLD. |
113 } | 112 } |
114 if (!Dictionary::DomainMatch(dictionary_url, domain)) { | 113 if (!Dictionary::DomainMatch(dictionary_url, domain)) { |
115 SdchErrorRecovery(DICTIONARY_DOMAIN_NOT_MATCHING_SOURCE_URL); | 114 SdchErrorRecovery(DICTIONARY_DOMAIN_NOT_MATCHING_SOURCE_URL); |
116 return false; | 115 return false; |
117 } | 116 } |
118 | 117 |
119 std::string referrer_url_host = dictionary_url.host(); | 118 std::string referrer_url_host = dictionary_url.host(); |
120 size_t postfix_domain_index = referrer_url_host.rfind(domain); | 119 size_t postfix_domain_index = referrer_url_host.rfind(domain); |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 case '/': | 540 case '/': |
542 (*output)[i] = '_'; | 541 (*output)[i] = '_'; |
543 continue; | 542 continue; |
544 default: | 543 default: |
545 continue; | 544 continue; |
546 } | 545 } |
547 } | 546 } |
548 } | 547 } |
549 | 548 |
550 } // namespace net | 549 } // namespace net |
OLD | NEW |