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

Side by Side Diff: net/url_request/url_request_http_job.cc

Issue 333113002: Move data reduction proxy to Chrome-Proxy header for authentication (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@flywheel-refactor-net-fake-a-redirect-response-headers-chrome-proxy-auth
Patch Set: Created 6 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/url_request/url_request_http_job.h" 5 #include "net/url_request/url_request_http_job.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 16 matching lines...) Expand all
27 #include "net/cookies/cookie_store.h" 27 #include "net/cookies/cookie_store.h"
28 #include "net/http/http_content_disposition.h" 28 #include "net/http/http_content_disposition.h"
29 #include "net/http/http_network_session.h" 29 #include "net/http/http_network_session.h"
30 #include "net/http/http_request_headers.h" 30 #include "net/http/http_request_headers.h"
31 #include "net/http/http_response_headers.h" 31 #include "net/http/http_response_headers.h"
32 #include "net/http/http_response_info.h" 32 #include "net/http/http_response_info.h"
33 #include "net/http/http_status_code.h" 33 #include "net/http/http_status_code.h"
34 #include "net/http/http_transaction.h" 34 #include "net/http/http_transaction.h"
35 #include "net/http/http_transaction_factory.h" 35 #include "net/http/http_transaction_factory.h"
36 #include "net/http/http_util.h" 36 #include "net/http/http_util.h"
37 #include "net/proxy/proxy_info.h"
37 #include "net/ssl/ssl_cert_request_info.h" 38 #include "net/ssl/ssl_cert_request_info.h"
38 #include "net/ssl/ssl_config_service.h" 39 #include "net/ssl/ssl_config_service.h"
39 #include "net/url_request/fraudulent_certificate_reporter.h" 40 #include "net/url_request/fraudulent_certificate_reporter.h"
40 #include "net/url_request/http_user_agent_settings.h" 41 #include "net/url_request/http_user_agent_settings.h"
41 #include "net/url_request/url_request.h" 42 #include "net/url_request/url_request.h"
42 #include "net/url_request/url_request_context.h" 43 #include "net/url_request/url_request_context.h"
43 #include "net/url_request/url_request_error_job.h" 44 #include "net/url_request/url_request_error_job.h"
44 #include "net/url_request/url_request_job_factory.h" 45 #include "net/url_request/url_request_job_factory.h"
45 #include "net/url_request/url_request_redirect_job.h" 46 #include "net/url_request/url_request_redirect_job.h"
46 #include "net/url_request/url_request_throttler_header_adapter.h" 47 #include "net/url_request/url_request_throttler_header_adapter.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 280
280 void URLRequestHttpJob::Kill() { 281 void URLRequestHttpJob::Kill() {
281 if (!transaction_.get()) 282 if (!transaction_.get())
282 return; 283 return;
283 284
284 weak_factory_.InvalidateWeakPtrs(); 285 weak_factory_.InvalidateWeakPtrs();
285 DestroyTransaction(); 286 DestroyTransaction();
286 URLRequestJob::Kill(); 287 URLRequestJob::Kill();
287 } 288 }
288 289
290 void URLRequestHttpJob::NotifyBeforeSendProxyHeadersCallback(
291 const ProxyInfo* proxy_info) {
292 DCHECK(proxy_info);
293 DCHECK_NE(URLRequestStatus::CANCELED, GetStatus().status());
294 if (network_delegate()) {
295 network_delegate()->NotifyBeforeSendProxyHeaders(
296 request_,
297 proxy_info,
298 &request_info_.extra_headers);
299 }
300 }
301
289 void URLRequestHttpJob::NotifyHeadersComplete() { 302 void URLRequestHttpJob::NotifyHeadersComplete() {
290 DCHECK(!response_info_); 303 DCHECK(!response_info_);
291 304
292 response_info_ = transaction_->GetResponseInfo(); 305 response_info_ = transaction_->GetResponseInfo();
293 306
294 // Save boolean, as we'll need this info at destruction time, and filters may 307 // Save boolean, as we'll need this info at destruction time, and filters may
295 // also need this info. 308 // also need this info.
296 is_cached_content_ = response_info_->was_cached; 309 is_cached_content_ = response_info_->was_cached;
297 310
298 if (!is_cached_content_ && throttling_entry_.get()) { 311 if (!is_cached_content_ && throttling_entry_.get()) {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 static_cast<WebSocketHandshakeStreamBase::CreateHelper*>(data)); 436 static_cast<WebSocketHandshakeStreamBase::CreateHelper*>(data));
424 } else { 437 } else {
425 rv = ERR_DISALLOWED_URL_SCHEME; 438 rv = ERR_DISALLOWED_URL_SCHEME;
426 } 439 }
427 } 440 }
428 441
429 if (rv == OK) { 442 if (rv == OK) {
430 transaction_->SetBeforeNetworkStartCallback( 443 transaction_->SetBeforeNetworkStartCallback(
431 base::Bind(&URLRequestHttpJob::NotifyBeforeNetworkStart, 444 base::Bind(&URLRequestHttpJob::NotifyBeforeNetworkStart,
432 base::Unretained(this))); 445 base::Unretained(this)));
446 transaction_->SetBeforeProxyHeadersSentCallback(
447 base::Bind(&URLRequestHttpJob::NotifyBeforeSendProxyHeadersCallback,
448 base::Unretained(this)));
433 449
434 if (!throttling_entry_.get() || 450 if (!throttling_entry_.get() ||
435 !throttling_entry_->ShouldRejectRequest(*request_)) { 451 !throttling_entry_->ShouldRejectRequest(*request_)) {
436 rv = transaction_->Start( 452 rv = transaction_->Start(
437 &request_info_, start_callback_, request_->net_log()); 453 &request_info_, start_callback_, request_->net_log());
438 start_time_ = base::TimeTicks::Now(); 454 start_time_ = base::TimeTicks::Now();
439 } else { 455 } else {
440 // Special error code for the exponential back-off module. 456 // Special error code for the exponential back-off module.
441 rv = ERR_TEMPORARILY_THROTTLED; 457 rv = ERR_TEMPORARILY_THROTTLED;
442 } 458 }
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 return override_response_headers_.get() ? 1521 return override_response_headers_.get() ?
1506 override_response_headers_.get() : 1522 override_response_headers_.get() :
1507 transaction_->GetResponseInfo()->headers.get(); 1523 transaction_->GetResponseInfo()->headers.get();
1508 } 1524 }
1509 1525
1510 void URLRequestHttpJob::NotifyURLRequestDestroyed() { 1526 void URLRequestHttpJob::NotifyURLRequestDestroyed() {
1511 awaiting_callback_ = false; 1527 awaiting_callback_ = false;
1512 } 1528 }
1513 1529
1514 } // namespace net 1530 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698