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

Side by Side Diff: net/base/ssl_client_auth_cache.cc

Issue 132004: Add a simple cache of certificates for SSL client authentication.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Upload before checkin Created 11 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 | Annotate | Revision Log
« no previous file with comments | « net/base/ssl_client_auth_cache.h ('k') | net/base/ssl_client_auth_cache_unittest.cc » ('j') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/ftp/ftp_auth_cache.h" 5 #include "net/base/ssl_client_auth_cache.h"
6
7 #include "base/string_util.h"
8 #include "googleurl/src/gurl.h"
9 6
10 namespace net { 7 namespace net {
11 8
12 AuthData* FtpAuthCache::Lookup(const GURL& origin) { 9 X509Certificate* SSLClientAuthCache::Lookup(const std::string& server) {
13 AuthCacheMap::iterator iter = cache_.find(MakeKey(origin)); 10 AuthCacheMap::iterator iter = cache_.find(server);
14 return (iter == cache_.end()) ? NULL : iter->second; 11 return (iter == cache_.end()) ? NULL : iter->second;
15 } 12 }
16 13
17 void FtpAuthCache::Add(const GURL& origin, AuthData* value) { 14 void SSLClientAuthCache::Add(const std::string& server,
18 cache_[MakeKey(origin)] = value; 15 X509Certificate* value) {
16 cache_[server] = value;
19 17
20 // TODO(eroman): enforce a maximum number of entries. 18 // TODO(wtc): enforce a maximum number of entries.
21 } 19 }
22 20
23 void FtpAuthCache::Remove(const GURL& origin) { 21 void SSLClientAuthCache::Remove(const std::string& server) {
24 cache_.erase(MakeKey(origin)); 22 cache_.erase(server);
25 }
26
27 // static
28 FtpAuthCache::AuthCacheKey FtpAuthCache::MakeKey(const GURL& origin) {
29 DCHECK(origin.SchemeIs("ftp"));
30 DCHECK(origin.GetOrigin() == origin);
31 return origin.spec();
32 } 23 }
33 24
34 } // namespace net 25 } // namespace net
OLDNEW
« no previous file with comments | « net/base/ssl_client_auth_cache.h ('k') | net/base/ssl_client_auth_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698