| Index: components/safe_browsing_db/v4_protocol_manager_util.cc
|
| diff --git a/components/safe_browsing_db/v4_protocol_manager_util.cc b/components/safe_browsing_db/v4_protocol_manager_util.cc
|
| index e210f9751713268c76885f328675cd344348665f..816ca18646ade66d79040c7de5a99b8aefbefc28 100644
|
| --- a/components/safe_browsing_db/v4_protocol_manager_util.cc
|
| +++ b/components/safe_browsing_db/v4_protocol_manager_util.cc
|
| @@ -287,18 +287,10 @@ void V4ProtocolManagerUtil::UpdateHeaders(net::HttpRequestHeaders* headers) {
|
| void V4ProtocolManagerUtil::UrlToFullHashes(
|
| const GURL& url,
|
| std::vector<FullHash>* full_hashes) {
|
| - std::string canon_host, canon_path, canon_query;
|
| - CanonicalizeUrl(url, &canon_host, &canon_path, &canon_query);
|
| -
|
| std::vector<std::string> hosts;
|
| - if (url.HostIsIPAddress()) {
|
| - hosts.push_back(url.host());
|
| - } else {
|
| - GenerateHostVariantsToCheck(canon_host, &hosts);
|
| - }
|
| -
|
| std::vector<std::string> paths;
|
| - GeneratePathVariantsToCheck(canon_path, canon_query, &paths);
|
| + GenerateHostAndPathVariants(url, &hosts, &paths);
|
| +
|
| for (const std::string& host : hosts) {
|
| for (const std::string& path : paths) {
|
| full_hashes->push_back(crypto::SHA256HashString(host + path));
|
| @@ -307,6 +299,24 @@ void V4ProtocolManagerUtil::UrlToFullHashes(
|
| }
|
|
|
| // static
|
| +void V4ProtocolManagerUtil::GenerateHostAndPathVariants(
|
| + const GURL& url,
|
| + std::vector<std::string>* hosts,
|
| + std::vector<std::string>* paths) {
|
| + std::string canon_host, canon_path, canon_query;
|
| + CanonicalizeUrl(url, &canon_host, &canon_path, &canon_query);
|
| +
|
| + hosts->clear();
|
| + paths->clear();
|
| + if (url.HostIsIPAddress()) {
|
| + hosts->push_back(url.host());
|
| + } else {
|
| + GenerateHostVariantsToCheck(canon_host, hosts);
|
| + }
|
| + GeneratePathVariantsToCheck(canon_path, canon_query, paths);
|
| +}
|
| +
|
| +// static
|
| bool V4ProtocolManagerUtil::FullHashToHashPrefix(const FullHash& full_hash,
|
| PrefixSize prefix_size,
|
| HashPrefix* hash_prefix) {
|
|
|