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

Unified Diff: net/http/http_auth_cache.cc

Issue 1949004: Added authentication scheme as key to HttpAuthCache. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Fixed nits from eroman. Created 10 years, 7 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 a7e23097aa43fd31482cc7cf8d80e38ea7231023..2be2198aad4c90604a57eb4b639152dc917b75d1 100644
--- a/net/http/http_auth_cache.cc
+++ b/net/http/http_auth_cache.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -60,13 +60,15 @@ struct IsEnclosedBy {
namespace net {
// Performance: O(n), where n is the number of realm entries.
-HttpAuthCache::Entry* HttpAuthCache::LookupByRealm(const GURL& origin,
- const std::string& realm) {
+HttpAuthCache::Entry* HttpAuthCache::Lookup(const GURL& origin,
+ const std::string& realm,
+ const std::string& scheme) {
CheckOriginIsValid(origin);
// Linear scan through the realm entries.
for (EntryList::iterator it = entries_.begin(); it != entries_.end(); ++it) {
- if (it->origin() == origin && it->realm() == realm)
+ if (it->origin() == origin && it->realm() == realm &&
+ it->scheme() == scheme)
return &(*it);
}
return NULL; // No realm entry found.
@@ -103,7 +105,8 @@ HttpAuthCache::Entry* HttpAuthCache::Add(const GURL& origin,
CheckPathIsValid(path);
// Check for existing entry (we will re-use it if present).
- HttpAuthCache::Entry* entry = LookupByRealm(origin, handler->realm());
+ HttpAuthCache::Entry* entry = Lookup(origin, handler->realm(),
+ handler->scheme());
if (!entry) {
// Failsafe to prevent unbounded memory growth of the cache.
@@ -155,10 +158,12 @@ bool HttpAuthCache::Entry::HasEnclosingPath(const std::string& dir) {
bool HttpAuthCache::Remove(const GURL& origin,
const std::string& realm,
+ const std::string& scheme,
const std::wstring& username,
const std::wstring& password) {
for (EntryList::iterator it = entries_.begin(); it != entries_.end(); ++it) {
- if (it->origin() == origin && it->realm() == realm) {
+ if (it->origin() == origin && it->realm() == realm &&
+ it->scheme() == scheme) {
if (username == it->username() && password == it->password()) {
entries_.erase(it);
return true;
« 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