Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol.cc

Issue 2777823002: Bypass DRP if a redirect cycle is detected (Closed)
Patch Set: ryansturm comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <vector> 7 #include <vector>
8 8
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 request->proxy_server().is_direct() || 98 request->proxy_server().is_direct() ||
99 request->proxy_server().host_port_pair().IsEmpty()) { 99 request->proxy_server().host_port_pair().IsEmpty()) {
100 ReportResponseProxyServerStatusHistogram( 100 ReportResponseProxyServerStatusHistogram(
101 RESPONSE_PROXY_SERVER_STATUS_EMPTY); 101 RESPONSE_PROXY_SERVER_STATUS_EMPTY);
102 return false; 102 return false;
103 } 103 }
104 104
105 DataReductionProxyTypeInfo data_reduction_proxy_type_info; 105 DataReductionProxyTypeInfo data_reduction_proxy_type_info;
106 if (!config_->WasDataReductionProxyUsed(request, 106 if (!config_->WasDataReductionProxyUsed(request,
107 &data_reduction_proxy_type_info)) { 107 &data_reduction_proxy_type_info)) {
108 if (!HasDataReductionProxyViaHeader(response_headers, nullptr)) { 108 if (!HasDataReductionProxyViaHeader(*response_headers, nullptr)) {
109 ReportResponseProxyServerStatusHistogram( 109 ReportResponseProxyServerStatusHistogram(
110 RESPONSE_PROXY_SERVER_STATUS_NON_DRP_NO_VIA); 110 RESPONSE_PROXY_SERVER_STATUS_NON_DRP_NO_VIA);
111 return false; 111 return false;
112 } 112 }
113 ReportResponseProxyServerStatusHistogram( 113 ReportResponseProxyServerStatusHistogram(
114 RESPONSE_PROXY_SERVER_STATUS_NON_DRP_WITH_VIA); 114 RESPONSE_PROXY_SERVER_STATUS_NON_DRP_WITH_VIA);
115 115
116 // If the |proxy_server| doesn't match any of the currently configured Data 116 // If the |proxy_server| doesn't match any of the currently configured Data
117 // Reduction Proxies, but it still has the Data Reduction Proxy via header, 117 // Reduction Proxies, but it still has the Data Reduction Proxy via header,
118 // then apply the bypass logic regardless. 118 // then apply the bypass logic regardless.
(...skipping 12 matching lines...) Expand all
131 } else { 131 } else {
132 ReportResponseProxyServerStatusHistogram(RESPONSE_PROXY_SERVER_STATUS_DRP); 132 ReportResponseProxyServerStatusHistogram(RESPONSE_PROXY_SERVER_STATUS_DRP);
133 } 133 }
134 134
135 if (data_reduction_proxy_type_info.proxy_servers.empty()) 135 if (data_reduction_proxy_type_info.proxy_servers.empty())
136 return false; 136 return false;
137 137
138 // At this point, the response is expected to have the data reduction proxy 138 // At this point, the response is expected to have the data reduction proxy
139 // via header, so detect and report cases where the via header is missing. 139 // via header, so detect and report cases where the via header is missing.
140 DataReductionProxyBypassStats::DetectAndRecordMissingViaHeaderResponseCode( 140 DataReductionProxyBypassStats::DetectAndRecordMissingViaHeaderResponseCode(
141 data_reduction_proxy_type_info.proxy_index == 0, response_headers); 141 data_reduction_proxy_type_info.proxy_index == 0, *response_headers);
142 142
143 // GetDataReductionProxyBypassType will only log a net_log event if a bypass 143 // GetDataReductionProxyBypassType will only log a net_log event if a bypass
144 // command was sent via the data reduction proxy headers 144 // command was sent via the data reduction proxy headers
145 DataReductionProxyBypassType bypass_type = GetDataReductionProxyBypassType( 145 DataReductionProxyBypassType bypass_type = GetDataReductionProxyBypassType(
146 response_headers, data_reduction_proxy_info); 146 request->url_chain(), *response_headers, data_reduction_proxy_info);
147 147
148 if (proxy_bypass_type) 148 if (proxy_bypass_type)
149 *proxy_bypass_type = bypass_type; 149 *proxy_bypass_type = bypass_type;
150 if (bypass_type == BYPASS_EVENT_TYPE_MAX) 150 if (bypass_type == BYPASS_EVENT_TYPE_MAX)
151 return false; 151 return false;
152 152
153 DCHECK(request->context()); 153 DCHECK(request->context());
154 DCHECK(request->context()->proxy_service()); 154 DCHECK(request->context()->proxy_service());
155 net::ProxyServer proxy_server = 155 net::ProxyServer proxy_server =
156 data_reduction_proxy_type_info.proxy_servers.front(); 156 data_reduction_proxy_type_info.proxy_servers.front();
(...skipping 16 matching lines...) Expand all
173 net::LOAD_DISABLE_CACHE | 173 net::LOAD_DISABLE_CACHE |
174 net::LOAD_BYPASS_PROXY); 174 net::LOAD_BYPASS_PROXY);
175 } 175 }
176 176
177 // Retry if block-once was specified or if method is idempotent. 177 // Retry if block-once was specified or if method is idempotent.
178 return bypass_type == BYPASS_EVENT_TYPE_CURRENT || 178 return bypass_type == BYPASS_EVENT_TYPE_CURRENT ||
179 util::IsMethodIdempotent(request->method()); 179 util::IsMethodIdempotent(request->method());
180 } 180 }
181 181
182 } // namespace data_reduction_proxy 182 } // namespace data_reduction_proxy
OLDNEW
« no previous file with comments | « no previous file | components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698