OLD | NEW |
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 // OpenSSL binding for SSLClientSocket. The class layout and general principle | 5 // OpenSSL binding for SSLClientSocket. The class layout and general principle |
6 // of operation is derived from SSLClientSocketNSS. | 6 // of operation is derived from SSLClientSocketNSS. |
7 | 7 |
8 #include "net/socket/ssl_client_socket_openssl.h" | 8 #include "net/socket/ssl_client_socket_openssl.h" |
9 | 9 |
10 #include <errno.h> | 10 #include <errno.h> |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 context->session_cache()->Flush(); | 332 context->session_cache()->Flush(); |
333 } | 333 } |
334 | 334 |
335 SSLClientSocketOpenSSL::SSLClientSocketOpenSSL( | 335 SSLClientSocketOpenSSL::SSLClientSocketOpenSSL( |
336 scoped_ptr<ClientSocketHandle> transport_socket, | 336 scoped_ptr<ClientSocketHandle> transport_socket, |
337 const HostPortPair& host_and_port, | 337 const HostPortPair& host_and_port, |
338 const SSLConfig& ssl_config, | 338 const SSLConfig& ssl_config, |
339 const SSLClientSocketContext& context) | 339 const SSLClientSocketContext& context) |
340 : transport_send_busy_(false), | 340 : transport_send_busy_(false), |
341 transport_recv_busy_(false), | 341 transport_recv_busy_(false), |
342 weak_factory_(this), | |
343 pending_read_error_(kNoPendingReadResult), | 342 pending_read_error_(kNoPendingReadResult), |
344 transport_read_error_(OK), | 343 transport_read_error_(OK), |
345 transport_write_error_(OK), | 344 transport_write_error_(OK), |
346 server_cert_chain_(new PeerCertificateChain(NULL)), | 345 server_cert_chain_(new PeerCertificateChain(NULL)), |
347 completed_connect_(false), | 346 completed_connect_(false), |
348 was_ever_used_(false), | 347 was_ever_used_(false), |
349 client_auth_cert_needed_(false), | 348 client_auth_cert_needed_(false), |
350 cert_verifier_(context.cert_verifier), | 349 cert_verifier_(context.cert_verifier), |
351 channel_id_service_(context.channel_id_service), | 350 channel_id_service_(context.channel_id_service), |
352 ssl_(NULL), | 351 ssl_(NULL), |
353 transport_bio_(NULL), | 352 transport_bio_(NULL), |
354 transport_(transport_socket.Pass()), | 353 transport_(transport_socket.Pass()), |
355 host_and_port_(host_and_port), | 354 host_and_port_(host_and_port), |
356 ssl_config_(ssl_config), | 355 ssl_config_(ssl_config), |
357 ssl_session_cache_shard_(context.ssl_session_cache_shard), | 356 ssl_session_cache_shard_(context.ssl_session_cache_shard), |
358 trying_cached_session_(false), | 357 trying_cached_session_(false), |
359 next_handshake_state_(STATE_NONE), | 358 next_handshake_state_(STATE_NONE), |
360 npn_status_(kNextProtoUnsupported), | 359 npn_status_(kNextProtoUnsupported), |
361 channel_id_xtn_negotiated_(false), | 360 channel_id_xtn_negotiated_(false), |
362 handshake_succeeded_(false), | 361 handshake_succeeded_(false), |
363 marked_session_as_good_(false), | 362 marked_session_as_good_(false), |
364 transport_security_state_(context.transport_security_state), | 363 transport_security_state_(context.transport_security_state), |
365 net_log_(transport_->socket()->NetLog()) { | 364 net_log_(transport_->socket()->NetLog()), |
| 365 weak_factory_(this) { |
366 } | 366 } |
367 | 367 |
368 SSLClientSocketOpenSSL::~SSLClientSocketOpenSSL() { | 368 SSLClientSocketOpenSSL::~SSLClientSocketOpenSSL() { |
369 Disconnect(); | 369 Disconnect(); |
370 } | 370 } |
371 | 371 |
372 std::string SSLClientSocketOpenSSL::GetSessionCacheKey() const { | 372 std::string SSLClientSocketOpenSSL::GetSessionCacheKey() const { |
373 std::string result = host_and_port_.ToString(); | 373 std::string result = host_and_port_.ToString(); |
374 result.append("/"); | 374 result.append("/"); |
375 result.append(ssl_session_cache_shard_); | 375 result.append(ssl_session_cache_shard_); |
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1643 if (handshake_succeeded_ && marked_session_as_good_) | 1643 if (handshake_succeeded_ && marked_session_as_good_) |
1644 OnHandshakeCompletion(); | 1644 OnHandshakeCompletion(); |
1645 } | 1645 } |
1646 | 1646 |
1647 scoped_refptr<X509Certificate> | 1647 scoped_refptr<X509Certificate> |
1648 SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const { | 1648 SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const { |
1649 return server_cert_; | 1649 return server_cert_; |
1650 } | 1650 } |
1651 | 1651 |
1652 } // namespace net | 1652 } // namespace net |
OLD | NEW |