Index: components/safe_browsing/password_protection/password_protection_service.cc |
diff --git a/components/safe_browsing/password_protection/password_protection_service.cc b/components/safe_browsing/password_protection/password_protection_service.cc |
index 51d17e93faf5c31885028da949824810387d841b..1c6528cb0a95228cc794ead6734fbfd8392bfbb0 100644 |
--- a/components/safe_browsing/password_protection/password_protection_service.cc |
+++ b/components/safe_browsing/password_protection/password_protection_service.cc |
@@ -58,12 +58,12 @@ size_t GetPathDepth(const std::string& cache_expression_path) { |
.size(); |
} |
-// Given a URL of either http or https scheme, return its scheme://hostname. |
+// Given a URL of either http or https scheme, return its http://hostname. |
// e.g., "https://www.foo.com:80/bar/test.cgi" -> "http://www.foo.com". |
GURL GetHostNameWithHTTPScheme(const GURL& url) { |
DCHECK(url.SchemeIsHTTPOrHTTPS()); |
std::string result(url::kHttpScheme); |
- result.append(url::kStandardSchemeSeparator).append(url.HostNoBrackets()); |
+ result.append(url::kStandardSchemeSeparator).append(url.host()); |
return GURL(result); |
} |
@@ -110,7 +110,7 @@ bool PasswordProtectionService::CanGetReputationOfURL(const GURL& url) { |
if (!url.is_valid() || !url.SchemeIsHTTPOrHTTPS()) |
return false; |
- const std::string& hostname = url.HostNoBrackets(); |
+ const std::string hostname = url.HostNoBrackets(); |
return !net::IsLocalhost(hostname) && !net::IsHostnameNonUnique(hostname) && |
hostname.find('.') != std::string::npos; |
} |