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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 cert_key_types_.clear(); | 506 cert_key_types_.clear(); |
507 | 507 |
508 start_cert_verification_time_ = base::TimeTicks(); | 508 start_cert_verification_time_ = base::TimeTicks(); |
509 | 509 |
510 npn_status_ = kNextProtoUnsupported; | 510 npn_status_ = kNextProtoUnsupported; |
511 npn_proto_.clear(); | 511 npn_proto_.clear(); |
512 | 512 |
513 channel_id_sent_ = false; | 513 channel_id_sent_ = false; |
514 handshake_completed_ = false; | 514 handshake_completed_ = false; |
515 certificate_verified_ = false; | 515 certificate_verified_ = false; |
516 channel_id_request_handle_.Cancel(); | 516 channel_id_request_.Cancel(); |
517 ssl_failure_state_ = SSL_FAILURE_NONE; | 517 ssl_failure_state_ = SSL_FAILURE_NONE; |
518 } | 518 } |
519 | 519 |
520 bool SSLClientSocketOpenSSL::IsConnected() const { | 520 bool SSLClientSocketOpenSSL::IsConnected() const { |
521 // If the handshake has not yet completed. | 521 // If the handshake has not yet completed. |
522 if (!completed_connect_) | 522 if (!completed_connect_) |
523 return false; | 523 return false; |
524 // If an asynchronous operation is still pending. | 524 // If an asynchronous operation is still pending. |
525 if (user_read_buf_.get() || user_write_buf_.get()) | 525 if (user_read_buf_.get() || user_write_buf_.get()) |
526 return true; | 526 return true; |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 return OK; | 1024 return OK; |
1025 } | 1025 } |
1026 | 1026 |
1027 int SSLClientSocketOpenSSL::DoChannelIDLookup() { | 1027 int SSLClientSocketOpenSSL::DoChannelIDLookup() { |
1028 net_log_.AddEvent(NetLog::TYPE_SSL_CHANNEL_ID_REQUESTED); | 1028 net_log_.AddEvent(NetLog::TYPE_SSL_CHANNEL_ID_REQUESTED); |
1029 GotoState(STATE_CHANNEL_ID_LOOKUP_COMPLETE); | 1029 GotoState(STATE_CHANNEL_ID_LOOKUP_COMPLETE); |
1030 return channel_id_service_->GetOrCreateChannelID( | 1030 return channel_id_service_->GetOrCreateChannelID( |
1031 host_and_port_.host(), &channel_id_key_, | 1031 host_and_port_.host(), &channel_id_key_, |
1032 base::Bind(&SSLClientSocketOpenSSL::OnHandshakeIOComplete, | 1032 base::Bind(&SSLClientSocketOpenSSL::OnHandshakeIOComplete, |
1033 base::Unretained(this)), | 1033 base::Unretained(this)), |
1034 &channel_id_request_handle_); | 1034 &channel_id_request_); |
1035 } | 1035 } |
1036 | 1036 |
1037 int SSLClientSocketOpenSSL::DoChannelIDLookupComplete(int result) { | 1037 int SSLClientSocketOpenSSL::DoChannelIDLookupComplete(int result) { |
1038 if (result < 0) | 1038 if (result < 0) |
1039 return result; | 1039 return result; |
1040 | 1040 |
1041 if (!channel_id_key_) { | 1041 if (!channel_id_key_) { |
1042 LOG(ERROR) << "Failed to import Channel ID."; | 1042 LOG(ERROR) << "Failed to import Channel ID."; |
1043 return ERR_CHANNEL_ID_IMPORT_FAILED; | 1043 return ERR_CHANNEL_ID_IMPORT_FAILED; |
1044 } | 1044 } |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1921 } | 1921 } |
1922 return false; | 1922 return false; |
1923 } | 1923 } |
1924 | 1924 |
1925 scoped_refptr<X509Certificate> | 1925 scoped_refptr<X509Certificate> |
1926 SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const { | 1926 SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const { |
1927 return server_cert_; | 1927 return server_cert_; |
1928 } | 1928 } |
1929 | 1929 |
1930 } // namespace net | 1930 } // namespace net |
OLD | NEW |