| Index: net/http/http_auth_handler_basic.cc
|
| diff --git a/net/http/http_auth_handler_basic.cc b/net/http/http_auth_handler_basic.cc
|
| index 7525cb982e1d6beeab8e15ddb6ded009d6765838..fd900a42512cfd95ba2ece01156f9b5ba921d5a5 100644
|
| --- a/net/http/http_auth_handler_basic.cc
|
| +++ b/net/http/http_auth_handler_basic.cc
|
| @@ -18,7 +18,7 @@ namespace net {
|
|
|
| namespace {
|
|
|
| -const char* const kBasicSchemeName = "basic";
|
| +const char kBasicSchemeName[] = "basic";
|
|
|
| // Parses a realm from an auth challenge, and converts to UTF8-encoding.
|
| // Returns whether the realm is invalid or the parameters are invalid.
|
| @@ -55,10 +55,12 @@ bool ParseRealm(const HttpAuthChallengeTokenizer& tokenizer,
|
| } // namespace
|
|
|
| int HttpAuthHandlerBasic::Init(const HttpAuthChallengeTokenizer& challenge) {
|
| - auth_scheme_ = kBasicSchemeName;
|
| return ParseChallenge(challenge);
|
| }
|
|
|
| +HttpAuthHandlerBasic::HttpAuthHandlerBasic()
|
| + : HttpAuthHandler(kBasicSchemeName) {}
|
| +
|
| int HttpAuthHandlerBasic::ParseChallenge(
|
| const HttpAuthChallengeTokenizer& challenge) {
|
| // Verify the challenge's auth-scheme.
|
| @@ -107,22 +109,29 @@ HttpAuthHandlerBasic::Factory::Factory() {
|
| HttpAuthHandlerBasic::Factory::~Factory() {
|
| }
|
|
|
| -int HttpAuthHandlerBasic::Factory::CreateAuthHandler(
|
| - const HttpAuthChallengeTokenizer& challenge,
|
| +scoped_ptr<HttpAuthHandler>
|
| +HttpAuthHandlerBasic::Factory::CreateAuthHandlerForScheme(
|
| + const std::string& scheme) {
|
| + DCHECK(HttpAuth::IsValidNormalizedScheme(scheme));
|
| + if (scheme == kBasicSchemeName)
|
| + return make_scoped_ptr(new HttpAuthHandlerBasic());
|
| + return scoped_ptr<HttpAuthHandler>();
|
| +}
|
| +
|
| +scoped_ptr<HttpAuthHandler>
|
| +HttpAuthHandlerBasic::Factory::CreateAndInitPreemptiveAuthHandler(
|
| + HttpAuthCache::Entry* cache_entry,
|
| + const HttpAuthChallengeTokenizer& tokenizer,
|
| HttpAuth::Target target,
|
| - const GURL& origin,
|
| - CreateReason reason,
|
| - int digest_nonce_count,
|
| - const BoundNetLog& net_log,
|
| - scoped_ptr<HttpAuthHandler>* handler) {
|
| - // TODO(cbentzel): Move towards model of parsing in the factory
|
| - // method and only constructing when valid.
|
| - scoped_ptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerBasic());
|
| - int result =
|
| - tmp_handler->HandleInitialChallenge(challenge, target, origin, net_log);
|
| - if (result == OK)
|
| - handler->swap(tmp_handler);
|
| - return result;
|
| + const BoundNetLog& net_log) {
|
| + if (cache_entry->scheme() != kBasicSchemeName)
|
| + return scoped_ptr<HttpAuthHandler>();
|
| + scoped_ptr<HttpAuthHandler> handler(new HttpAuthHandlerBasic());
|
| + int rv = handler->HandleInitialChallenge(tokenizer, target,
|
| + cache_entry->origin(), net_log);
|
| + if (rv == OK)
|
| + return handler;
|
| + return scoped_ptr<HttpAuthHandler>();
|
| }
|
|
|
| } // namespace net
|
|
|