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

Unified Diff: net/http/http_auth.cc

Issue 10916272: Remove HttpAuth::Scheme enum in favor of a string. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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.h ('k') | net/http/http_auth_cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_auth.cc
diff --git a/net/http/http_auth.cc b/net/http/http_auth.cc
index 47a13be28b6b931786c365178260676f09666fa6..bbfaf4beac01be5dea8939f91509c848bafa4086 100644
--- a/net/http/http_auth.cc
+++ b/net/http/http_auth.cc
@@ -25,7 +25,7 @@ void HttpAuth::ChooseBestChallenge(
const HttpResponseHeaders* headers,
Target target,
const GURL& origin,
- const std::set<Scheme>& disabled_schemes,
+ const std::set<std::string>& disabled_schemes,
const BoundNetLog& net_log,
scoped_ptr<HttpAuthHandler>* handler) {
DCHECK(http_auth_handler_factory);
@@ -57,16 +57,15 @@ HttpAuth::AuthorizationResult HttpAuth::HandleChallengeResponse(
HttpAuthHandler* handler,
const HttpResponseHeaders* headers,
Target target,
- const std::set<Scheme>& disabled_schemes,
+ const std::set<std::string>& disabled_schemes,
std::string* challenge_used) {
DCHECK(handler);
DCHECK(headers);
DCHECK(challenge_used);
challenge_used->clear();
- HttpAuth::Scheme current_scheme = handler->auth_scheme();
+ std::string current_scheme = handler->auth_scheme();
if (disabled_schemes.find(current_scheme) != disabled_schemes.end())
return HttpAuth::AUTHORIZATION_RESULT_REJECT;
- std::string current_scheme_name = SchemeToString(current_scheme);
const std::string header_name = GetChallengeHeaderName(target);
void* iter = NULL;
std::string challenge;
@@ -74,7 +73,7 @@ HttpAuth::AuthorizationResult HttpAuth::HandleChallengeResponse(
HttpAuth::AUTHORIZATION_RESULT_INVALID;
while (headers->EnumerateHeader(&iter, header_name, &challenge)) {
HttpAuth::ChallengeTokenizer props(challenge.begin(), challenge.end());
- if (!LowerCaseEqualsASCII(props.scheme(), current_scheme_name.c_str()))
+ if (!LowerCaseEqualsASCII(props.scheme(), current_scheme.c_str()))
continue;
authorization_result = handler->HandleAnotherChallenge(&props);
if (authorization_result != HttpAuth::AUTHORIZATION_RESULT_INVALID) {
@@ -175,22 +174,4 @@ std::string HttpAuth::GetAuthTargetString(Target target) {
}
}
-// static
-const char* HttpAuth::SchemeToString(Scheme scheme) {
- static const char* const kSchemeNames[] = {
- "basic",
- "digest",
- "ntlm",
- "negotiate",
- "mock",
- };
- COMPILE_ASSERT(arraysize(kSchemeNames) == AUTH_SCHEME_MAX,
- http_auth_scheme_names_incorrect_size);
- if (scheme < AUTH_SCHEME_BASIC || scheme >= AUTH_SCHEME_MAX) {
- NOTREACHED();
- return "invalid_scheme";
- }
- return kSchemeNames[scheme];
-}
-
} // namespace net
« no previous file with comments | « net/http/http_auth.h ('k') | net/http/http_auth_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698