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; |