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

Unified Diff: net/http/http_proxy_client_socket_pool.cc

Issue 517693002: Add embedder-specific headers to HTTP CONNECT tunnel request (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added tests Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: net/http/http_proxy_client_socket_pool.cc
diff --git a/net/http/http_proxy_client_socket_pool.cc b/net/http/http_proxy_client_socket_pool.cc
index 829a5e78314968bca7b6acce7b9f6fd3c7215482..9f3b4b663ace5f1eceb5931afb4431620e5709ba 100644
--- a/net/http/http_proxy_client_socket_pool.cc
+++ b/net/http/http_proxy_client_socket_pool.cc
@@ -6,6 +6,7 @@
#include <algorithm>
+#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/time/time.h"
#include "base/values.h"
@@ -37,7 +38,9 @@ HttpProxySocketParams::HttpProxySocketParams(
HttpAuthCache* http_auth_cache,
HttpAuthHandlerFactory* http_auth_handler_factory,
SpdySessionPool* spdy_session_pool,
- bool tunnel)
+ bool tunnel,
+ const base::Callback<void(const HostPortPair&, HttpRequestHeaders*)>&
+ before_proxy_tunnel_connect_callback)
: transport_params_(transport_params),
ssl_params_(ssl_params),
spdy_session_pool_(spdy_session_pool),
@@ -46,7 +49,9 @@ HttpProxySocketParams::HttpProxySocketParams(
endpoint_(endpoint),
http_auth_cache_(tunnel ? http_auth_cache : NULL),
http_auth_handler_factory_(tunnel ? http_auth_handler_factory : NULL),
- tunnel_(tunnel) {
+ tunnel_(tunnel),
+ before_proxy_tunnel_request_callback_(
+ before_proxy_tunnel_connect_callback) {
DCHECK((transport_params.get() == NULL && ssl_params.get() != NULL) ||
(transport_params.get() != NULL && ssl_params.get() == NULL));
if (transport_params_.get()) {
@@ -291,6 +296,7 @@ int HttpProxyConnectJob::DoHttpProxyConnect() {
params_->tunnel(),
using_spdy_,
protocol_negotiated_,
+ params_->before_proxy_tunnel_request_callback(),
params_->ssl_params().get() != NULL));
return transport_socket_->Connect(callback_);
}
@@ -372,10 +378,14 @@ HttpProxyConnectJobFactory::HttpProxyConnectJobFactory(
TransportClientSocketPool* transport_pool,
SSLClientSocketPool* ssl_pool,
HostResolver* host_resolver,
+ base::Callback<void(const HostPortPair&, HttpRequestHeaders*)>
+ before_proxy_tunnel_request_callback,
NetLog* net_log)
: transport_pool_(transport_pool),
ssl_pool_(ssl_pool),
host_resolver_(host_resolver),
+ before_proxy_tunnel_request_callback_(
+ before_proxy_tunnel_request_callback),
net_log_(net_log) {
base::TimeDelta max_pool_timeout = base::TimeDelta();
@@ -391,6 +401,10 @@ HttpProxyConnectJobFactory::HttpProxyConnectJobFactory(
base::TimeDelta::FromSeconds(kHttpProxyConnectJobTimeoutInSeconds);
}
+HttpProxyClientSocketPool::
+HttpProxyConnectJobFactory::~HttpProxyConnectJobFactory() {
+}
+
scoped_ptr<ConnectJob>
HttpProxyClientSocketPool::HttpProxyConnectJobFactory::NewConnectJob(
@@ -421,6 +435,8 @@ HttpProxyClientSocketPool::HttpProxyClientSocketPool(
HostResolver* host_resolver,
TransportClientSocketPool* transport_pool,
SSLClientSocketPool* ssl_pool,
+ const base::Callback<void(const HostPortPair&, HttpRequestHeaders*)>&
+ before_proxy_tunnel_request_callback,
NetLog* net_log)
: transport_pool_(transport_pool),
ssl_pool_(ssl_pool),
@@ -430,6 +446,7 @@ HttpProxyClientSocketPool::HttpProxyClientSocketPool(
new HttpProxyConnectJobFactory(transport_pool,
ssl_pool,
host_resolver,
+ before_proxy_tunnel_request_callback,
net_log)) {
// We should always have a |transport_pool_| except in unit tests.
if (transport_pool_)

Powered by Google App Engine
This is Rietveld 408576698