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/common/data_reduction_proxy_headers.h" | 5 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "net/http/http_response_headers.h" | 13 #include "net/http/http_response_headers.h" |
14 #include "net/http/http_status_code.h" | 14 #include "net/http/http_status_code.h" |
15 #include "net/proxy/proxy_service.h" | 15 #include "net/proxy/proxy_service.h" |
16 | 16 |
17 using base::StringPiece; | 17 using base::StringPiece; |
18 using base::TimeDelta; | 18 using base::TimeDelta; |
19 using net::ProxyService; | 19 using net::ProxyService; |
20 | 20 |
21 namespace data_reduction_proxy { | 21 namespace data_reduction_proxy { |
22 | 22 |
| 23 namespace fingerprint_actions { |
| 24 |
| 25 const char kTamperDetectFingerprintChromeProxy[] = "fcp"; |
| 26 const char kTamperDetectFingerprintVia[] = "fvia"; |
| 27 const char kTamperDetectFingerprintOtherHeaders[] = "foh"; |
| 28 const char kTamperDetectFingerprintContentLength[] = "fcl"; |
| 29 |
| 30 } // namespace fingerprint_actions |
| 31 |
23 bool GetDataReductionProxyBypassDuration( | 32 bool GetDataReductionProxyBypassDuration( |
24 const net::HttpResponseHeaders* headers, | 33 const net::HttpResponseHeaders* headers, |
25 const std::string& action_prefix, | 34 const std::string& action_prefix, |
26 base::TimeDelta* duration) { | 35 base::TimeDelta* duration) { |
27 void* iter = NULL; | 36 void* iter = NULL; |
28 std::string value; | 37 std::string value; |
29 std::string name = "chrome-proxy"; | 38 std::string name = "chrome-proxy"; |
30 | 39 |
31 while (headers->EnumerateHeader(&iter, name, &value)) { | 40 while (headers->EnumerateHeader(&iter, name, &value)) { |
32 if (value.size() > action_prefix.size()) { | 41 if (value.size() > action_prefix.size()) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 headers->response_code() < net::HTTP_INTERNAL_SERVER_ERROR) { | 143 headers->response_code() < net::HTTP_INTERNAL_SERVER_ERROR) { |
135 return ProxyService::PROXY_4XX_BYPASS; | 144 return ProxyService::PROXY_4XX_BYPASS; |
136 } | 145 } |
137 return ProxyService::MISSING_VIA_HEADER; | 146 return ProxyService::MISSING_VIA_HEADER; |
138 } | 147 } |
139 // There is no bypass event. | 148 // There is no bypass event. |
140 return ProxyService::BYPASS_EVENT_TYPE_MAX; | 149 return ProxyService::BYPASS_EVENT_TYPE_MAX; |
141 } | 150 } |
142 | 151 |
143 } // namespace data_reduction_proxy | 152 } // namespace data_reduction_proxy |
OLD | NEW |