summaryrefslogtreecommitdiffstats
path: root/net/http/http_proxy_client_socket.cc
diff options
context:
space:
mode:
authorbengr <bengr@chromium.org>2014-09-10 16:04:46 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-10 23:11:44 +0000
commit39e40610845c395edde654e40fc8d88e466aea81 (patch)
tree398548cea29297896cff446408d7921b621f88d1 /net/http/http_proxy_client_socket.cc
parent02399778922b0791d5df14e140a2c9ca1a37847e (diff)
downloadchromium_src-39e40610845c395edde654e40fc8d88e466aea81.zip
chromium_src-39e40610845c395edde654e40fc8d88e466aea81.tar.gz
chromium_src-39e40610845c395edde654e40fc8d88e466aea81.tar.bz2
Add embedder-specific headers to HTTP CONNECT tunnel request
Adds a mechanism by which a net/ embedder can add headers to a HTTP CONNECT tunnel request. BUG=400872 Review URL: https://codereview.chromium.org/517693002 Cr-Commit-Position: refs/heads/master@{#294252}
Diffstat (limited to 'net/http/http_proxy_client_socket.cc')
-rw-r--r--net/http/http_proxy_client_socket.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/net/http/http_proxy_client_socket.cc b/net/http/http_proxy_client_socket.cc
index 3d9eadd..515301c 100644
--- a/net/http/http_proxy_client_socket.cc
+++ b/net/http/http_proxy_client_socket.cc
@@ -13,6 +13,7 @@
#include "net/base/io_buffer.h"
#include "net/base/net_log.h"
#include "net/base/net_util.h"
+#include "net/base/proxy_delegate.h"
#include "net/http/http_basic_stream.h"
#include "net/http/http_network_session.h"
#include "net/http/http_request_info.h"
@@ -35,6 +36,7 @@ HttpProxyClientSocket::HttpProxyClientSocket(
bool tunnel,
bool using_spdy,
NextProto protocol_negotiated,
+ ProxyDelegate* proxy_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),
+ proxy_delegate_(proxy_delegate),
net_log_(transport_socket->socket()->NetLog()) {
// Synthesize the bits of a request that we actually use.
request_.url = request_url;
@@ -405,6 +409,10 @@ int HttpProxyClientSocket::DoSendRequest() {
HttpRequestHeaders authorization_headers;
if (auth_->HaveAuth())
auth_->AddAuthorizationHeader(&authorization_headers);
+ if (proxy_delegate_) {
+ proxy_delegate_->OnBeforeTunnelRequest(proxy_server_,
+ &authorization_headers);
+ }
BuildTunnelRequest(request_, authorization_headers, endpoint_,
&request_line_, &request_headers_);
@@ -447,6 +455,13 @@ int HttpProxyClientSocket::DoReadHeadersComplete(int result) {
NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
base::Bind(&HttpResponseHeaders::NetLogCallback, response_.headers));
+ if (proxy_delegate_) {
+ proxy_delegate_->OnTunnelHeadersReceived(
+ HostPortPair::FromURL(request_.url),
+ proxy_server_,
+ *response_.headers);
+ }
+
switch (response_.headers->response_code()) {
case 200: // OK
if (http_stream_parser_->IsMoreDataBuffered())