| 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/common/data_reduction_proxy_headers.h" | 11 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" |
| 11 #include "net/base/load_flags.h" | 12 #include "net/base/load_flags.h" |
| 12 #include "net/http/http_response_headers.h" | 13 #include "net/http/http_response_headers.h" |
| 13 #include "net/proxy/proxy_info.h" | 14 #include "net/proxy/proxy_info.h" |
| 14 #include "net/proxy/proxy_list.h" | 15 #include "net/proxy/proxy_list.h" |
| 15 #include "net/proxy/proxy_server.h" | 16 #include "net/proxy/proxy_server.h" |
| 16 #include "net/proxy/proxy_service.h" | 17 #include "net/proxy/proxy_service.h" |
| 17 #include "net/url_request/url_request.h" | 18 #include "net/url_request/url_request.h" |
| 18 #include "net/url_request/url_request_context.h" | 19 #include "net/url_request/url_request_context.h" |
| 19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 52 } |
| 52 | 53 |
| 53 // Empty implies either that the request was served from cache or that | 54 // Empty implies either that the request was served from cache or that |
| 54 // request was served directly from the origin. | 55 // request was served directly from the origin. |
| 55 if (request->proxy_server().IsEmpty()) | 56 if (request->proxy_server().IsEmpty()) |
| 56 return false; | 57 return false; |
| 57 | 58 |
| 58 if (data_reduction_proxies.first.is_empty()) | 59 if (data_reduction_proxies.first.is_empty()) |
| 59 return false; | 60 return false; |
| 60 | 61 |
| 62 DataReductionProxyTamperDetection::DetectAndReport( |
| 63 original_response_headers, |
| 64 data_reduction_proxies.first.SchemeIsSecure()); |
| 65 |
| 61 DataReductionProxyInfo data_reduction_proxy_info; | 66 DataReductionProxyInfo data_reduction_proxy_info; |
| 62 net::ProxyService::DataReductionProxyBypassType bypass_type = | 67 net::ProxyService::DataReductionProxyBypassType bypass_type = |
| 63 GetDataReductionProxyBypassType(original_response_headers, | 68 GetDataReductionProxyBypassType(original_response_headers, |
| 64 &data_reduction_proxy_info); | 69 &data_reduction_proxy_info); |
| 65 if (proxy_bypass_type) | 70 if (proxy_bypass_type) |
| 66 *proxy_bypass_type = bypass_type; | 71 *proxy_bypass_type = bypass_type; |
| 67 if (bypass_type == net::ProxyService::BYPASS_EVENT_TYPE_MAX) | 72 if (bypass_type == net::ProxyService::BYPASS_EVENT_TYPE_MAX) |
| 68 return false; | 73 return false; |
| 69 | 74 |
| 70 DCHECK(request->context()); | 75 DCHECK(request->context()); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 net::ProxyService* proxy_service = request->context()->proxy_service(); | 171 net::ProxyService* proxy_service = request->context()->proxy_service(); |
| 167 DCHECK(proxy_service); | 172 DCHECK(proxy_service); |
| 168 | 173 |
| 169 proxy_service->MarkProxiesAsBadUntil(proxy_info, | 174 proxy_service->MarkProxiesAsBadUntil(proxy_info, |
| 170 bypass_duration, | 175 bypass_duration, |
| 171 fallback, | 176 fallback, |
| 172 request->net_log()); | 177 request->net_log()); |
| 173 } | 178 } |
| 174 | 179 |
| 175 } // namespace data_reduction_proxy | 180 } // namespace data_reduction_proxy |
| OLD | NEW |