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 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
6 #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 SSLClientSocketContext() | 31 SSLClientSocketContext() |
32 : cert_verifier(NULL), | 32 : cert_verifier(NULL), |
33 origin_bound_cert_service(NULL), | 33 origin_bound_cert_service(NULL), |
34 dns_cert_checker(NULL), | 34 dns_cert_checker(NULL), |
35 ssl_host_info_factory(NULL) {} | 35 ssl_host_info_factory(NULL) {} |
36 | 36 |
37 SSLClientSocketContext(CertVerifier* cert_verifier_arg, | 37 SSLClientSocketContext(CertVerifier* cert_verifier_arg, |
38 OriginBoundCertService* origin_bound_cert_service_arg, | 38 OriginBoundCertService* origin_bound_cert_service_arg, |
39 TransportSecurityState* transport_security_state_arg, | 39 TransportSecurityState* transport_security_state_arg, |
40 DnsCertProvenanceChecker* dns_cert_checker_arg, | 40 DnsCertProvenanceChecker* dns_cert_checker_arg, |
41 SSLHostInfoFactory* ssl_host_info_factory_arg) | 41 SSLHostInfoFactory* ssl_host_info_factory_arg, |
| 42 const std::string& ssl_session_cache_shard_arg) |
42 : cert_verifier(cert_verifier_arg), | 43 : cert_verifier(cert_verifier_arg), |
43 origin_bound_cert_service(origin_bound_cert_service_arg), | 44 origin_bound_cert_service(origin_bound_cert_service_arg), |
44 transport_security_state(transport_security_state_arg), | 45 transport_security_state(transport_security_state_arg), |
45 dns_cert_checker(dns_cert_checker_arg), | 46 dns_cert_checker(dns_cert_checker_arg), |
46 ssl_host_info_factory(ssl_host_info_factory_arg) {} | 47 ssl_host_info_factory(ssl_host_info_factory_arg), |
| 48 ssl_session_cache_shard(ssl_session_cache_shard_arg) {} |
47 | 49 |
48 CertVerifier* cert_verifier; | 50 CertVerifier* cert_verifier; |
49 OriginBoundCertService* origin_bound_cert_service; | 51 OriginBoundCertService* origin_bound_cert_service; |
50 TransportSecurityState* transport_security_state; | 52 TransportSecurityState* transport_security_state; |
51 DnsCertProvenanceChecker* dns_cert_checker; | 53 DnsCertProvenanceChecker* dns_cert_checker; |
52 SSLHostInfoFactory* ssl_host_info_factory; | 54 SSLHostInfoFactory* ssl_host_info_factory; |
| 55 // ssl_session_cache_shard is an opaque string that identifies a shard of the |
| 56 // SSL session cache. SSL sockets with the same ssl_session_cache_shard may |
| 57 // resume each other's SSL sessions but we'll never sessions between shards. |
| 58 const std::string ssl_session_cache_shard; |
53 }; | 59 }; |
54 | 60 |
55 // A client socket that uses SSL as the transport layer. | 61 // A client socket that uses SSL as the transport layer. |
56 // | 62 // |
57 // NOTE: The SSL handshake occurs within the Connect method after a TCP | 63 // NOTE: The SSL handshake occurs within the Connect method after a TCP |
58 // connection is established. If a SSL error occurs during the handshake, | 64 // connection is established. If a SSL error occurs during the handshake, |
59 // Connect will fail. | 65 // Connect will fail. |
60 // | 66 // |
61 class NET_EXPORT SSLClientSocket : public SSLSocket { | 67 class NET_EXPORT SSLClientSocket : public SSLSocket { |
62 public: | 68 public: |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 118 |
113 static const char* NextProtoStatusToString( | 119 static const char* NextProtoStatusToString( |
114 const SSLClientSocket::NextProtoStatus status); | 120 const SSLClientSocket::NextProtoStatus status); |
115 | 121 |
116 // Can be used with the second argument(|server_protos|) of |GetNextProto| to | 122 // Can be used with the second argument(|server_protos|) of |GetNextProto| to |
117 // construct a comma separated string of server advertised protocols. | 123 // construct a comma separated string of server advertised protocols. |
118 static std::string ServerProtosToString(const std::string& server_protos); | 124 static std::string ServerProtosToString(const std::string& server_protos); |
119 | 125 |
120 static bool IgnoreCertError(int error, int load_flags); | 126 static bool IgnoreCertError(int error, int load_flags); |
121 | 127 |
| 128 // ClearSessionCache clears the SSL session cache, used to resume SSL |
| 129 // sessions. |
| 130 static void ClearSessionCache(); |
| 131 |
122 virtual bool was_npn_negotiated() const; | 132 virtual bool was_npn_negotiated() const; |
123 | 133 |
124 virtual bool set_was_npn_negotiated(bool negotiated); | 134 virtual bool set_was_npn_negotiated(bool negotiated); |
125 | 135 |
126 virtual bool was_spdy_negotiated() const; | 136 virtual bool was_spdy_negotiated() const; |
127 | 137 |
128 virtual bool set_was_spdy_negotiated(bool negotiated); | 138 virtual bool set_was_spdy_negotiated(bool negotiated); |
129 | 139 |
130 virtual SSLClientSocket::NextProto next_protocol_negotiated() const; | 140 virtual SSLClientSocket::NextProto next_protocol_negotiated() const; |
131 | 141 |
(...skipping 15 matching lines...) Expand all Loading... |
147 bool was_spdy_negotiated_; | 157 bool was_spdy_negotiated_; |
148 // Protocol that we negotiated with the server. | 158 // Protocol that we negotiated with the server. |
149 SSLClientSocket::NextProto next_protocol_; | 159 SSLClientSocket::NextProto next_protocol_; |
150 // True if an origin bound certificate was sent. | 160 // True if an origin bound certificate was sent. |
151 bool was_origin_bound_cert_sent_; | 161 bool was_origin_bound_cert_sent_; |
152 }; | 162 }; |
153 | 163 |
154 } // namespace net | 164 } // namespace net |
155 | 165 |
156 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 166 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
OLD | NEW |