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

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: Forgot to upload the new files Created 6 years, 3 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..4156bd51c1e4be90be2ca7ff240a6e093ef1f722 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;
@@ -403,6 +407,10 @@ int HttpProxyClientSocket::DoSendRequest() {
if (request_line_.empty()) {
DCHECK(request_headers_.IsEmpty());
HttpRequestHeaders authorization_headers;
+ if (proxy_delegate_) {
mmenke 2014/09/08 17:38:50 I think it makes more sense to move this below the
bengr 2014/09/09 01:28:48 Done.
+ proxy_delegate_->OnBeforeTunnelRequest(proxy_server_,
+ &authorization_headers);
mmenke 2014/09/08 17:38:50 Should have a couple tests for this. Don't believ
bengr 2014/09/09 01:28:48 I didn't override auth, but did test that I could
+ }
if (auth_->HaveAuth())
auth_->AddAuthorizationHeader(&authorization_headers);
BuildTunnelRequest(request_, authorization_headers, endpoint_,
@@ -447,6 +455,10 @@ int HttpProxyClientSocket::DoReadHeadersComplete(int result) {
NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
base::Bind(&HttpResponseHeaders::NetLogCallback, response_.headers));
+ proxy_delegate_->OnTunnelHeadersReceived(HostPortPair::FromURL(request_.url),
mef 2014/09/08 15:06:48 if (proxy_delegate_)
mmenke 2014/09/08 17:38:50 If this passed tests, we should probably have a te
bengr 2014/09/09 01:28:48 Done.
bengr 2014/09/09 01:28:48 Done.
+ proxy_server_,
+ *(response_.headers));
mmenke 2014/09/08 17:38:50 nit: Parentheses not needed.
bengr 2014/09/09 01:28:48 Done.
+
switch (response_.headers->response_code()) {
case 200: // OK
if (http_stream_parser_->IsMoreDataBuffered())

Powered by Google App Engine
This is Rietveld 408576698