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

Side by Side Diff: components/safe_browsing_db/v4_update_protocol_manager.cc

Issue 2113513002: Enforce RAW compression for PVer4 hash prefixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/safe_browsing_db/v4_update_protocol_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_update_protocol_manager.h" 5 #include "components/safe_browsing_db/v4_update_protocol_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base64url.h" 9 #include "base/base64url.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 const auto& state = entry.second; 203 const auto& state = entry.second;
204 ListUpdateRequest* list_update_request = request.add_list_update_requests(); 204 ListUpdateRequest* list_update_request = request.add_list_update_requests();
205 list_update_request->set_platform_type(list_to_update.platform_type); 205 list_update_request->set_platform_type(list_to_update.platform_type);
206 list_update_request->set_threat_entry_type( 206 list_update_request->set_threat_entry_type(
207 list_to_update.threat_entry_type); 207 list_to_update.threat_entry_type);
208 list_update_request->set_threat_type(list_to_update.threat_type); 208 list_update_request->set_threat_type(list_to_update.threat_type);
209 209
210 if (!state.empty()) { 210 if (!state.empty()) {
211 list_update_request->set_state(state); 211 list_update_request->set_state(state);
212 } 212 }
213
214 // TODO(vakh): Accept other compression formats also.
215 // See: https://bugs.chromium.org/p/chromium/issues/detail?id=624567
216 list_update_request->mutable_constraints()->add_supported_compressions(RAW);
213 } 217 }
214 218
215 // Serialize and Base64 encode. 219 // Serialize and Base64 encode.
216 std::string req_data, req_base64; 220 std::string req_data, req_base64;
217 request.SerializeToString(&req_data); 221 request.SerializeToString(&req_data);
218 base::Base64UrlEncode(req_data, base::Base64UrlEncodePolicy::INCLUDE_PADDING, 222 base::Base64UrlEncode(req_data, base::Base64UrlEncodePolicy::INCLUDE_PADDING,
219 &req_base64); 223 &req_base64);
220 return req_base64; 224 return req_base64;
221 } 225 }
222 226
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 346
343 void V4UpdateProtocolManager::GetUpdateUrlAndHeaders( 347 void V4UpdateProtocolManager::GetUpdateUrlAndHeaders(
344 const std::string& req_base64, 348 const std::string& req_base64,
345 GURL* gurl, 349 GURL* gurl,
346 net::HttpRequestHeaders* headers) const { 350 net::HttpRequestHeaders* headers) const {
347 V4ProtocolManagerUtil::GetRequestUrlAndHeaders( 351 V4ProtocolManagerUtil::GetRequestUrlAndHeaders(
348 req_base64, "threatListUpdates:fetch", config_, gurl, headers); 352 req_base64, "threatListUpdates:fetch", config_, gurl, headers);
349 } 353 }
350 354
351 } // namespace safe_browsing 355 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « no previous file | components/safe_browsing_db/v4_update_protocol_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698