| 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 if (proxy_bypass_type) | 82 if (proxy_bypass_type) |
| 77 *proxy_bypass_type = bypass_type; | 83 *proxy_bypass_type = bypass_type; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 net::ProxyService* proxy_service = request->context()->proxy_service(); | 203 net::ProxyService* proxy_service = request->context()->proxy_service(); |
| 198 DCHECK(proxy_service); | 204 DCHECK(proxy_service); |
| 199 | 205 |
| 200 proxy_service->MarkProxiesAsBadUntil(proxy_info, | 206 proxy_service->MarkProxiesAsBadUntil(proxy_info, |
| 201 bypass_duration, | 207 bypass_duration, |
| 202 fallback, | 208 fallback, |
| 203 request->net_log()); | 209 request->net_log()); |
| 204 } | 210 } |
| 205 | 211 |
| 206 } // namespace data_reduction_proxy | 212 } // namespace data_reduction_proxy |
| OLD | NEW |