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

Unified Diff: net/http/http_proxy_client_socket.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.cc
diff --git a/net/http/http_proxy_client_socket.cc b/net/http/http_proxy_client_socket.cc
index 3d9eadd48353eaa61095581bcc22034e3e510e7f..06a4ac9c5e653e5125e60b1e0bd7e0045561f572 100644
--- a/net/http/http_proxy_client_socket.cc
+++ b/net/http/http_proxy_client_socket.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/callback.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "net/base/auth.h"
@@ -35,6 +36,8 @@ HttpProxyClientSocket::HttpProxyClientSocket(
bool tunnel,
bool using_spdy,
NextProto protocol_negotiated,
+ const base::Callback<void(const HostPortPair&, HttpRequestHeaders*)>&
+ before_proxy_tunnel_request_callback,
bool is_https_proxy)
: io_callback_(base::Bind(&HttpProxyClientSocket::OnIOComplete,
base::Unretained(this))),
@@ -53,6 +56,9 @@ HttpProxyClientSocket::HttpProxyClientSocket(
protocol_negotiated_(protocol_negotiated),
is_https_proxy_(is_https_proxy),
redirect_has_load_timing_info_(false),
+ proxy_server_(proxy_server),
+ before_proxy_tunnel_request_callback_(
+ before_proxy_tunnel_request_callback),
net_log_(transport_socket->socket()->NetLog()) {
// Synthesize the bits of a request that we actually use.
request_.url = request_url;
@@ -403,6 +409,10 @@ int HttpProxyClientSocket::DoSendRequest() {
if (request_line_.empty()) {
DCHECK(request_headers_.IsEmpty());
HttpRequestHeaders authorization_headers;
+ if (!before_proxy_tunnel_request_callback_.is_null()) {
+ before_proxy_tunnel_request_callback_.Run(proxy_server_,
+ &authorization_headers);
+ }
if (auth_->HaveAuth())
auth_->AddAuthorizationHeader(&authorization_headers);
BuildTunnelRequest(request_, authorization_headers, endpoint_,

Powered by Google App Engine
This is Rietveld 408576698