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

Unified Diff: net/http/http_auth_controller.cc

Issue 14994003: Remove round trip from data reduction proxy authentication (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added data reduction proxy initialization logic Created 7 years, 7 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_auth_controller.cc
diff --git a/net/http/http_auth_controller.cc b/net/http/http_auth_controller.cc
index ae396402c111afe6912c0f7ffdcf7df9d5d41aa5..0a48cce1b5f03316bd62e255ada86327cc24c286 100644
--- a/net/http/http_auth_controller.cc
+++ b/net/http/http_auth_controller.cc
@@ -7,6 +7,9 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/metrics/histogram.h"
+#if defined(SPDY_PROXY_AUTH_ORIGIN) && defined(SPDY_PROXY_AUTH_VALUE)
+#include "base/stringprintf.h"
+#endif
#include "base/string_util.h"
#include "base/threading/platform_thread.h"
#include "base/utf_string_conversions.h"
@@ -174,6 +177,30 @@ int HttpAuthController::MaybeGenerateAuthToken(
const HttpRequestInfo* request, const CompletionCallback& callback,
const BoundNetLog& net_log) {
DCHECK(CalledOnValidThread());
+
+#if defined(SPDY_PROXY_AUTH_ORIGIN) && defined(SPDY_PROXY_AUTH_VALUE)
+ if (target_ == HttpAuth::AUTH_PROXY) {
+ HttpAuthCache::Entry* entry =
+ http_auth_cache_->LookupByPath(auth_origin_, auth_path_);
+ if (entry) {
+ identity_.source = HttpAuth::IDENT_SRC_REALM_LOOKUP;
+ identity_.invalid = false;
+ identity_.credentials = entry->credentials();
+ if (!handler_.get()) {
+ std::string raw_response_headers = base::StringPrintf(
+ "HTTP/1.1 407 Internal Server Error\r\n"
+ "Proxy-Authenticate: SpdyProxy realm=\"%s\", ps=\"%s\"\r\n\r\n",
+ entry->realm().data(), entry->auth_challenge().data());
+ HttpAuth::ChooseBestChallenge(
+ http_auth_handler_factory_,
+ new HttpResponseHeaders(HttpUtil::AssembleRawHeaders(
+ raw_response_headers.data(), raw_response_headers.length())),
+ target_, auth_origin_, disabled_schemes_, net_log, &handler_);
+ }
+ }
+ }
+#endif
+
bool needs_auth = HaveAuth() || SelectPreemptiveAuth(net_log);
if (!needs_auth)
return OK;
« chrome/browser/profiles/profile_impl_io_data.cc ('K') | « chrome/chrome_android.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698