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/common/data_reduction_proxy_headers.h" | 10 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" |
(...skipping 19 matching lines...) Expand all Loading... | |
30 net::ProxyServer::SCHEME_HTTPS, | 30 net::ProxyServer::SCHEME_HTTPS, |
31 net::HostPortPair::FromURL(gurl)); | 31 net::HostPortPair::FromURL(gurl)); |
32 return true; | 32 return true; |
33 } | 33 } |
34 | 34 |
35 } // namespace | 35 } // namespace |
36 | 36 |
37 namespace data_reduction_proxy { | 37 namespace data_reduction_proxy { |
38 | 38 |
39 bool MaybeBypassProxyAndPrepareToRetry( | 39 bool MaybeBypassProxyAndPrepareToRetry( |
40 net::ProxyService::DataReductionProxyBypassType* proxy_bypass_type, | |
bengr
2014/07/16 01:40:10
While you're here, reorder the parameters. Paramet
megjablon
2014/07/16 23:07:14
Done.
| |
40 const DataReductionProxyParams* data_reduction_proxy_params, | 41 const DataReductionProxyParams* data_reduction_proxy_params, |
41 net::URLRequest* request, | 42 net::URLRequest* request, |
42 const net::HttpResponseHeaders* original_response_headers, | 43 const net::HttpResponseHeaders* original_response_headers, |
43 scoped_refptr<net::HttpResponseHeaders>* override_response_headers) { | 44 scoped_refptr<net::HttpResponseHeaders>* override_response_headers) { |
44 if (!data_reduction_proxy_params) | 45 if (!data_reduction_proxy_params) |
45 return false; | 46 return false; |
46 std::pair<GURL, GURL> data_reduction_proxies; | 47 std::pair<GURL, GURL> data_reduction_proxies; |
47 if (!data_reduction_proxy_params->WasDataReductionProxyUsed( | 48 if (!data_reduction_proxy_params->WasDataReductionProxyUsed( |
48 request, &data_reduction_proxies)) { | 49 request, &data_reduction_proxies)) { |
49 return false; | 50 return false; |
50 } | 51 } |
51 | 52 |
52 // Empty implies either that the request was served from cache or that | 53 // Empty implies either that the request was served from cache or that |
53 // request was served directly from the origin. | 54 // request was served directly from the origin. |
54 if (request->proxy_server().IsEmpty()) | 55 if (request->proxy_server().IsEmpty()) |
55 return false; | 56 return false; |
56 | 57 |
57 if (data_reduction_proxies.first.is_empty()) | 58 if (data_reduction_proxies.first.is_empty()) |
58 return false; | 59 return false; |
59 | 60 |
60 DataReductionProxyInfo data_reduction_proxy_info; | 61 DataReductionProxyInfo data_reduction_proxy_info; |
61 net::ProxyService::DataReductionProxyBypassType bypass_type = | 62 net::ProxyService::DataReductionProxyBypassType bypass_type = |
62 GetDataReductionProxyBypassType( | 63 GetDataReductionProxyBypassType(original_response_headers, |
63 original_response_headers, &data_reduction_proxy_info); | 64 &data_reduction_proxy_info); |
65 if(proxy_bypass_type) | |
66 *proxy_bypass_type = bypass_type; | |
64 if (bypass_type == net::ProxyService::BYPASS_EVENT_TYPE_MAX) { | 67 if (bypass_type == net::ProxyService::BYPASS_EVENT_TYPE_MAX) { |
65 return false; | 68 return false; |
66 } | 69 } |
67 | 70 |
68 DCHECK(request->context()); | 71 DCHECK(request->context()); |
69 DCHECK(request->context()->proxy_service()); | 72 DCHECK(request->context()->proxy_service()); |
70 net::ProxyServer proxy_server; | 73 net::ProxyServer proxy_server; |
71 SetProxyServerFromGURL(data_reduction_proxies.first, &proxy_server); | 74 SetProxyServerFromGURL(data_reduction_proxies.first, &proxy_server); |
72 request->context()->proxy_service()->RecordDataReductionProxyBypassInfo( | 75 request->context()->proxy_service()->RecordDataReductionProxyBypassInfo( |
73 !data_reduction_proxies.second.is_empty(), | 76 !data_reduction_proxies.second.is_empty(), |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 net::ProxyService* proxy_service = request->context()->proxy_service(); | 167 net::ProxyService* proxy_service = request->context()->proxy_service(); |
165 DCHECK(proxy_service); | 168 DCHECK(proxy_service); |
166 | 169 |
167 proxy_service->MarkProxiesAsBadUntil(proxy_info, | 170 proxy_service->MarkProxiesAsBadUntil(proxy_info, |
168 bypass_duration, | 171 bypass_duration, |
169 fallback, | 172 fallback, |
170 request->net_log()); | 173 request->net_log()); |
171 } | 174 } |
172 | 175 |
173 } // namespace data_reduction_proxy | 176 } // namespace data_reduction_proxy |
OLD | NEW |