Chromium Code Reviews| 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 <openssl/err.h> | 10 #include <openssl/err.h> |
| 11 #include <openssl/opensslv.h> | 11 #include <openssl/opensslv.h> |
| 12 #include <openssl/ssl.h> | 12 #include <openssl/ssl.h> |
| 13 | 13 |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/callback_helpers.h" | 15 #include "base/callback_helpers.h" |
| 16 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
| 17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
| 18 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
| 19 #include "base/thread_task_runner_handle.h" | |
| 19 #include "crypto/ec_private_key.h" | 20 #include "crypto/ec_private_key.h" |
| 20 #include "crypto/openssl_util.h" | 21 #include "crypto/openssl_util.h" |
| 21 #include "net/base/net_errors.h" | 22 #include "net/base/net_errors.h" |
| 22 #include "net/cert/cert_verifier.h" | 23 #include "net/cert/cert_verifier.h" |
| 23 #include "net/cert/single_request_cert_verifier.h" | 24 #include "net/cert/single_request_cert_verifier.h" |
| 24 #include "net/cert/x509_certificate_net_log_param.h" | 25 #include "net/cert/x509_certificate_net_log_param.h" |
| 25 #include "net/socket/openssl_ssl_util.h" | 26 #include "net/socket/openssl_ssl_util.h" |
| 26 #include "net/socket/ssl_client_socket_pool.h" | 27 #include "net/socket/ssl_client_socket_pool.h" |
| 27 #include "net/socket/ssl_error_params.h" | 28 #include "net/socket/ssl_error_params.h" |
| 28 #include "net/socket/ssl_session_cache_openssl.h" | 29 #include "net/socket/ssl_session_cache_openssl.h" |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 388 const base::Closure& callback) { | 389 const base::Closure& callback) { |
| 389 error_callback_ = callback; | 390 error_callback_ = callback; |
| 390 } | 391 } |
| 391 | 392 |
| 392 void SSLClientSocketOpenSSL::SetIsLeader() { | 393 void SSLClientSocketOpenSSL::SetIsLeader() { |
| 393 is_leader_ = true; | 394 is_leader_ = true; |
| 394 } | 395 } |
| 395 | 396 |
| 396 void SSLClientSocketOpenSSL::OnSocketFailure() { | 397 void SSLClientSocketOpenSSL::OnSocketFailure() { |
| 397 if (is_leader_) { | 398 if (is_leader_) { |
| 398 error_callback_.Run(); | 399 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, error_callback_); |
|
wtc
2014/07/11 18:55:51
IMPORTANT: Based on my understanding of the code,
mshelley
2014/07/14 20:30:06
Done.
| |
| 399 error_callback_ = base::Closure(); | 400 error_callback_ = base::Closure(); |
| 400 is_leader_ = false; | 401 is_leader_ = false; |
| 401 } | 402 } |
| 402 } | 403 } |
| 403 | 404 |
| 404 void SSLClientSocketOpenSSL::GetSSLCertRequestInfo( | 405 void SSLClientSocketOpenSSL::GetSSLCertRequestInfo( |
| 405 SSLCertRequestInfo* cert_request_info) { | 406 SSLCertRequestInfo* cert_request_info) { |
| 406 cert_request_info->host_and_port = host_and_port_; | 407 cert_request_info->host_and_port = host_and_port_; |
| 407 cert_request_info->cert_authorities = cert_authorities_; | 408 cert_request_info->cert_authorities = cert_authorities_; |
| 408 cert_request_info->cert_key_types = cert_key_types_; | 409 cert_request_info->cert_key_types = cert_key_types_; |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1477 DVLOG(2) << "next protocol: '" << npn_proto_ << "' status: " << npn_status_; | 1478 DVLOG(2) << "next protocol: '" << npn_proto_ << "' status: " << npn_status_; |
| 1478 return SSL_TLSEXT_ERR_OK; | 1479 return SSL_TLSEXT_ERR_OK; |
| 1479 } | 1480 } |
| 1480 | 1481 |
| 1481 scoped_refptr<X509Certificate> | 1482 scoped_refptr<X509Certificate> |
| 1482 SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const { | 1483 SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const { |
| 1483 return server_cert_; | 1484 return server_cert_; |
| 1484 } | 1485 } |
| 1485 | 1486 |
| 1486 } // namespace net | 1487 } // namespace net |
| OLD | NEW |