OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/socket/ssl_client_socket.h" | 5 #include "net/socket/ssl_client_socket.h" |
6 | 6 |
| 7 #if defined(OS_WIN) |
| 8 #include "net/socket/ssl_client_socket_nss.h" |
| 9 #elif defined(USE_OPENSSL) |
| 10 #include "net/socket/ssl_client_socket_openssl.h" |
| 11 #elif defined(USE_NSS) |
| 12 #include "net/socket/ssl_client_socket_nss.h" |
| 13 #elif defined(OS_MACOSX) |
| 14 #include "net/socket/ssl_client_socket_nss.h" |
| 15 #endif |
| 16 |
7 namespace net { | 17 namespace net { |
8 | 18 |
9 SSLClientSocket::SSLClientSocket() | 19 SSLClientSocket::SSLClientSocket() |
10 : was_npn_negotiated_(false), | 20 : was_npn_negotiated_(false), |
11 was_spdy_negotiated_(false) { | 21 was_spdy_negotiated_(false) { |
12 } | 22 } |
13 | 23 |
14 SSLClientSocket::NextProto SSLClientSocket::NextProtoFromString( | 24 SSLClientSocket::NextProto SSLClientSocket::NextProtoFromString( |
15 const std::string& proto_string) { | 25 const std::string& proto_string) { |
16 if (proto_string == "http1.1" || proto_string == "http/1.1") { | 26 if (proto_string == "http1.1" || proto_string == "http/1.1") { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 62 } |
53 | 63 |
54 bool SSLClientSocket::was_spdy_negotiated() const { | 64 bool SSLClientSocket::was_spdy_negotiated() const { |
55 return was_spdy_negotiated_; | 65 return was_spdy_negotiated_; |
56 } | 66 } |
57 | 67 |
58 bool SSLClientSocket::set_was_spdy_negotiated(bool negotiated) { | 68 bool SSLClientSocket::set_was_spdy_negotiated(bool negotiated) { |
59 return was_spdy_negotiated_ = negotiated; | 69 return was_spdy_negotiated_ = negotiated; |
60 } | 70 } |
61 | 71 |
| 72 // Default mechanism for clearing the SSL session cache, which is |
| 73 // to use the NSS function. |
| 74 void DefaultClearSSLSessionCache() { |
| 75 #if defined(OS_WIN) |
| 76 return SSLClientSocketNSS::ClearSessionCache(); |
| 77 #elif defined(USE_OPENSSL) |
| 78 // no-op |
| 79 #elif defined(USE_NSS) |
| 80 return SSLClientSocketNSS::ClearSessionCache(); |
| 81 #elif defined(OS_MACOSX) |
| 82 return SSLClientSocketNSS::ClearSessionCache(); |
| 83 #else |
| 84 NOTIMPLEMENTED(); |
| 85 #endif |
| 86 } |
| 87 |
| 88 // Default mechanism for clearing the SSL session cache, which is not actually |
| 89 // definted on mac/windows. |
| 90 void SystemClearSSLSessionCache() { |
| 91 #if defined(OS_WIN) |
| 92 // no-op |
| 93 #elif defined(OS_MACOSX) |
| 94 // no-op |
| 95 #else |
| 96 NOTIMPLEMENTED(); |
| 97 #endif |
| 98 } |
| 99 |
| 100 void (*g_clear_ssl_session_cache)() = |
| 101 DefaultClearSSLSessionCache; |
| 102 |
| 103 void SSLClientSocket::ClearSSLSessionCache() { |
| 104 g_clear_ssl_session_cache(); |
| 105 } |
| 106 |
| 107 void SSLClientSocket::UseSystemClearSSLSessionCache() { |
| 108 g_clear_ssl_session_cache = SystemClearSSLSessionCache; |
| 109 } |
| 110 |
62 } // namespace net | 111 } // namespace net |
OLD | NEW |