| Index: net/ftp/ftp_auth_cache.cc
|
| diff --git a/net/ftp/ftp_auth_cache.cc b/net/ftp/ftp_auth_cache.cc
|
| index c29146a1536db7c69b42399a313928615756e091..d3bff905a54e4dedf7a67a306a0cacd2ec8b9d4d 100644
|
| --- a/net/ftp/ftp_auth_cache.cc
|
| +++ b/net/ftp/ftp_auth_cache.cc
|
| @@ -12,20 +12,25 @@ namespace net {
|
| // static
|
| const size_t FtpAuthCache::kMaxEntries = 10;
|
|
|
| -AuthData* FtpAuthCache::Lookup(const GURL& origin) {
|
| - Entry* entry = LookupEntry(origin);
|
| - return (entry ? entry->auth_data : NULL);
|
| +FtpAuthCache::Entry* FtpAuthCache::Lookup(const GURL& origin) {
|
| + for (EntryList::iterator it = entries_.begin(); it != entries_.end(); ++it) {
|
| + if (it->origin == origin)
|
| + return &(*it);
|
| + }
|
| + return NULL;
|
| }
|
|
|
| -void FtpAuthCache::Add(const GURL& origin, AuthData* auth_data) {
|
| +void FtpAuthCache::Add(const GURL& origin, const std::wstring& username,
|
| + const std::wstring& password) {
|
| DCHECK(origin.SchemeIs("ftp"));
|
| DCHECK_EQ(origin.GetOrigin(), origin);
|
|
|
| - Entry* entry = LookupEntry(origin);
|
| + Entry* entry = Lookup(origin);
|
| if (entry) {
|
| - entry->auth_data = auth_data;
|
| + entry->username = username;
|
| + entry->password = password;
|
| } else {
|
| - entries_.push_front(Entry(origin, auth_data));
|
| + entries_.push_front(Entry(origin, username, password));
|
|
|
| // Prevent unbound memory growth of the cache.
|
| if (entries_.size() > kMaxEntries)
|
| @@ -33,22 +38,16 @@ void FtpAuthCache::Add(const GURL& origin, AuthData* auth_data) {
|
| }
|
| }
|
|
|
| -void FtpAuthCache::Remove(const GURL& origin) {
|
| +void FtpAuthCache::Remove(const GURL& origin, const std::wstring& username,
|
| + const std::wstring& password) {
|
| for (EntryList::iterator it = entries_.begin(); it != entries_.end(); ++it) {
|
| - if (it->origin == origin) {
|
| + if (it->origin == origin && it->username == username &&
|
| + it->password == password) {
|
| entries_.erase(it);
|
| - DCHECK(!LookupEntry(origin));
|
| + DCHECK(!Lookup(origin));
|
| return;
|
| }
|
| }
|
| }
|
|
|
| -FtpAuthCache::Entry* FtpAuthCache::LookupEntry(const GURL& origin) {
|
| - for (EntryList::iterator it = entries_.begin(); it != entries_.end(); ++it) {
|
| - if (it->origin == origin)
|
| - return &(*it);
|
| - }
|
| - return NULL;
|
| -}
|
| -
|
| } // namespace net
|
|
|