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 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived | 5 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived |
6 // from AuthCertificateCallback() in | 6 // from AuthCertificateCallback() in |
7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. | 7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. |
8 | 8 |
9 /* ***** BEGIN LICENSE BLOCK ***** | 9 /* ***** BEGIN LICENSE BLOCK ***** |
10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 | 692 |
693 // The underlying transport to use for network IO. | 693 // The underlying transport to use for network IO. |
694 ClientSocketHandle* transport_; | 694 ClientSocketHandle* transport_; |
695 base::WeakPtrFactory<BoundNetLog> weak_net_log_factory_; | 695 base::WeakPtrFactory<BoundNetLog> weak_net_log_factory_; |
696 | 696 |
697 // The current handshake state. Mirrors |nss_handshake_state_|. | 697 // The current handshake state. Mirrors |nss_handshake_state_|. |
698 HandshakeState network_handshake_state_; | 698 HandshakeState network_handshake_state_; |
699 | 699 |
700 // The service for retrieving Channel ID keys. May be NULL. | 700 // The service for retrieving Channel ID keys. May be NULL. |
701 ChannelIDService* channel_id_service_; | 701 ChannelIDService* channel_id_service_; |
702 ChannelIDService::RequestHandle channel_id_request_handle_; | 702 ChannelIDService::Request channel_id_request_; |
703 | 703 |
704 // The information about NSS task runner. | 704 // The information about NSS task runner. |
705 int unhandled_buffer_size_; | 705 int unhandled_buffer_size_; |
706 bool nss_waiting_read_; | 706 bool nss_waiting_read_; |
707 bool nss_waiting_write_; | 707 bool nss_waiting_write_; |
708 bool nss_is_closed_; | 708 bool nss_is_closed_; |
709 | 709 |
710 // Set when Read() or Write() successfully reads or writes data to or from the | 710 // Set when Read() or Write() successfully reads or writes data to or from the |
711 // network. | 711 // network. |
712 bool was_ever_used_; | 712 bool was_ever_used_; |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 | 947 |
948 void SSLClientSocketNSS::Core::Detach() { | 948 void SSLClientSocketNSS::Core::Detach() { |
949 DCHECK(OnNetworkTaskRunner()); | 949 DCHECK(OnNetworkTaskRunner()); |
950 | 950 |
951 detached_ = true; | 951 detached_ = true; |
952 transport_ = NULL; | 952 transport_ = NULL; |
953 weak_net_log_factory_.InvalidateWeakPtrs(); | 953 weak_net_log_factory_.InvalidateWeakPtrs(); |
954 | 954 |
955 network_handshake_state_.Reset(); | 955 network_handshake_state_.Reset(); |
956 | 956 |
957 channel_id_request_handle_.Cancel(); | 957 channel_id_request_.Cancel(); |
958 } | 958 } |
959 | 959 |
960 int SSLClientSocketNSS::Core::Read(IOBuffer* buf, int buf_len, | 960 int SSLClientSocketNSS::Core::Read(IOBuffer* buf, int buf_len, |
961 const CompletionCallback& callback) { | 961 const CompletionCallback& callback) { |
962 if (!OnNSSTaskRunner()) { | 962 if (!OnNSSTaskRunner()) { |
963 DCHECK(OnNetworkTaskRunner()); | 963 DCHECK(OnNetworkTaskRunner()); |
964 DCHECK(!detached_); | 964 DCHECK(!detached_); |
965 DCHECK(transport_); | 965 DCHECK(transport_); |
966 DCHECK(!nss_waiting_read_); | 966 DCHECK(!nss_waiting_read_); |
967 | 967 |
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2206 DCHECK(OnNetworkTaskRunner()); | 2206 DCHECK(OnNetworkTaskRunner()); |
2207 | 2207 |
2208 if (detached_) | 2208 if (detached_) |
2209 return ERR_ABORTED; | 2209 return ERR_ABORTED; |
2210 | 2210 |
2211 weak_net_log_->BeginEvent(NetLog::TYPE_SSL_GET_DOMAIN_BOUND_CERT); | 2211 weak_net_log_->BeginEvent(NetLog::TYPE_SSL_GET_DOMAIN_BOUND_CERT); |
2212 | 2212 |
2213 int rv = channel_id_service_->GetOrCreateChannelID( | 2213 int rv = channel_id_service_->GetOrCreateChannelID( |
2214 host, &channel_id_key_, | 2214 host, &channel_id_key_, |
2215 base::Bind(&Core::OnGetChannelIDComplete, base::Unretained(this)), | 2215 base::Bind(&Core::OnGetChannelIDComplete, base::Unretained(this)), |
2216 &channel_id_request_handle_); | 2216 &channel_id_request_); |
2217 | 2217 |
2218 if (rv != ERR_IO_PENDING && !OnNSSTaskRunner()) { | 2218 if (rv != ERR_IO_PENDING && !OnNSSTaskRunner()) { |
2219 nss_task_runner_->PostTask( | 2219 nss_task_runner_->PostTask( |
2220 FROM_HERE, | 2220 FROM_HERE, |
2221 base::Bind(&Core::OnHandshakeIOComplete, this, rv)); | 2221 base::Bind(&Core::OnHandshakeIOComplete, this, rv)); |
2222 return ERR_IO_PENDING; | 2222 return ERR_IO_PENDING; |
2223 } | 2223 } |
2224 | 2224 |
2225 return rv; | 2225 return rv; |
2226 } | 2226 } |
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3183 return channel_id_service_; | 3183 return channel_id_service_; |
3184 } | 3184 } |
3185 | 3185 |
3186 SSLFailureState SSLClientSocketNSS::GetSSLFailureState() const { | 3186 SSLFailureState SSLClientSocketNSS::GetSSLFailureState() const { |
3187 if (completed_handshake_) | 3187 if (completed_handshake_) |
3188 return SSL_FAILURE_NONE; | 3188 return SSL_FAILURE_NONE; |
3189 return SSL_FAILURE_UNKNOWN; | 3189 return SSL_FAILURE_UNKNOWN; |
3190 } | 3190 } |
3191 | 3191 |
3192 } // namespace net | 3192 } // namespace net |
OLD | NEW |