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

Unified Diff: components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.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: Reworked HaveAuth test 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: 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

Powered by Google App Engine
This is Rietveld 408576698