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

Unified Diff: net/http/http_auth_multi_round_parse.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_ntlm.cc ('k') | net/http/http_auth_scheme_set.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_auth_multi_round_parse.cc
diff --git a/net/http/http_auth_multi_round_parse.cc b/net/http/http_auth_multi_round_parse.cc
index 1d0edac08b899b9c4db337bdf09a7f81a31f4add..bc41044be3c73b129aabf66d50c56cbaf5e32660 100644
--- a/net/http/http_auth_multi_round_parse.cc
+++ b/net/http/http_auth_multi_round_parse.cc
@@ -9,24 +9,11 @@
namespace net {
-namespace {
-
-// Check that the scheme in the challenge matches the expected scheme
-bool SchemeIsValid(const std::string& scheme,
- HttpAuthChallengeTokenizer* challenge) {
- // There is no guarantee that challenge->scheme() is valid ASCII, but
- // LowerCaseEqualsASCII will do the right thing even if it isn't.
- return base::LowerCaseEqualsASCII(challenge->scheme(),
- base::ToLowerASCII(scheme));
-}
-
-} // namespace
-
HttpAuth::AuthorizationResult ParseFirstRoundChallenge(
const std::string& scheme,
HttpAuthChallengeTokenizer* challenge) {
// Verify the challenge's auth-scheme.
- if (!SchemeIsValid(scheme, challenge))
+ if (!challenge->SchemeIs(base::ToLowerASCII(scheme)))
return HttpAuth::AUTHORIZATION_RESULT_INVALID;
std::string encoded_auth_token = challenge->base64_param();
@@ -42,7 +29,7 @@ HttpAuth::AuthorizationResult ParseLaterRoundChallenge(
std::string* encoded_token,
std::string* decoded_token) {
// Verify the challenge's auth-scheme.
- if (!SchemeIsValid(scheme, challenge))
+ if (!challenge->SchemeIs(base::ToLowerASCII(scheme)))
return HttpAuth::AUTHORIZATION_RESULT_INVALID;
*encoded_token = challenge->base64_param();
« no previous file with comments | « net/http/http_auth_handler_ntlm.cc ('k') | net/http/http_auth_scheme_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698