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

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

Issue 2842763003: media: Send chrome-cache: frfr on first request. (Closed)
Patch Set: remove header when not sending to proxy Created 3 years, 7 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
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_netw ork_delegate.h" 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw ork_delegate.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // Reset |request|'s DataReductionProxyData. 254 // Reset |request|'s DataReductionProxyData.
255 DataReductionProxyData::ClearData(request); 255 DataReductionProxyData::ClearData(request);
256 256
257 if (params::IsIncludedInHoldbackFieldTrial()) { 257 if (params::IsIncludedInHoldbackFieldTrial()) {
258 if (!WasEligibleWithoutHoldback(*request, proxy_info, proxy_retry_info)) 258 if (!WasEligibleWithoutHoldback(*request, proxy_info, proxy_retry_info))
259 return; 259 return;
260 // For the holdback field trial, still log UMA as if the proxy was used. 260 // For the holdback field trial, still log UMA as if the proxy was used.
261 data = DataReductionProxyData::GetDataAndCreateIfNecessary(request); 261 data = DataReductionProxyData::GetDataAndCreateIfNecessary(request);
262 if (data) 262 if (data)
263 data->set_used_data_reduction_proxy(true); 263 data->set_used_data_reduction_proxy(true);
264
265 headers->RemoveHeader(chrome_proxy_header());
bengr 2017/05/03 21:37:42 Please add a case to data_reduction_proxy_network_
hubbe 2017/05/05 20:51:45 Is there a test that does something similar I can
bengr 2017/05/08 21:27:38 Shockingly there isn't. We rely on the DCHECKs in
hubbe 2017/05/11 21:19:05 Added TODO
264 VerifyHttpRequestHeaders(false, *headers); 266 VerifyHttpRequestHeaders(false, *headers);
265 return; 267 return;
266 } 268 }
267 269
268 bool using_data_reduction_proxy = true; 270 bool using_data_reduction_proxy = true;
269 // The following checks rule out direct, invalid, and other connection types. 271 // The following checks rule out direct, invalid, and other connection types.
270 if (!proxy_info.is_http() && !proxy_info.is_https() && 272 if (!proxy_info.is_http() && !proxy_info.is_https() &&
271 !proxy_info.is_quic()) { 273 !proxy_info.is_quic()) {
272 using_data_reduction_proxy = false; 274 using_data_reduction_proxy = false;
273 } else if (proxy_info.proxy_server().host_port_pair().IsEmpty()) { 275 } else if (proxy_info.proxy_server().host_port_pair().IsEmpty()) {
274 using_data_reduction_proxy = false; 276 using_data_reduction_proxy = false;
275 } else if (!data_reduction_proxy_config_->IsDataReductionProxy( 277 } else if (!data_reduction_proxy_config_->IsDataReductionProxy(
276 proxy_info.proxy_server(), nullptr)) { 278 proxy_info.proxy_server(), nullptr)) {
277 using_data_reduction_proxy = false; 279 using_data_reduction_proxy = false;
278 } 280 }
279 281
280 LoFiDecider* lofi_decider = nullptr; 282 LoFiDecider* lofi_decider = nullptr;
281 if (data_reduction_proxy_io_data_) 283 if (data_reduction_proxy_io_data_)
282 lofi_decider = data_reduction_proxy_io_data_->lofi_decider(); 284 lofi_decider = data_reduction_proxy_io_data_->lofi_decider();
283 285
284 if (!using_data_reduction_proxy) { 286 if (!using_data_reduction_proxy) {
285 if (lofi_decider) { 287 if (lofi_decider) {
286 // If not using the data reduction proxy, strip the 288 // If not using the data reduction proxy, strip the
287 // Chrome-Proxy-Accept-Transform header. 289 // Chrome-Proxy-Accept-Transform header.
288 lofi_decider->RemoveAcceptTransformHeader(headers); 290 lofi_decider->RemoveAcceptTransformHeader(headers);
289 } 291 }
290 RemoveChromeProxyECTHeader(headers); 292 RemoveChromeProxyECTHeader(headers);
293 headers->RemoveHeader(chrome_proxy_header());
bengr 2017/05/03 21:37:42 Please add a case to data_reduction_proxy_network_
291 VerifyHttpRequestHeaders(false, *headers); 294 VerifyHttpRequestHeaders(false, *headers);
292 return; 295 return;
293 } 296 }
294 297
295 // Retrieves DataReductionProxyData from a request, creating a new instance 298 // Retrieves DataReductionProxyData from a request, creating a new instance
296 // if needed. 299 // if needed.
297 data = DataReductionProxyData::GetDataAndCreateIfNecessary(request); 300 data = DataReductionProxyData::GetDataAndCreateIfNecessary(request);
298 if (data) { 301 if (data) {
299 data->set_used_data_reduction_proxy(true); 302 data->set_used_data_reduction_proxy(true);
300 // Only set GURL, NQE and session key string for main frame requests since 303 // Only set GURL, NQE and session key string for main frame requests since
(...skipping 30 matching lines...) Expand all
331 if (!page_id) { 334 if (!page_id) {
332 page_id = data_reduction_proxy_request_options_->GeneratePageId(); 335 page_id = data_reduction_proxy_request_options_->GeneratePageId();
333 } 336 }
334 data->set_page_id(page_id.value()); 337 data->set_page_id(page_id.value());
335 } 338 }
336 339
337 data_reduction_proxy_request_options_->AddRequestHeader(headers, page_id); 340 data_reduction_proxy_request_options_->AddRequestHeader(headers, page_id);
338 341
339 if (lofi_decider) 342 if (lofi_decider)
340 lofi_decider->MaybeSetIgnorePreviewsBlacklistDirective(headers); 343 lofi_decider->MaybeSetIgnorePreviewsBlacklistDirective(headers);
341 VerifyHttpRequestHeaders(true, *headers); 344 VerifyHttpRequestHeaders(true, *headers);
bengr 2017/05/03 21:37:42 Does video not affect this case?
hubbe 2017/05/05 20:51:45 This calls VerifyHttpRequestHeaders() with "true".
bengr 2017/05/08 21:27:38 Acknowledged.
342 } 345 }
343 346
344 void DataReductionProxyNetworkDelegate::OnBeforeRedirectInternal( 347 void DataReductionProxyNetworkDelegate::OnBeforeRedirectInternal(
345 net::URLRequest* request, 348 net::URLRequest* request,
346 const GURL& new_location) { 349 const GURL& new_location) {
347 // Since this is after a redirect response, reset |request|'s 350 // Since this is after a redirect response, reset |request|'s
348 // DataReductionProxyData, but keep page ID and session. 351 // DataReductionProxyData, but keep page ID and session.
349 // TODO(ryansturm): Change ClearData logic to have persistent and 352 // TODO(ryansturm): Change ClearData logic to have persistent and
350 // non-persistent (WRT redirects) data. 353 // non-persistent (WRT redirects) data.
351 // crbug.com/709564 354 // crbug.com/709564
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 } 644 }
642 645
643 void DataReductionProxyNetworkDelegate::RemoveChromeProxyECTHeader( 646 void DataReductionProxyNetworkDelegate::RemoveChromeProxyECTHeader(
644 net::HttpRequestHeaders* request_headers) const { 647 net::HttpRequestHeaders* request_headers) const {
645 DCHECK(thread_checker_.CalledOnValidThread()); 648 DCHECK(thread_checker_.CalledOnValidThread());
646 649
647 request_headers->RemoveHeader(chrome_proxy_ect_header()); 650 request_headers->RemoveHeader(chrome_proxy_ect_header());
648 } 651 }
649 652
650 } // namespace data_reduction_proxy 653 } // namespace data_reduction_proxy
OLDNEW
« no previous file with comments | « no previous file | media/blink/multibuffer_data_source.cc » ('j') | media/blink/resource_multibuffer_data_provider.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698