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

Unified Diff: net/http/http_auth_handler.cc

Issue 1157333005: [net/http auth] Use strings to identify authentication schemes. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « net/http/http_auth_handler.h ('k') | net/http/http_auth_handler_basic.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_auth_handler.cc
diff --git a/net/http/http_auth_handler.cc b/net/http/http_auth_handler.cc
index 4de2226caa24c1b0d1c571e72d93e7a60429ecec..2185e4f7dad8b43b3cd875e1527d6189e724c68a 100644
--- a/net/http/http_auth_handler.cc
+++ b/net/http/http_auth_handler.cc
@@ -7,17 +7,13 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/logging.h"
+#include "base/strings/string_util.h"
#include "net/base/net_errors.h"
#include "net/http/http_auth_challenge_tokenizer.h"
namespace net {
-HttpAuthHandler::HttpAuthHandler()
- : auth_scheme_(HttpAuth::AUTH_SCHEME_MAX),
- score_(-1),
- target_(HttpAuth::AUTH_NONE),
- properties_(-1) {
-}
+HttpAuthHandler::HttpAuthHandler() : target_(HttpAuth::AUTH_NONE) {}
HttpAuthHandler::~HttpAuthHandler() {
}
@@ -29,19 +25,16 @@ bool HttpAuthHandler::InitFromChallenge(
const BoundNetLog& net_log) {
origin_ = origin;
target_ = target;
- score_ = -1;
- properties_ = -1;
net_log_ = net_log;
auth_challenge_ = challenge->challenge_text();
bool ok = Init(challenge);
- // Init() is expected to set the scheme, realm, score, and properties. The
- // realm may be empty.
- DCHECK(!ok || score_ != -1);
- DCHECK(!ok || properties_ != -1);
- DCHECK(!ok || auth_scheme_ != HttpAuth::AUTH_SCHEME_MAX);
-
+ // Init() is expected to set the scheme, realm, and properties. The realm may
+ // be empty.
+ DCHECK_IMPLIES(ok,
+ HttpUtil::IsToken(auth_scheme_.begin(), auth_scheme_.end()) &&
+ base::ToLowerASCII(auth_scheme_) == auth_scheme_);
return ok;
}
« no previous file with comments | « net/http/http_auth_handler.h ('k') | net/http/http_auth_handler_basic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698