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

Unified Diff: net/http/http_auth_handler_digest.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_basic.cc ('k') | net/http/http_auth_handler_digest_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_auth_handler_digest.cc
diff --git a/net/http/http_auth_handler_digest.cc b/net/http/http_auth_handler_digest.cc
index a5f96b1e25ffa0feac0aa5706cb0288c81894312..c3d5e1a13b45a72fd1e1384c19c51cbbfeb7b7ca 100644
--- a/net/http/http_auth_handler_digest.cc
+++ b/net/http/http_auth_handler_digest.cc
@@ -23,6 +23,8 @@
namespace net {
+static const char* const kDigestSchemeName = "digest";
+
// Digest authentication is specified in RFC 2617.
// The expanded derivations are listed in the tables below.
@@ -113,7 +115,7 @@ HttpAuth::AuthorizationResult HttpAuthHandlerDigest::HandleAnotherChallenge(
// to differentiate between stale and rejected responses.
// Note that the state of the current handler is not mutated - this way if
// there is a rejection the realm hasn't changed.
- if (!base::LowerCaseEqualsASCII(challenge->scheme(), "digest"))
+ if (!challenge->SchemeIs(kDigestSchemeName))
return HttpAuth::AUTHORIZATION_RESULT_INVALID;
HttpUtil::NameValuePairsIterator parameters = challenge->param_pairs();
@@ -188,9 +190,7 @@ HttpAuthHandlerDigest::~HttpAuthHandlerDigest() {
// webserver was not sending the realm with a BASIC challenge).
bool HttpAuthHandlerDigest::ParseChallenge(
HttpAuthChallengeTokenizer* challenge) {
- auth_scheme_ = HttpAuth::AUTH_SCHEME_DIGEST;
- score_ = 2;
- properties_ = ENCRYPTS_IDENTITY;
+ auth_scheme_ = kDigestSchemeName;
// Initialize to defaults.
stale_ = false;
@@ -199,7 +199,7 @@ bool HttpAuthHandlerDigest::ParseChallenge(
realm_ = original_realm_ = nonce_ = domain_ = opaque_ = std::string();
// FAIL -- Couldn't match auth-scheme.
- if (!base::LowerCaseEqualsASCII(challenge->scheme(), "digest"))
+ if (!challenge->SchemeIs(kDigestSchemeName))
return false;
HttpUtil::NameValuePairsIterator parameters = challenge->param_pairs();
« no previous file with comments | « net/http/http_auth_handler_basic.cc ('k') | net/http/http_auth_handler_digest_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698