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 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ |
6 #define NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 namespace net { | 23 namespace net { |
24 | 24 |
25 class ClientSocketFactory; | 25 class ClientSocketFactory; |
26 class ConnectJobFactory; | 26 class ConnectJobFactory; |
27 class DnsRRResolver; | 27 class DnsRRResolver; |
28 class HttpProxyClientSocketPool; | 28 class HttpProxyClientSocketPool; |
29 class HttpProxySocketParams; | 29 class HttpProxySocketParams; |
30 class SOCKSClientSocketPool; | 30 class SOCKSClientSocketPool; |
31 class SOCKSSocketParams; | 31 class SOCKSSocketParams; |
32 class SSLClientSocket; | 32 class SSLClientSocket; |
| 33 class SSLHostInfoFactory; |
33 class TCPClientSocketPool; | 34 class TCPClientSocketPool; |
34 class TCPSocketParams; | 35 class TCPSocketParams; |
35 struct RRResponse; | 36 struct RRResponse; |
36 | 37 |
37 // SSLSocketParams only needs the socket params for the transport socket | 38 // SSLSocketParams only needs the socket params for the transport socket |
38 // that will be used (denoted by |proxy|). | 39 // that will be used (denoted by |proxy|). |
39 class SSLSocketParams : public base::RefCounted<SSLSocketParams> { | 40 class SSLSocketParams : public base::RefCounted<SSLSocketParams> { |
40 public: | 41 public: |
41 SSLSocketParams(const scoped_refptr<TCPSocketParams>& tcp_params, | 42 SSLSocketParams(const scoped_refptr<TCPSocketParams>& tcp_params, |
42 const scoped_refptr<SOCKSSocketParams>& socks_params, | 43 const scoped_refptr<SOCKSSocketParams>& socks_params, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 SSLConnectJob( | 87 SSLConnectJob( |
87 const std::string& group_name, | 88 const std::string& group_name, |
88 const scoped_refptr<SSLSocketParams>& params, | 89 const scoped_refptr<SSLSocketParams>& params, |
89 const base::TimeDelta& timeout_duration, | 90 const base::TimeDelta& timeout_duration, |
90 TCPClientSocketPool* tcp_pool, | 91 TCPClientSocketPool* tcp_pool, |
91 SOCKSClientSocketPool* socks_pool, | 92 SOCKSClientSocketPool* socks_pool, |
92 HttpProxyClientSocketPool* http_proxy_pool, | 93 HttpProxyClientSocketPool* http_proxy_pool, |
93 ClientSocketFactory* client_socket_factory, | 94 ClientSocketFactory* client_socket_factory, |
94 HostResolver* host_resolver, | 95 HostResolver* host_resolver, |
95 DnsRRResolver* dnsrr_resolver, | 96 DnsRRResolver* dnsrr_resolver, |
| 97 SSLHostInfoFactory* ssl_host_info_factory, |
96 Delegate* delegate, | 98 Delegate* delegate, |
97 NetLog* net_log); | 99 NetLog* net_log); |
98 virtual ~SSLConnectJob(); | 100 virtual ~SSLConnectJob(); |
99 | 101 |
100 // ConnectJob methods. | 102 // ConnectJob methods. |
101 virtual LoadState GetLoadState() const; | 103 virtual LoadState GetLoadState() const; |
102 | 104 |
103 virtual void GetAdditionalErrorState(ClientSocketHandle * handle); | 105 virtual void GetAdditionalErrorState(ClientSocketHandle * handle); |
104 | 106 |
105 private: | 107 private: |
(...skipping 27 matching lines...) Expand all Loading... |
133 int DoTunnelConnectComplete(int result); | 135 int DoTunnelConnectComplete(int result); |
134 int DoSSLConnect(); | 136 int DoSSLConnect(); |
135 int DoSSLConnectComplete(int result); | 137 int DoSSLConnectComplete(int result); |
136 | 138 |
137 scoped_refptr<SSLSocketParams> params_; | 139 scoped_refptr<SSLSocketParams> params_; |
138 TCPClientSocketPool* const tcp_pool_; | 140 TCPClientSocketPool* const tcp_pool_; |
139 SOCKSClientSocketPool* const socks_pool_; | 141 SOCKSClientSocketPool* const socks_pool_; |
140 HttpProxyClientSocketPool* const http_proxy_pool_; | 142 HttpProxyClientSocketPool* const http_proxy_pool_; |
141 ClientSocketFactory* const client_socket_factory_; | 143 ClientSocketFactory* const client_socket_factory_; |
142 HostResolver* const resolver_; | 144 HostResolver* const resolver_; |
143 DnsRRResolver* dnsrr_resolver_; | 145 DnsRRResolver* const dnsrr_resolver_; |
| 146 SSLHostInfoFactory* const ssl_host_info_factory_; |
144 | 147 |
145 State next_state_; | 148 State next_state_; |
146 CompletionCallbackImpl<SSLConnectJob> callback_; | 149 CompletionCallbackImpl<SSLConnectJob> callback_; |
147 scoped_ptr<ClientSocketHandle> transport_socket_handle_; | 150 scoped_ptr<ClientSocketHandle> transport_socket_handle_; |
148 scoped_ptr<SSLClientSocket> ssl_socket_; | 151 scoped_ptr<SSLClientSocket> ssl_socket_; |
| 152 scoped_ptr<SSLHostInfo> ssl_host_info_; |
149 | 153 |
150 // The time the DoSSLConnect() method was called. | 154 // The time the DoSSLConnect() method was called. |
151 base::TimeTicks ssl_connect_start_time_; | 155 base::TimeTicks ssl_connect_start_time_; |
152 | 156 |
153 HttpResponseInfo error_response_info_; | 157 HttpResponseInfo error_response_info_; |
154 | 158 |
155 DISALLOW_COPY_AND_ASSIGN(SSLConnectJob); | 159 DISALLOW_COPY_AND_ASSIGN(SSLConnectJob); |
156 }; | 160 }; |
157 | 161 |
158 class SSLClientSocketPool : public ClientSocketPool, | 162 class SSLClientSocketPool : public ClientSocketPool, |
159 public SSLConfigService::Observer { | 163 public SSLConfigService::Observer { |
160 public: | 164 public: |
161 // Only the pools that will be used are required. i.e. if you never | 165 // Only the pools that will be used are required. i.e. if you never |
162 // try to create an SSL over SOCKS socket, |socks_pool| may be NULL. | 166 // try to create an SSL over SOCKS socket, |socks_pool| may be NULL. |
163 SSLClientSocketPool( | 167 SSLClientSocketPool( |
164 int max_sockets, | 168 int max_sockets, |
165 int max_sockets_per_group, | 169 int max_sockets_per_group, |
166 ClientSocketPoolHistograms* histograms, | 170 ClientSocketPoolHistograms* histograms, |
167 HostResolver* host_resolver, | 171 HostResolver* host_resolver, |
168 DnsRRResolver* dnsrr_resolver, | 172 DnsRRResolver* dnsrr_resolver, |
| 173 SSLHostInfoFactory* ssl_host_info_factory, |
169 ClientSocketFactory* client_socket_factory, | 174 ClientSocketFactory* client_socket_factory, |
170 TCPClientSocketPool* tcp_pool, | 175 TCPClientSocketPool* tcp_pool, |
171 SOCKSClientSocketPool* socks_pool, | 176 SOCKSClientSocketPool* socks_pool, |
172 HttpProxyClientSocketPool* http_proxy_pool, | 177 HttpProxyClientSocketPool* http_proxy_pool, |
173 SSLConfigService* ssl_config_service, | 178 SSLConfigService* ssl_config_service, |
174 NetLog* net_log); | 179 NetLog* net_log); |
175 | 180 |
176 virtual ~SSLClientSocketPool(); | 181 virtual ~SSLClientSocketPool(); |
177 | 182 |
178 // ClientSocketPool methods: | 183 // ClientSocketPool methods: |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 236 |
232 class SSLConnectJobFactory : public PoolBase::ConnectJobFactory { | 237 class SSLConnectJobFactory : public PoolBase::ConnectJobFactory { |
233 public: | 238 public: |
234 SSLConnectJobFactory( | 239 SSLConnectJobFactory( |
235 TCPClientSocketPool* tcp_pool, | 240 TCPClientSocketPool* tcp_pool, |
236 SOCKSClientSocketPool* socks_pool, | 241 SOCKSClientSocketPool* socks_pool, |
237 HttpProxyClientSocketPool* http_proxy_pool, | 242 HttpProxyClientSocketPool* http_proxy_pool, |
238 ClientSocketFactory* client_socket_factory, | 243 ClientSocketFactory* client_socket_factory, |
239 HostResolver* host_resolver, | 244 HostResolver* host_resolver, |
240 DnsRRResolver* dnsrr_resolver, | 245 DnsRRResolver* dnsrr_resolver, |
| 246 SSLHostInfoFactory* ssl_host_info_factory, |
241 NetLog* net_log); | 247 NetLog* net_log); |
242 | 248 |
243 virtual ~SSLConnectJobFactory() {} | 249 virtual ~SSLConnectJobFactory() {} |
244 | 250 |
245 // ClientSocketPoolBase::ConnectJobFactory methods. | 251 // ClientSocketPoolBase::ConnectJobFactory methods. |
246 virtual ConnectJob* NewConnectJob( | 252 virtual ConnectJob* NewConnectJob( |
247 const std::string& group_name, | 253 const std::string& group_name, |
248 const PoolBase::Request& request, | 254 const PoolBase::Request& request, |
249 ConnectJob::Delegate* delegate) const; | 255 ConnectJob::Delegate* delegate) const; |
250 | 256 |
251 virtual base::TimeDelta ConnectionTimeout() const { return timeout_; } | 257 virtual base::TimeDelta ConnectionTimeout() const { return timeout_; } |
252 | 258 |
253 private: | 259 private: |
254 TCPClientSocketPool* const tcp_pool_; | 260 TCPClientSocketPool* const tcp_pool_; |
255 SOCKSClientSocketPool* const socks_pool_; | 261 SOCKSClientSocketPool* const socks_pool_; |
256 HttpProxyClientSocketPool* const http_proxy_pool_; | 262 HttpProxyClientSocketPool* const http_proxy_pool_; |
257 ClientSocketFactory* const client_socket_factory_; | 263 ClientSocketFactory* const client_socket_factory_; |
258 HostResolver* const host_resolver_; | 264 HostResolver* const host_resolver_; |
259 DnsRRResolver* dnsrr_resolver_; | 265 DnsRRResolver* const dnsrr_resolver_; |
| 266 SSLHostInfoFactory* const ssl_host_info_factory_; |
260 base::TimeDelta timeout_; | 267 base::TimeDelta timeout_; |
261 NetLog* net_log_; | 268 NetLog* net_log_; |
262 | 269 |
263 DISALLOW_COPY_AND_ASSIGN(SSLConnectJobFactory); | 270 DISALLOW_COPY_AND_ASSIGN(SSLConnectJobFactory); |
264 }; | 271 }; |
265 | 272 |
266 TCPClientSocketPool* const tcp_pool_; | 273 TCPClientSocketPool* const tcp_pool_; |
267 SOCKSClientSocketPool* const socks_pool_; | 274 SOCKSClientSocketPool* const socks_pool_; |
268 HttpProxyClientSocketPool* const http_proxy_pool_; | 275 HttpProxyClientSocketPool* const http_proxy_pool_; |
269 PoolBase base_; | 276 PoolBase base_; |
270 const scoped_refptr<SSLConfigService> ssl_config_service_; | 277 const scoped_refptr<SSLConfigService> ssl_config_service_; |
271 | 278 |
272 DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool); | 279 DISALLOW_COPY_AND_ASSIGN(SSLClientSocketPool); |
273 }; | 280 }; |
274 | 281 |
275 REGISTER_SOCKET_PARAMS_FOR_POOL(SSLClientSocketPool, SSLSocketParams); | 282 REGISTER_SOCKET_PARAMS_FOR_POOL(SSLClientSocketPool, SSLSocketParams); |
276 | 283 |
277 } // namespace net | 284 } // namespace net |
278 | 285 |
279 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ | 286 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_POOL_H_ |
OLD | NEW |