summaryrefslogtreecommitdiffstats
path: root/net/socket_stream
diff options
context:
space:
mode:
authorcbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-15 14:25:50 +0000
committercbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-15 14:25:50 +0000
commitfa55e1931013409ddbce59ed39f8b12a351fd0c4 (patch)
tree1ff77c48d22f36173c1fa63ae8acb1faf896aa0d /net/socket_stream
parente8da0a0066695284dbf698c9900617b3b159f33b (diff)
downloadchromium_src-fa55e1931013409ddbce59ed39f8b12a351fd0c4.zip
chromium_src-fa55e1931013409ddbce59ed39f8b12a351fd0c4.tar.gz
chromium_src-fa55e1931013409ddbce59ed39f8b12a351fd0c4.tar.bz2
Added factories for HttpAuthHandler.
The driving rationale for this change was to prevent choosing an AuthHandler when it is not supported on the system due to a missing runtime component (such as not being able to locate a gssapi shared library when seeing a Negotiate scheme). It also has the advantage (currently unused) of determining some per-auth-scheme properties only the first time that a challenge for that scheme is seen (such as maximum token length for the SSPI implementation of NTLM). Finally, it may make unit tests easier to generate since the factory can be easily mocked. BUG=34795 TEST=New unit test for HttpAuthHandlerDispatchFactory. Review URL: http://codereview.chromium.org/582007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39065 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket_stream')
-rw-r--r--net/socket_stream/socket_stream.cc11
-rw-r--r--net/socket_stream/socket_stream.h4
2 files changed, 10 insertions, 5 deletions
diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc
index aae234e..4d80df2 100644
--- a/net/socket_stream/socket_stream.cc
+++ b/net/socket_stream/socket_stream.cc
@@ -43,6 +43,7 @@ SocketStream::SocketStream(const GURL& url, Delegate* delegate)
delegate_(delegate),
max_pending_send_allowed_(kMaxPendingSendAllowed),
next_state_(STATE_NONE),
+ http_auth_handler_factory_(NULL),
factory_(ClientSocketFactory::GetDefaultFactory()),
proxy_mode_(kDirectConnection),
proxy_url_(url),
@@ -107,9 +108,10 @@ void SocketStream::set_context(URLRequestContext* context) {
}
}
- if (context_)
+ if (context_) {
host_resolver_ = context_->host_resolver();
-
+ http_auth_handler_factory_ = context_->http_auth_handler_factory();
+ }
}
void SocketStream::Connect() {
@@ -869,8 +871,9 @@ int SocketStream::HandleAuthChallenge(const HttpResponseHeaders* headers) {
}
auth_identity_.invalid = true;
- HttpAuth::ChooseBestChallenge(headers, HttpAuth::AUTH_PROXY, auth_origin,
- &auth_handler_);
+ HttpAuth::ChooseBestChallenge(http_auth_handler_factory_, headers,
+ HttpAuth::AUTH_PROXY,
+ auth_origin, &auth_handler_);
if (!auth_handler_) {
LOG(ERROR) << "Can't perform auth to the proxy " << auth_origin;
return ERR_TUNNEL_CONNECTION_FAILED;
diff --git a/net/socket_stream/socket_stream.h b/net/socket_stream/socket_stream.h
index cf6a6b0..5b1ae3e 100644
--- a/net/socket_stream/socket_stream.h
+++ b/net/socket_stream/socket_stream.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -30,6 +30,7 @@ namespace net {
class AuthChallengeInfo;
class ClientSocketFactory;
class HostResolver;
+class HttpAuthHandlerFactory;
class LoadLog;
class SSLConfigService;
class SingleRequestHostResolver;
@@ -266,6 +267,7 @@ class SocketStream : public base::RefCountedThreadSafe<SocketStream> {
State next_state_;
scoped_refptr<HostResolver> host_resolver_;
+ HttpAuthHandlerFactory* http_auth_handler_factory_;
ClientSocketFactory* factory_;
ProxyMode proxy_mode_;