| 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 "components/ssl_errors/error_classification.h" | 5 #include "components/ssl_errors/error_classification.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 dns_name.length() == host_name.length() || | 287 dns_name.length() == host_name.length() || |
| 288 !HostNameHasKnownTLD(dns_name)) { | 288 !HostNameHasKnownTLD(dns_name)) { |
| 289 continue; | 289 continue; |
| 290 } else if (dns_name.length() > host_name.length()) { | 290 } else if (dns_name.length() > host_name.length()) { |
| 291 if (url_formatter::StripWWW(base::ASCIIToUTF16(dns_name)) == | 291 if (url_formatter::StripWWW(base::ASCIIToUTF16(dns_name)) == |
| 292 base::ASCIIToUTF16(host_name)) { | 292 base::ASCIIToUTF16(host_name)) { |
| 293 *www_match_host_name = dns_name; | 293 *www_match_host_name = dns_name; |
| 294 return true; | 294 return true; |
| 295 } | 295 } |
| 296 } else { | 296 } else { |
| 297 if (url_formatter::StripWWW(base::ASCIIToUTF16(host_name)) == | 297 if (url_formatter::StripSubdomains( |
| 298 base::ASCIIToUTF16(dns_name)) { | 298 request_url, url_formatter::kStripWWW) == dns_name) { |
| 299 *www_match_host_name = dns_name; | 299 *www_match_host_name = dns_name; |
| 300 return true; | 300 return true; |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 } | 304 } |
| 305 return false; | 305 return false; |
| 306 } | 306 } |
| 307 | 307 |
| 308 bool NameUnderAnyNames(const HostnameTokens& child, | 308 bool NameUnderAnyNames(const HostnameTokens& child, |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 return std::find(dns_names_domain.begin(), dns_names_domain.end() - 1, | 464 return std::find(dns_names_domain.begin(), dns_names_domain.end() - 1, |
| 465 host_name_domain) != dns_names_domain.end() - 1; | 465 host_name_domain) != dns_names_domain.end() - 1; |
| 466 } | 466 } |
| 467 | 467 |
| 468 bool IsHostnameNonUniqueOrDotless(const std::string& hostname) { | 468 bool IsHostnameNonUniqueOrDotless(const std::string& hostname) { |
| 469 return net::IsHostnameNonUnique(hostname) || | 469 return net::IsHostnameNonUnique(hostname) || |
| 470 hostname.find('.') == std::string::npos; | 470 hostname.find('.') == std::string::npos; |
| 471 } | 471 } |
| 472 | 472 |
| 473 } // namespace ssl_errors | 473 } // namespace ssl_errors |
| OLD | NEW |