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/browser/data_reduction_proxy_protocol.
h" | 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol.
h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" | 9 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
10 #include "components/data_reduction_proxy/browser/data_reduction_proxy_tamper_de
tection.h" | 10 #include "components/data_reduction_proxy/browser/data_reduction_proxy_tamper_de
tection.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 return false; | 58 return false; |
59 | 59 |
60 // Empty implies either that the request was served from cache or that | 60 // Empty implies either that the request was served from cache or that |
61 // request was served directly from the origin. | 61 // request was served directly from the origin. |
62 if (request->proxy_server().IsEmpty()) | 62 if (request->proxy_server().IsEmpty()) |
63 return false; | 63 return false; |
64 | 64 |
65 if (data_reduction_proxy_type_info.proxy_servers.first.is_empty()) | 65 if (data_reduction_proxy_type_info.proxy_servers.first.is_empty()) |
66 return false; | 66 return false; |
67 | 67 |
| 68 // At this point, the response is expected to have the data reduction proxy |
| 69 // via header, so detect and report cases where the via header is missing. |
| 70 DataReductionProxyUsageStats::DetectAndRecordMissingViaHeaderResponseCode( |
| 71 !data_reduction_proxy_type_info.proxy_servers.second.is_empty(), |
| 72 original_response_headers); |
| 73 |
68 DataReductionProxyTamperDetection::DetectAndReport( | 74 DataReductionProxyTamperDetection::DetectAndReport( |
69 original_response_headers, | 75 original_response_headers, |
70 data_reduction_proxy_type_info.proxy_servers.first.SchemeIsSecure()); | 76 data_reduction_proxy_type_info.proxy_servers.first.SchemeIsSecure()); |
71 | 77 |
72 DataReductionProxyInfo data_reduction_proxy_info; | 78 DataReductionProxyInfo data_reduction_proxy_info; |
73 DataReductionProxyBypassType bypass_type = | 79 DataReductionProxyBypassType bypass_type = |
74 GetDataReductionProxyBypassType(original_response_headers, | 80 GetDataReductionProxyBypassType(original_response_headers, |
75 &data_reduction_proxy_info); | 81 &data_reduction_proxy_info); |
76 | 82 |
77 if (bypass_type == BYPASS_EVENT_TYPE_MISSING_VIA_HEADER_OTHER && | 83 if (bypass_type == BYPASS_EVENT_TYPE_MISSING_VIA_HEADER_OTHER && |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 net::ProxyService* proxy_service = request->context()->proxy_service(); | 212 net::ProxyService* proxy_service = request->context()->proxy_service(); |
207 DCHECK(proxy_service); | 213 DCHECK(proxy_service); |
208 | 214 |
209 proxy_service->MarkProxiesAsBadUntil(proxy_info, | 215 proxy_service->MarkProxiesAsBadUntil(proxy_info, |
210 bypass_duration, | 216 bypass_duration, |
211 fallback, | 217 fallback, |
212 request->net_log()); | 218 request->net_log()); |
213 } | 219 } |
214 | 220 |
215 } // namespace data_reduction_proxy | 221 } // namespace data_reduction_proxy |
OLD | NEW |