Index: components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.cc |
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.cc |
index e2edb9b7dc87bf0411cff388d45d0535bdc331ab..9f0932844f4376530f397809947435b11b03ddee 100644 |
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.cc |
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.cc |
@@ -17,6 +17,7 @@ |
#include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" |
#include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h" |
#include "crypto/random.h" |
+#include "net/base/host_port_pair.h" |
#include "net/proxy/proxy_server.h" |
#include "net/url_request/url_request.h" |
#include "url/gurl.h" |
@@ -103,11 +104,18 @@ void DataReductionProxyAuthRequestHandler::MaybeAddRequestHeader( |
DCHECK(network_task_runner_->BelongsToCurrentThread()); |
if (!proxy_server.is_valid()) |
return; |
- if (data_reduction_proxy_params_ && |
- data_reduction_proxy_params_->IsDataReductionProxy( |
- proxy_server.host_port_pair(), NULL)) { |
- AddAuthorizationHeader(request_headers); |
- } |
+ if (proxy_server.is_direct()) |
+ return; |
+ MaybeAddRequestHeaderImpl(proxy_server.host_port_pair(), |
+ false, |
+ request_headers); |
+} |
+ |
+void DataReductionProxyAuthRequestHandler::MaybeAddProxyTunnelRequestHandler( |
+ const net::HostPortPair& proxy_server, |
+ net::HttpRequestHeaders* request_headers) { |
+ DCHECK(network_task_runner_->BelongsToCurrentThread()); |
+ MaybeAddRequestHeaderImpl(proxy_server, true, request_headers); |
} |
void DataReductionProxyAuthRequestHandler::AddAuthorizationHeader( |
@@ -188,4 +196,19 @@ std::string DataReductionProxyAuthRequestHandler::GetDefaultKey() const { |
return key; |
} |
+void DataReductionProxyAuthRequestHandler::MaybeAddRequestHeaderImpl( |
+ const net::HostPortPair& proxy_server, |
+ bool expect_ssl, |
+ net::HttpRequestHeaders* request_headers) { |
+ if (proxy_server.IsEmpty()) |
+ return; |
+ if (data_reduction_proxy_params_ && |
+ data_reduction_proxy_params_->IsDataReductionProxy(proxy_server, NULL) && |
+ net::HostPortPair::FromURL( |
+ data_reduction_proxy_params_->ssl_origin()).Equals( |
+ proxy_server) == expect_ssl) { |
+ AddAuthorizationHeader(request_headers); |
+ } |
+} |
+ |
} // namespace data_reduction_proxy |