Index: chrome/browser/ssl/ssl_error_classification.cc |
diff --git a/chrome/browser/ssl/ssl_error_classification.cc b/chrome/browser/ssl/ssl_error_classification.cc |
index eea89250afa724677523c9a09e001a80b2e5b6ae..928931e3adad57da9c168df73b7ad54e89defd82 100644 |
--- a/chrome/browser/ssl/ssl_error_classification.cc |
+++ b/chrome/browser/ssl/ssl_error_classification.cc |
@@ -322,11 +322,11 @@ Tokenize(const std::string& name) { |
} |
// We accept the inverse case for www for historical reasons. |
-bool SSLErrorClassification::IsWWWSubDomainMatch() const { |
- std::string host_name = request_url_.host(); |
+bool SSLErrorClassification::GetWWWSubDomainMatch( |
+ const std::string& host_name, |
+ const std::vector<std::string>& dns_names, |
+ std::string* www_match_host_name) { |
if (IsHostNameKnownTLD(host_name)) { |
- std::vector<std::string> dns_names; |
- cert_.GetDNSNames(&dns_names); |
bool result = false; |
// Need to account for all possible domains given in the SSL certificate. |
for (size_t i = 0; i < dns_names.size(); ++i) { |
@@ -335,13 +335,17 @@ bool SSLErrorClassification::IsWWWSubDomainMatch() const { |
|| !(IsHostNameKnownTLD(dns_names[i]))) { |
result = result || false; |
} else if (dns_names[i].length() > host_name.length()) { |
- result = result || |
- net::StripWWW(base::ASCIIToUTF16(dns_names[i])) == |
- base::ASCIIToUTF16(host_name); |
+ if (net::StripWWW(base::ASCIIToUTF16(dns_names[i])) == |
+ base::ASCIIToUTF16(host_name)) { |
+ result = result || true; |
meacer
2015/07/09 17:58:56
result = result || true means result = true :)
Bhanu Dev
2015/07/11 04:00:43
Done.
|
+ www_match_host_name->assign(dns_names[i].data(), dns_names[i].size()); |
+ } |
} else { |
- result = result || |
- net::StripWWW(base::ASCIIToUTF16(host_name)) == |
- base::ASCIIToUTF16(dns_names[i]); |
+ if (net::StripWWW(base::ASCIIToUTF16(host_name)) == |
+ base::ASCIIToUTF16(dns_names[i])) { |
+ result = result || true; |
meacer
2015/07/09 17:58:56
Same here.
Bhanu Dev
2015/07/11 04:00:43
Done.
|
+ www_match_host_name->assign(dns_names[i].data(), dns_names[i].size()); |
+ } |
} |
} |
return result; |
@@ -349,6 +353,14 @@ bool SSLErrorClassification::IsWWWSubDomainMatch() const { |
return false; |
} |
+bool SSLErrorClassification::IsWWWSubDomainMatch() const { |
+ std::string host_name = request_url_.host(); |
+ std::vector<std::string> dns_names; |
+ cert_.GetDNSNames(&dns_names); |
+ std::string www_host; |
+ return GetWWWSubDomainMatch(host_name, dns_names, &www_host); |
+} |
+ |
bool SSLErrorClassification::NameUnderAnyNames( |
const Tokens& child, |
const std::vector<Tokens>& potential_parents) const { |