OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/data_reduction_proxy/core/browser/data_reduction_proxy_tamp
er_detection.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_tamp
er_detection.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 carrier_id_); | 292 carrier_id_); |
293 } | 293 } |
294 | 294 |
295 // Checks whether there are other proxies/middleboxes' named after the Data | 295 // Checks whether there are other proxies/middleboxes' named after the Data |
296 // Reduction Proxy's name in Via header. |has_chrome_proxy_via_header| marks | 296 // Reduction Proxy's name in Via header. |has_chrome_proxy_via_header| marks |
297 // that whether the Data Reduction Proxy's Via header occurs or not. | 297 // that whether the Data Reduction Proxy's Via header occurs or not. |
298 bool DataReductionProxyTamperDetection::ValidateViaHeader( | 298 bool DataReductionProxyTamperDetection::ValidateViaHeader( |
299 base::StringPiece fingerprint, | 299 base::StringPiece fingerprint, |
300 bool* has_chrome_proxy_via_header) const { | 300 bool* has_chrome_proxy_via_header) const { |
301 bool has_intermediary; | 301 bool has_intermediary; |
302 *has_chrome_proxy_via_header = HasDataReductionProxyViaHeader( | 302 *has_chrome_proxy_via_header = |
303 response_headers_, | 303 HasDataReductionProxyViaHeader(*response_headers_, &has_intermediary); |
304 &has_intermediary); | |
305 | 304 |
306 if (*has_chrome_proxy_via_header) | 305 if (*has_chrome_proxy_via_header) |
307 return !has_intermediary; | 306 return !has_intermediary; |
308 return true; | 307 return true; |
309 } | 308 } |
310 | 309 |
311 void DataReductionProxyTamperDetection::ReportUMAForViaHeaderValidation( | 310 void DataReductionProxyTamperDetection::ReportUMAForViaHeaderValidation( |
312 bool has_chrome_proxy) const { | 311 bool has_chrome_proxy) const { |
313 // The Via header of the Data Reduction Proxy is missing. | 312 // The Via header of the Data Reduction Proxy is missing. |
314 if (!has_chrome_proxy) { | 313 if (!has_chrome_proxy) { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 std::vector<std::string> values; | 552 std::vector<std::string> values; |
554 std::string value; | 553 std::string value; |
555 size_t iter = 0; | 554 size_t iter = 0; |
556 while (headers->EnumerateHeader(&iter, header_name, &value)) { | 555 while (headers->EnumerateHeader(&iter, header_name, &value)) { |
557 values.push_back(std::move(value)); | 556 values.push_back(std::move(value)); |
558 } | 557 } |
559 return values; | 558 return values; |
560 } | 559 } |
561 | 560 |
562 } // namespace data_reduction_proxy | 561 } // namespace data_reduction_proxy |
OLD | NEW |