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/core/browser/data_reduction_proxy_bypa
ss_protocol.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypa
ss_protocol.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypa
ss_stats.h" |
9 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig.h" | 10 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig.h" |
10 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_usag
e_stats.h" | |
11 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event
_store.h" | 11 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event
_store.h" |
12 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs.h" | 12 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs.h" |
13 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 13 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
14 #include "net/base/load_flags.h" | 14 #include "net/base/load_flags.h" |
15 #include "net/http/http_response_headers.h" | 15 #include "net/http/http_response_headers.h" |
16 #include "net/proxy/proxy_config.h" | 16 #include "net/proxy/proxy_config.h" |
17 #include "net/proxy/proxy_info.h" | 17 #include "net/proxy/proxy_info.h" |
18 #include "net/proxy/proxy_list.h" | 18 #include "net/proxy/proxy_list.h" |
19 #include "net/proxy/proxy_retry_info.h" | 19 #include "net/proxy/proxy_retry_info.h" |
20 #include "net/proxy/proxy_server.h" | 20 #include "net/proxy/proxy_server.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 const net::ProxyServer& first = | 107 const net::ProxyServer& first = |
108 data_reduction_proxy_type_info.proxy_servers.first; | 108 data_reduction_proxy_type_info.proxy_servers.first; |
109 if (!first.is_valid() || first.host_port_pair().IsEmpty()) | 109 if (!first.is_valid() || first.host_port_pair().IsEmpty()) |
110 return false; | 110 return false; |
111 | 111 |
112 // At this point, the response is expected to have the data reduction proxy | 112 // At this point, the response is expected to have the data reduction proxy |
113 // via header, so detect and report cases where the via header is missing. | 113 // via header, so detect and report cases where the via header is missing. |
114 const net::ProxyServer& second = | 114 const net::ProxyServer& second = |
115 data_reduction_proxy_type_info.proxy_servers.second; | 115 data_reduction_proxy_type_info.proxy_servers.second; |
116 DataReductionProxyUsageStats::DetectAndRecordMissingViaHeaderResponseCode( | 116 DataReductionProxyBypassStats::DetectAndRecordMissingViaHeaderResponseCode( |
117 second.is_valid() && !second.host_port_pair().IsEmpty(), | 117 second.is_valid() && !second.host_port_pair().IsEmpty(), |
118 response_headers); | 118 response_headers); |
119 | 119 |
120 if (DataReductionProxyParams:: | 120 if (DataReductionProxyParams:: |
121 IsIncludedInRelaxMissingViaHeaderOtherBypassFieldTrial() && | 121 IsIncludedInRelaxMissingViaHeaderOtherBypassFieldTrial() && |
122 HasDataReductionProxyViaHeader(response_headers, NULL)) { | 122 HasDataReductionProxyViaHeader(response_headers, NULL)) { |
123 DCHECK(config_->IsDataReductionProxy(request->proxy_server(), NULL)); | 123 DCHECK(config_->IsDataReductionProxy(request->proxy_server(), NULL)); |
124 via_header_producing_proxies_.insert(request->proxy_server()); | 124 via_header_producing_proxies_.insert(request->proxy_server()); |
125 } | 125 } |
126 | 126 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 DCHECK(request->context()); | 163 DCHECK(request->context()); |
164 DCHECK(request->context()->proxy_service()); | 164 DCHECK(request->context()->proxy_service()); |
165 net::ProxyServer proxy_server = | 165 net::ProxyServer proxy_server = |
166 data_reduction_proxy_type_info.proxy_servers.first; | 166 data_reduction_proxy_type_info.proxy_servers.first; |
167 | 167 |
168 // Only record UMA if the proxy isn't already on the retry list. | 168 // Only record UMA if the proxy isn't already on the retry list. |
169 if (!config_->IsProxyBypassed( | 169 if (!config_->IsProxyBypassed( |
170 request->context()->proxy_service()->proxy_retry_info(), proxy_server, | 170 request->context()->proxy_service()->proxy_retry_info(), proxy_server, |
171 NULL)) { | 171 NULL)) { |
172 DataReductionProxyUsageStats::RecordDataReductionProxyBypassInfo( | 172 DataReductionProxyBypassStats::RecordDataReductionProxyBypassInfo( |
173 second.is_valid() && !second.host_port_pair().IsEmpty(), | 173 second.is_valid() && !second.host_port_pair().IsEmpty(), |
174 data_reduction_proxy_info.bypass_all, | 174 data_reduction_proxy_info.bypass_all, |
175 proxy_server, | 175 proxy_server, |
176 bypass_type); | 176 bypass_type); |
177 } | 177 } |
178 | 178 |
179 if (data_reduction_proxy_info.mark_proxies_as_bad) { | 179 if (data_reduction_proxy_info.mark_proxies_as_bad) { |
180 MarkProxiesAsBadUntil(request, | 180 MarkProxiesAsBadUntil(request, |
181 data_reduction_proxy_info.bypass_duration, | 181 data_reduction_proxy_info.bypass_duration, |
182 data_reduction_proxy_info.bypass_all, | 182 data_reduction_proxy_info.bypass_all, |
(...skipping 22 matching lines...) Expand all Loading... |
205 request->method() == "TRACE") | 205 request->method() == "TRACE") |
206 return true; | 206 return true; |
207 return false; | 207 return false; |
208 } | 208 } |
209 | 209 |
210 void DataReductionProxyBypassProtocol::OnIPAddressChanged() { | 210 void DataReductionProxyBypassProtocol::OnIPAddressChanged() { |
211 via_header_producing_proxies_.clear(); | 211 via_header_producing_proxies_.clear(); |
212 } | 212 } |
213 | 213 |
214 } // namespace data_reduction_proxy | 214 } // namespace data_reduction_proxy |
OLD | NEW |