| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/http/http_auth_cache.h" | 5 #include "net/http/http_auth_cache.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 | 10 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 if (credentials.Equals(it->credentials())) { | 242 if (credentials.Equals(it->credentials())) { |
| 243 entries_.erase(it); | 243 entries_.erase(it); |
| 244 return true; | 244 return true; |
| 245 } | 245 } |
| 246 return false; | 246 return false; |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 return false; | 249 return false; |
| 250 } | 250 } |
| 251 | 251 |
| 252 void HttpAuthCache::Clear() { |
| 253 entries_.clear(); |
| 254 } |
| 255 |
| 252 bool HttpAuthCache::UpdateStaleChallenge(const GURL& origin, | 256 bool HttpAuthCache::UpdateStaleChallenge(const GURL& origin, |
| 253 const std::string& realm, | 257 const std::string& realm, |
| 254 HttpAuth::Scheme scheme, | 258 HttpAuth::Scheme scheme, |
| 255 const std::string& auth_challenge) { | 259 const std::string& auth_challenge) { |
| 256 HttpAuthCache::Entry* entry = Lookup(origin, realm, scheme); | 260 HttpAuthCache::Entry* entry = Lookup(origin, realm, scheme); |
| 257 if (!entry) | 261 if (!entry) |
| 258 return false; | 262 return false; |
| 259 entry->UpdateStaleChallenge(auth_challenge); | 263 entry->UpdateStaleChallenge(auth_challenge); |
| 260 entry->last_use_time_ = base::TimeTicks::Now(); | 264 entry->last_use_time_ = base::TimeTicks::Now(); |
| 261 return true; | 265 return true; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 272 // Copy all other paths. | 276 // Copy all other paths. |
| 273 for (Entry::PathList::const_reverse_iterator it2 = ++it->paths_.rbegin(); | 277 for (Entry::PathList::const_reverse_iterator it2 = ++it->paths_.rbegin(); |
| 274 it2 != it->paths_.rend(); ++it2) | 278 it2 != it->paths_.rend(); ++it2) |
| 275 entry->AddPath(*it2); | 279 entry->AddPath(*it2); |
| 276 // Copy nonce count (for digest authentication). | 280 // Copy nonce count (for digest authentication). |
| 277 entry->nonce_count_ = it->nonce_count_; | 281 entry->nonce_count_ = it->nonce_count_; |
| 278 } | 282 } |
| 279 } | 283 } |
| 280 | 284 |
| 281 } // namespace net | 285 } // namespace net |
| OLD | NEW |