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

Unified Diff: net/http/http_auth_cache.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_cache.h ('k') | net/http/http_auth_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_auth_cache.cc
diff --git a/net/http/http_auth_cache.cc b/net/http/http_auth_cache.cc
index d76d3ed40cd5dd912a87938c13c5bebdef952c99..d3eec51a2caed7acc64342c3c14e420c8ffd6305 100644
--- a/net/http/http_auth_cache.cc
+++ b/net/http/http_auth_cache.cc
@@ -80,8 +80,9 @@ HttpAuthCache::~HttpAuthCache() {
// Performance: O(n), where n is the number of realm entries.
HttpAuthCache::Entry* HttpAuthCache::Lookup(const GURL& origin,
const std::string& realm,
- HttpAuth::Scheme scheme) {
+ const std::string& scheme) {
CheckOriginIsValid(origin);
+ DCHECK(HttpAuth::IsValidNormalizedScheme(scheme));
int entries_examined = 0;
// Linear scan through the realm entries.
@@ -135,12 +136,13 @@ HttpAuthCache::Entry* HttpAuthCache::LookupByPath(const GURL& origin,
HttpAuthCache::Entry* HttpAuthCache::Add(const GURL& origin,
const std::string& realm,
- HttpAuth::Scheme scheme,
+ const std::string& scheme,
const std::string& auth_challenge,
const AuthCredentials& credentials,
const std::string& path) {
CheckOriginIsValid(origin);
CheckPathIsValid(path);
+ DCHECK(HttpAuth::IsValidNormalizedScheme(scheme));
base::TimeTicks now = base::TimeTicks::Now();
@@ -189,10 +191,7 @@ void HttpAuthCache::Entry::UpdateStaleChallenge(
nonce_count_ = 1;
}
-HttpAuthCache::Entry::Entry()
- : scheme_(HttpAuth::AUTH_SCHEME_MAX),
- nonce_count_(0) {
-}
+HttpAuthCache::Entry::Entry() : nonce_count_(0) {}
void HttpAuthCache::Entry::AddPath(const std::string& path) {
std::string parent_dir = GetParentDirectory(path);
@@ -235,8 +234,9 @@ bool HttpAuthCache::Entry::HasEnclosingPath(const std::string& dir,
bool HttpAuthCache::Remove(const GURL& origin,
const std::string& realm,
- HttpAuth::Scheme scheme,
+ const std::string& scheme,
const AuthCredentials& credentials) {
+ DCHECK(HttpAuth::IsValidNormalizedScheme(scheme));
for (EntryList::iterator it = entries_.begin(); it != entries_.end(); ++it) {
if (it->origin() == origin && it->realm() == realm &&
it->scheme() == scheme) {
@@ -256,8 +256,9 @@ void HttpAuthCache::Clear() {
bool HttpAuthCache::UpdateStaleChallenge(const GURL& origin,
const std::string& realm,
- HttpAuth::Scheme scheme,
+ const std::string& scheme,
const std::string& auth_challenge) {
+ DCHECK(HttpAuth::IsValidNormalizedScheme(scheme));
HttpAuthCache::Entry* entry = Lookup(origin, realm, scheme);
if (!entry)
return false;
« no previous file with comments | « net/http/http_auth_cache.h ('k') | net/http/http_auth_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698