| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/safe_browsing_db/v4_protocol_manager_util.h" | 5 #include "components/safe_browsing_db/v4_protocol_manager_util.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 urls->push_back(hosts[h] + paths[p]); | 341 urls->push_back(hosts[h] + paths[p]); |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 } | 344 } |
| 345 | 345 |
| 346 // static | 346 // static |
| 347 void V4ProtocolManagerUtil::CanonicalizeUrl(const GURL& url, | 347 void V4ProtocolManagerUtil::CanonicalizeUrl(const GURL& url, |
| 348 std::string* canonicalized_hostname, | 348 std::string* canonicalized_hostname, |
| 349 std::string* canonicalized_path, | 349 std::string* canonicalized_path, |
| 350 std::string* canonicalized_query) { | 350 std::string* canonicalized_query) { |
| 351 DCHECK(url.is_valid()); | 351 DCHECK(url.is_valid()) << url.possibly_invalid_spec(); |
| 352 | 352 |
| 353 // We only canonicalize "normal" URLs. | 353 // We only canonicalize "normal" URLs. |
| 354 if (!url.IsStandard()) | 354 if (!url.IsStandard()) |
| 355 return; | 355 return; |
| 356 | 356 |
| 357 // Following canonicalization steps are excluded since url parsing takes care | 357 // Following canonicalization steps are excluded since url parsing takes care |
| 358 // of those :- | 358 // of those :- |
| 359 // 1. Remove any tab (0x09), CR (0x0d), and LF (0x0a) chars from url. | 359 // 1. Remove any tab (0x09), CR (0x0d), and LF (0x0a) chars from url. |
| 360 // (Exclude escaped version of these chars). | 360 // (Exclude escaped version of these chars). |
| 361 // 2. Normalize hostname to 4 dot-seperated decimal values. | 361 // 2. Normalize hostname to 4 dot-seperated decimal values. |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 // static | 522 // static |
| 523 void V4ProtocolManagerUtil::SetClientInfoFromConfig( | 523 void V4ProtocolManagerUtil::SetClientInfoFromConfig( |
| 524 ClientInfo* client_info, | 524 ClientInfo* client_info, |
| 525 const V4ProtocolConfig& config) { | 525 const V4ProtocolConfig& config) { |
| 526 DCHECK(client_info); | 526 DCHECK(client_info); |
| 527 client_info->set_client_id(config.client_name); | 527 client_info->set_client_id(config.client_name); |
| 528 client_info->set_client_version(config.version); | 528 client_info->set_client_version(config.version); |
| 529 } | 529 } |
| 530 | 530 |
| 531 } // namespace safe_browsing | 531 } // namespace safe_browsing |
| OLD | NEW |