Chromium Code Reviews| 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& 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 session_cache_shard(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 // session_cache_shard is an opaque string that identifies a shard of the | |
| 56 // session cache. SSL sockets with the same session_cache_shard may resume | |
|
wtc
2011/12/10 01:22:37
session cache => SSL session cache
agl
2011/12/12 22:18:20
Done.
| |
| 57 // each other's SSL sessions but we'll never sessions between shards. | |
| 58 const std::string 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 | 117 |
| 112 static const char* NextProtoStatusToString( | 118 static const char* NextProtoStatusToString( |
| 113 const SSLClientSocket::NextProtoStatus status); | 119 const SSLClientSocket::NextProtoStatus status); |
| 114 | 120 |
| 115 // Can be used with the second argument(|server_protos|) of |GetNextProto| to | 121 // Can be used with the second argument(|server_protos|) of |GetNextProto| to |
| 116 // construct a comma separated string of server advertised protocols. | 122 // construct a comma separated string of server advertised protocols. |
| 117 static std::string ServerProtosToString(const std::string& server_protos); | 123 static std::string ServerProtosToString(const std::string& server_protos); |
| 118 | 124 |
| 119 static bool IgnoreCertError(int error, int load_flags); | 125 static bool IgnoreCertError(int error, int load_flags); |
| 120 | 126 |
| 127 // ClearSessionCache clears the SSL session cache, used to resume SSL | |
| 128 // sessions. | |
| 129 static void ClearSessionCache(); | |
| 130 | |
| 121 virtual bool was_npn_negotiated() const; | 131 virtual bool was_npn_negotiated() const; |
| 122 | 132 |
| 123 virtual bool set_was_npn_negotiated(bool negotiated); | 133 virtual bool set_was_npn_negotiated(bool negotiated); |
| 124 | 134 |
| 125 virtual bool was_spdy_negotiated() const; | 135 virtual bool was_spdy_negotiated() const; |
| 126 | 136 |
| 127 virtual bool set_was_spdy_negotiated(bool negotiated); | 137 virtual bool set_was_spdy_negotiated(bool negotiated); |
| 128 | 138 |
| 129 // Returns true if an origin bound certificate was sent on this connection. | 139 // Returns true if an origin bound certificate was sent on this connection. |
| 130 // This may be useful for protocols, like SPDY, which allow the same | 140 // This may be useful for protocols, like SPDY, which allow the same |
| 131 // connection to be shared between multiple origins, each of which need | 141 // connection to be shared between multiple origins, each of which need |
| 132 // an origin bound certificate. | 142 // an origin bound certificate. |
| 133 virtual bool was_origin_bound_cert_sent() const; | 143 virtual bool was_origin_bound_cert_sent() const; |
| 134 | 144 |
| 135 virtual bool set_was_origin_bound_cert_sent(bool sent); | 145 virtual bool set_was_origin_bound_cert_sent(bool sent); |
| 136 | 146 |
| 137 private: | 147 private: |
| 138 // True if NPN was responded to, independent of selecting SPDY or HTTP. | 148 // True if NPN was responded to, independent of selecting SPDY or HTTP. |
| 139 bool was_npn_negotiated_; | 149 bool was_npn_negotiated_; |
| 140 // True if NPN successfully negotiated SPDY. | 150 // True if NPN successfully negotiated SPDY. |
| 141 bool was_spdy_negotiated_; | 151 bool was_spdy_negotiated_; |
| 142 // True if an origin bound certificate was sent. | 152 // True if an origin bound certificate was sent. |
| 143 bool was_origin_bound_cert_sent_; | 153 bool was_origin_bound_cert_sent_; |
| 144 }; | 154 }; |
| 145 | 155 |
| 146 } // namespace net | 156 } // namespace net |
| 147 | 157 |
| 148 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 158 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
| OLD | NEW |