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

Side by Side Diff: net/socket/ssl_client_socket.h

Issue 353713005: Implements new, more robust design for communicating between SSLConnectJobs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed the structure of pending_sockets_and_callbacks_ and made cl compatible with nss. (Fixed one… Created 6 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 kNextProtoUnsupported = 0, // The server doesn't support NPN. 74 kNextProtoUnsupported = 0, // The server doesn't support NPN.
75 kNextProtoNegotiated = 1, // We agreed on a protocol. 75 kNextProtoNegotiated = 1, // We agreed on a protocol.
76 kNextProtoNoOverlap = 2, // No protocols in common. We requested 76 kNextProtoNoOverlap = 2, // No protocols in common. We requested
77 // the first protocol in our list. 77 // the first protocol in our list.
78 }; 78 };
79 79
80 // StreamSocket: 80 // StreamSocket:
81 virtual bool WasNpnNegotiated() const OVERRIDE; 81 virtual bool WasNpnNegotiated() const OVERRIDE;
82 virtual NextProto GetNegotiatedProtocol() const OVERRIDE; 82 virtual NextProto GetNegotiatedProtocol() const OVERRIDE;
83 83
84 // Format a unique key for the SSL session cache. This method
85 // is necessary so that all classes create cache keys in a consistent
86 // manner.
87 static std::string FormatSessionCacheKey(std::string host_and_port,
88 std::string ssl_session_cache_shard);
Ryan Sleevi 2014/07/10 19:51:05 From a design perspective, I think this will cause
mshelley 2014/07/10 22:07:15 I implemented this in response to Wan-Teh's commen
89
90 // Returns true if there is a cache entry in the ssl session cache
91 // for the given cache key.
92 //
93 // The cache key consists of a host and port concatenated with a session
94 // cache shard.
95 virtual bool InSessionCache() const = 0;
96
97 // Tells the session cache to monitor this socket's session and inform
98 // its SSLConnectJobMessenger upon the session's connection's completion.
99 virtual void WatchSessionForCompletion(const base::Closure& callback) = 0;
100
101 // Sets the callback to be used if the socket's connection should fail.
102 virtual void SetSocketFailureCallback(const base::Closure& callback) = 0;
103
104 // Marks this socket as the leading connection.
105 virtual void SetIsLeader() = 0;
106
107 // In the case of a failed connection, run the appropriate callback.
108 virtual void OnSocketFailure() = 0;
109
84 // Gets the SSL CertificateRequest info of the socket after Connect failed 110 // Gets the SSL CertificateRequest info of the socket after Connect failed
85 // with ERR_SSL_CLIENT_AUTH_CERT_NEEDED. 111 // with ERR_SSL_CLIENT_AUTH_CERT_NEEDED.
86 virtual void GetSSLCertRequestInfo( 112 virtual void GetSSLCertRequestInfo(
87 SSLCertRequestInfo* cert_request_info) = 0; 113 SSLCertRequestInfo* cert_request_info) = 0;
88 114
89 // Get the application level protocol that we negotiated with the server. 115 // Get the application level protocol that we negotiated with the server.
90 // *proto is set to the resulting protocol (n.b. that the string may have 116 // *proto is set to the resulting protocol (n.b. that the string may have
91 // embedded NULs). 117 // embedded NULs).
92 // kNextProtoUnsupported: *proto is cleared. 118 // kNextProtoUnsupported: *proto is cleared.
93 // kNextProtoNegotiated: *proto is set to the negotiated protocol. 119 // kNextProtoNegotiated: *proto is set to the negotiated protocol.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 virtual ServerBoundCertService* GetServerBoundCertService() const = 0; 152 virtual ServerBoundCertService* GetServerBoundCertService() const = 0;
127 153
128 // Returns true if a channel ID was sent on this connection. 154 // Returns true if a channel ID was sent on this connection.
129 // This may be useful for protocols, like SPDY, which allow the same 155 // This may be useful for protocols, like SPDY, which allow the same
130 // connection to be shared between multiple domains, each of which need 156 // connection to be shared between multiple domains, each of which need
131 // a channel ID. 157 // a channel ID.
132 // 158 //
133 // Public for ssl_client_socket_openssl_unittest.cc. 159 // Public for ssl_client_socket_openssl_unittest.cc.
134 virtual bool WasChannelIDSent() const; 160 virtual bool WasChannelIDSent() const;
135 161
162 // Enable SSLConnectJob waiting if |enable| is true.
163 static NET_EXPORT void EnableConnectJobWaiting(bool enable);
164
165 static NET_EXPORT bool GetEnableConnectJobWaiting();
Ryan Sleevi 2014/07/10 19:51:05 I realize this is a comment late-to-the-game, but
mshelley 2014/07/10 22:07:15 Done.
166
136 protected: 167 protected:
137 virtual void set_channel_id_sent(bool channel_id_sent); 168 virtual void set_channel_id_sent(bool channel_id_sent);
138 169
139 virtual void set_signed_cert_timestamps_received( 170 virtual void set_signed_cert_timestamps_received(
140 bool signed_cert_timestamps_received); 171 bool signed_cert_timestamps_received);
141 172
142 virtual void set_stapled_ocsp_response_received( 173 virtual void set_stapled_ocsp_response_received(
143 bool stapled_ocsp_response_received); 174 bool stapled_ocsp_response_received);
144 175
145 // Records histograms for channel id support during full handshakes - resumed 176 // Records histograms for channel id support during full handshakes - resumed
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // True if NPN successfully negotiated SPDY. 209 // True if NPN successfully negotiated SPDY.
179 bool was_spdy_negotiated_; 210 bool was_spdy_negotiated_;
180 // Protocol that we negotiated with the server. 211 // Protocol that we negotiated with the server.
181 NextProto protocol_negotiated_; 212 NextProto protocol_negotiated_;
182 // True if a channel ID was sent. 213 // True if a channel ID was sent.
183 bool channel_id_sent_; 214 bool channel_id_sent_;
184 // True if SCTs were received via a TLS extension. 215 // True if SCTs were received via a TLS extension.
185 bool signed_cert_timestamps_received_; 216 bool signed_cert_timestamps_received_;
186 // True if a stapled OCSP response was received. 217 // True if a stapled OCSP response was received.
187 bool stapled_ocsp_response_received_; 218 bool stapled_ocsp_response_received_;
219
220 static bool enable_connect_job_waiting_;
188 }; 221 };
189 222
190 } // namespace net 223 } // namespace net
191 224
192 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ 225 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698