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

Unified Diff: net/http/http_auth_challenge_tokenizer.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_challenge_tokenizer.h ('k') | net/http/http_auth_challenge_tokenizer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_auth_challenge_tokenizer.cc
diff --git a/net/http/http_auth_challenge_tokenizer.cc b/net/http/http_auth_challenge_tokenizer.cc
index 75c2d673574bbb9d4743bf620cca5c740892f9d7..65e1b2f25f74454760898f1c3f65e33053c7c69c 100644
--- a/net/http/http_auth_challenge_tokenizer.cc
+++ b/net/http/http_auth_challenge_tokenizer.cc
@@ -5,6 +5,8 @@
#include "net/http/http_auth_challenge_tokenizer.h"
#include "base/strings/string_tokenizer.h"
+#include "base/strings/string_util.h"
+#include "net/http/http_util.h"
namespace net {
@@ -61,4 +63,17 @@ void HttpAuthChallengeTokenizer::Init(std::string::const_iterator begin,
HttpUtil::TrimLWS(&params_begin_, &params_end_);
}
+std::string HttpAuthChallengeTokenizer::NormalizedScheme() const {
+ if (!HttpUtil::IsToken(scheme_begin_, scheme_end_))
+ return std::string();
+ return base::ToLowerASCII(base::StringPiece(scheme_begin_, scheme_end_));
+}
+
+bool HttpAuthChallengeTokenizer::SchemeIs(
+ const base::StringPiece& scheme) const {
+ DCHECK(base::ToLowerASCII(scheme) == scheme);
+ return base::LowerCaseEqualsASCII(
+ base::StringPiece(scheme_begin_, scheme_end_), scheme);
+}
+
} // namespace net
« no previous file with comments | « net/http/http_auth_challenge_tokenizer.h ('k') | net/http/http_auth_challenge_tokenizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698