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

Unified Diff: net/http/http_auth_challenge_tokenizer.h

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_cache_unittest.cc ('k') | net/http/http_auth_challenge_tokenizer.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.h
diff --git a/net/http/http_auth_challenge_tokenizer.h b/net/http/http_auth_challenge_tokenizer.h
index ef5bf12c2b255d579e128df64761765983c7188d..5771afa5625036154febdca8352b0160076b91c4 100644
--- a/net/http/http_auth_challenge_tokenizer.h
+++ b/net/http/http_auth_challenge_tokenizer.h
@@ -31,12 +31,18 @@ class NET_EXPORT_PRIVATE HttpAuthChallengeTokenizer {
return std::string(begin_, end_);
}
- // Get the auth scheme of the challenge.
+ // Get the auth scheme of the challenge. Could potentially be invalid.
std::string::const_iterator scheme_begin() const { return scheme_begin_; }
std::string::const_iterator scheme_end() const { return scheme_end_; }
- std::string scheme() const {
- return std::string(scheme_begin_, scheme_end_);
- }
+
+ // Return the normalized scheme for the challenge. Will be empty if the
+ // challenge was invalid. RFC 7235 requires a valid scheme to be a token. A
+ // normalized scheme is a lower case ASCII token.
+ std::string NormalizedScheme() const;
+
+ // Returns true if the scheme of the challenge is |scheme|. |scheme| is
+ // expected to be a valid scheme.
+ bool SchemeIs(const base::StringPiece& scheme) const;
std::string::const_iterator params_begin() const { return params_begin_; }
std::string::const_iterator params_end() const { return params_end_; }
« no previous file with comments | « net/http/http_auth_cache_unittest.cc ('k') | net/http/http_auth_challenge_tokenizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698