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; |