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

Side by Side Diff: net/http/http_auth_cache.cc

Issue 351833002: Add support for clearing the HTTP auth cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 unified diff | Download patch
« no previous file with comments | « net/http/http_auth_cache.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « net/http/http_auth_cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698