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

Side by Side Diff: net/http/http_network_transaction.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: errata 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
« no previous file with comments | « net/http/http_network_transaction.h ('k') | net/http/http_network_transaction_unittest.cc » ('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 (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/http/http_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 void HttpNetworkTransaction::SetWebSocketHandshakeStreamCreateHelper( 458 void HttpNetworkTransaction::SetWebSocketHandshakeStreamCreateHelper(
459 WebSocketHandshakeStreamBase::CreateHelper* create_helper) { 459 WebSocketHandshakeStreamBase::CreateHelper* create_helper) {
460 websocket_handshake_stream_base_create_helper_ = create_helper; 460 websocket_handshake_stream_base_create_helper_ = create_helper;
461 } 461 }
462 462
463 void HttpNetworkTransaction::SetBeforeNetworkStartCallback( 463 void HttpNetworkTransaction::SetBeforeNetworkStartCallback(
464 const BeforeNetworkStartCallback& callback) { 464 const BeforeNetworkStartCallback& callback) {
465 before_network_start_callback_ = callback; 465 before_network_start_callback_ = callback;
466 } 466 }
467 467
468 void HttpNetworkTransaction::SetBeforeProxyHeadersSentCallback(
469 const BeforeProxyHeadersSentCallback& callback) {
470 before_proxy_headers_sent_callback_ = callback;
471 }
472
468 int HttpNetworkTransaction::ResumeNetworkStart() { 473 int HttpNetworkTransaction::ResumeNetworkStart() {
469 DCHECK_EQ(next_state_, STATE_CREATE_STREAM); 474 DCHECK_EQ(next_state_, STATE_CREATE_STREAM);
470 return DoLoop(OK); 475 return DoLoop(OK);
471 } 476 }
472 477
473 void HttpNetworkTransaction::OnStreamReady(const SSLConfig& used_ssl_config, 478 void HttpNetworkTransaction::OnStreamReady(const SSLConfig& used_ssl_config,
474 const ProxyInfo& used_proxy_info, 479 const ProxyInfo& used_proxy_info,
475 HttpStreamBase* stream) { 480 HttpStreamBase* stream) {
476 DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_); 481 DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_);
477 DCHECK(stream_request_.get()); 482 DCHECK(stream_request_.get());
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 request_headers_.SetHeader(HttpRequestHeaders::kCacheControl, "max-age=0"); 877 request_headers_.SetHeader(HttpRequestHeaders::kCacheControl, "max-age=0");
873 } 878 }
874 879
875 if (ShouldApplyProxyAuth() && HaveAuth(HttpAuth::AUTH_PROXY)) 880 if (ShouldApplyProxyAuth() && HaveAuth(HttpAuth::AUTH_PROXY))
876 auth_controllers_[HttpAuth::AUTH_PROXY]->AddAuthorizationHeader( 881 auth_controllers_[HttpAuth::AUTH_PROXY]->AddAuthorizationHeader(
877 &request_headers_); 882 &request_headers_);
878 if (ShouldApplyServerAuth() && HaveAuth(HttpAuth::AUTH_SERVER)) 883 if (ShouldApplyServerAuth() && HaveAuth(HttpAuth::AUTH_SERVER))
879 auth_controllers_[HttpAuth::AUTH_SERVER]->AddAuthorizationHeader( 884 auth_controllers_[HttpAuth::AUTH_SERVER]->AddAuthorizationHeader(
880 &request_headers_); 885 &request_headers_);
881 886
887 if (using_proxy && !before_proxy_headers_sent_callback_.is_null())
888 before_proxy_headers_sent_callback_.Run(proxy_info_);
889
882 request_headers_.MergeFrom(request_->extra_headers); 890 request_headers_.MergeFrom(request_->extra_headers);
883 response_.did_use_http_auth = 891 response_.did_use_http_auth =
884 request_headers_.HasHeader(HttpRequestHeaders::kAuthorization) || 892 request_headers_.HasHeader(HttpRequestHeaders::kAuthorization) ||
885 request_headers_.HasHeader(HttpRequestHeaders::kProxyAuthorization); 893 request_headers_.HasHeader(HttpRequestHeaders::kProxyAuthorization);
886 } 894 }
887 895
888 int HttpNetworkTransaction::DoInitRequestBody() { 896 int HttpNetworkTransaction::DoInitRequestBody() {
889 next_state_ = STATE_INIT_REQUEST_BODY_COMPLETE; 897 next_state_ = STATE_INIT_REQUEST_BODY_COMPLETE;
890 int rv = OK; 898 int rv = OK;
891 if (request_->upload_data_stream) 899 if (request_->upload_data_stream)
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, 1559 description = base::StringPrintf("Unknown state 0x%08X (%u)", state,
1552 state); 1560 state);
1553 break; 1561 break;
1554 } 1562 }
1555 return description; 1563 return description;
1556 } 1564 }
1557 1565
1558 #undef STATE_CASE 1566 #undef STATE_CASE
1559 1567
1560 } // namespace net 1568 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_transaction.h ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698