Index: net/http/http_proxy_client_socket.cc |
diff --git a/net/http/http_proxy_client_socket.cc b/net/http/http_proxy_client_socket.cc |
index 3d9eadd48353eaa61095581bcc22034e3e510e7f..1da43ec605bb2e3dd0e72d8159b4cf193d2acd8b 100644 |
--- a/net/http/http_proxy_client_socket.cc |
+++ b/net/http/http_proxy_client_socket.cc |
@@ -15,6 +15,7 @@ |
#include "net/base/net_util.h" |
#include "net/http/http_basic_stream.h" |
#include "net/http/http_network_session.h" |
+#include "net/http/http_proxy_tunnel_delegate.h" |
#include "net/http/http_request_info.h" |
#include "net/http/http_response_headers.h" |
#include "net/http/http_stream_parser.h" |
@@ -35,6 +36,7 @@ HttpProxyClientSocket::HttpProxyClientSocket( |
bool tunnel, |
bool using_spdy, |
NextProto protocol_negotiated, |
+ HttpProxyTunnelDelegate* http_proxy_tunnel_delegate, |
bool is_https_proxy) |
: io_callback_(base::Bind(&HttpProxyClientSocket::OnIOComplete, |
base::Unretained(this))), |
@@ -53,6 +55,8 @@ HttpProxyClientSocket::HttpProxyClientSocket( |
protocol_negotiated_(protocol_negotiated), |
is_https_proxy_(is_https_proxy), |
redirect_has_load_timing_info_(false), |
+ proxy_server_(proxy_server), |
+ http_proxy_tunnel_delegate_(http_proxy_tunnel_delegate), |
net_log_(transport_socket->socket()->NetLog()) { |
// Synthesize the bits of a request that we actually use. |
request_.url = request_url; |
@@ -403,6 +407,10 @@ int HttpProxyClientSocket::DoSendRequest() { |
if (request_line_.empty()) { |
DCHECK(request_headers_.IsEmpty()); |
HttpRequestHeaders authorization_headers; |
+ if (http_proxy_tunnel_delegate_) { |
+ http_proxy_tunnel_delegate_->OnBeforeRequest(proxy_server_, |
+ &authorization_headers); |
+ } |
if (auth_->HaveAuth()) |
auth_->AddAuthorizationHeader(&authorization_headers); |
BuildTunnelRequest(request_, authorization_headers, endpoint_, |
@@ -447,6 +455,11 @@ int HttpProxyClientSocket::DoReadHeadersComplete(int result) { |
NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
base::Bind(&HttpResponseHeaders::NetLogCallback, response_.headers)); |
+ http_proxy_tunnel_delegate_->OnHeadersReceived( |
+ HostPortPair::FromURL(request_.url), |
+ proxy_server_, |
+ *(response_.headers)); |
+ |
switch (response_.headers->response_code()) { |
case 200: // OK |
if (http_stream_parser_->IsMoreDataBuffered()) |