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 | |
74 DataReductionProxyTamperDetection::DetectAndReport( | 68 DataReductionProxyTamperDetection::DetectAndReport( |
75 original_response_headers, | 69 original_response_headers, |
76 data_reduction_proxy_type_info.proxy_servers.first.SchemeIsSecure()); | 70 data_reduction_proxy_type_info.proxy_servers.first.SchemeIsSecure()); |
77 | 71 |
78 DataReductionProxyInfo data_reduction_proxy_info; | 72 DataReductionProxyInfo data_reduction_proxy_info; |
79 DataReductionProxyBypassType bypass_type = | 73 DataReductionProxyBypassType bypass_type = |
80 GetDataReductionProxyBypassType(original_response_headers, | 74 GetDataReductionProxyBypassType(original_response_headers, |
81 &data_reduction_proxy_info); | 75 &data_reduction_proxy_info); |
82 | 76 |
83 if (bypass_type == BYPASS_EVENT_TYPE_MISSING_VIA_HEADER_OTHER && | 77 if (bypass_type == BYPASS_EVENT_TYPE_MISSING_VIA_HEADER_OTHER && |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 net::ProxyService* proxy_service = request->context()->proxy_service(); | 206 net::ProxyService* proxy_service = request->context()->proxy_service(); |
213 DCHECK(proxy_service); | 207 DCHECK(proxy_service); |
214 | 208 |
215 proxy_service->MarkProxiesAsBadUntil(proxy_info, | 209 proxy_service->MarkProxiesAsBadUntil(proxy_info, |
216 bypass_duration, | 210 bypass_duration, |
217 fallback, | 211 fallback, |
218 request->net_log()); | 212 request->net_log()); |
219 } | 213 } |
220 | 214 |
221 } // namespace data_reduction_proxy | 215 } // namespace data_reduction_proxy |
OLD | NEW |