Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Unified Diff: components/safe_browsing/password_protection/password_protection_service.cc

Issue 2959443003: Fix GetHostNameWithHTTPScheme for IPv6 addresses (Closed)
Patch Set: fix unittest Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/safe_browsing/password_protection/password_protection_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | components/safe_browsing/password_protection/password_protection_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698