| OLD | NEW | 
|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "net/base/ssl_client_socket_win.h" | 5 #include "net/base/ssl_client_socket_win.h" | 
| 6 | 6 | 
| 7 #include <schnlsp.h> | 7 #include <schnlsp.h> | 
| 8 | 8 | 
| 9 #include "base/lock.h" | 9 #include "base/lock.h" | 
| 10 #include "base/singleton.h" | 10 #include "base/singleton.h" | 
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 307 bool SSLClientSocketWin::IsConnected() const { | 307 bool SSLClientSocketWin::IsConnected() const { | 
| 308   // Ideally, we should also check if we have received the close_notify alert | 308   // Ideally, we should also check if we have received the close_notify alert | 
| 309   // message from the server, and return false in that case.  We're not doing | 309   // message from the server, and return false in that case.  We're not doing | 
| 310   // that, so this function may return a false positive.  Since the upper | 310   // that, so this function may return a false positive.  Since the upper | 
| 311   // layer (HttpNetworkTransaction) needs to handle a persistent connection | 311   // layer (HttpNetworkTransaction) needs to handle a persistent connection | 
| 312   // closed by the server when we send a request anyway, a false positive in | 312   // closed by the server when we send a request anyway, a false positive in | 
| 313   // exchange for simpler code is a good trade-off. | 313   // exchange for simpler code is a good trade-off. | 
| 314   return completed_handshake_ && transport_->IsConnected(); | 314   return completed_handshake_ && transport_->IsConnected(); | 
| 315 } | 315 } | 
| 316 | 316 | 
|  | 317 bool SSLClientSocketWin::IsConnectedAndIdle() const { | 
|  | 318   // Unlike IsConnected, this method doesn't return a false positive. | 
|  | 319   // | 
|  | 320   // Strictly speaking, we should check if we have received the close_notify | 
|  | 321   // alert message from the server, and return false in that case.  Although | 
|  | 322   // the close_notify alert message means EOF in the SSL layer, it is just | 
|  | 323   // bytes to the transport layer below, so transport_->IsConnectedAndIdle() | 
|  | 324   // returns the desired false when we receive close_notify. | 
|  | 325   return completed_handshake_ && transport_->IsConnectedAndIdle(); | 
|  | 326 } | 
|  | 327 | 
| 317 int SSLClientSocketWin::Read(char* buf, int buf_len, | 328 int SSLClientSocketWin::Read(char* buf, int buf_len, | 
| 318                              CompletionCallback* callback) { | 329                              CompletionCallback* callback) { | 
| 319   DCHECK(completed_handshake_); | 330   DCHECK(completed_handshake_); | 
| 320   DCHECK(next_state_ == STATE_NONE); | 331   DCHECK(next_state_ == STATE_NONE); | 
| 321   DCHECK(!user_callback_); | 332   DCHECK(!user_callback_); | 
| 322 | 333 | 
| 323   // If we have surplus decrypted plaintext, satisfy the Read with it without | 334   // If we have surplus decrypted plaintext, satisfy the Read with it without | 
| 324   // reading more ciphertext from the transport socket. | 335   // reading more ciphertext from the transport socket. | 
| 325   if (bytes_decrypted_ != 0) { | 336   if (bytes_decrypted_ != 0) { | 
| 326     int len = std::min(buf_len, bytes_decrypted_); | 337     int len = std::min(buf_len, bytes_decrypted_); | 
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 932   if (server_cert_verify_result_.has_md4) | 943   if (server_cert_verify_result_.has_md4) | 
| 933     UpdateConnectionTypeHistograms(CONNECTION_SSL_MD4); | 944     UpdateConnectionTypeHistograms(CONNECTION_SSL_MD4); | 
| 934   if (server_cert_verify_result_.has_md5_ca) | 945   if (server_cert_verify_result_.has_md5_ca) | 
| 935     UpdateConnectionTypeHistograms(CONNECTION_SSL_MD5_CA); | 946     UpdateConnectionTypeHistograms(CONNECTION_SSL_MD5_CA); | 
| 936   if (server_cert_verify_result_.has_md2_ca) | 947   if (server_cert_verify_result_.has_md2_ca) | 
| 937     UpdateConnectionTypeHistograms(CONNECTION_SSL_MD2_CA); | 948     UpdateConnectionTypeHistograms(CONNECTION_SSL_MD2_CA); | 
| 938 } | 949 } | 
| 939 | 950 | 
| 940 }  // namespace net | 951 }  // namespace net | 
| 941 | 952 | 
| OLD | NEW | 
|---|