| 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.h" | 5 #include "net/base/ssl_client_socket.h" |
| 6 | 6 |
| 7 #include <schnlsp.h> | 7 #include <schnlsp.h> |
| 8 | 8 |
| 9 #include "base/singleton.h" | 9 #include "base/singleton.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 } | 152 } |
| 153 if (server_cert_) | 153 if (server_cert_) |
| 154 CertFreeCertificateContext(server_cert_); | 154 CertFreeCertificateContext(server_cert_); |
| 155 | 155 |
| 156 // TODO(wtc): reset more members? | 156 // TODO(wtc): reset more members? |
| 157 bytes_decrypted_ = 0; | 157 bytes_decrypted_ = 0; |
| 158 bytes_received_ = 0; | 158 bytes_received_ = 0; |
| 159 } | 159 } |
| 160 | 160 |
| 161 bool SSLClientSocket::IsConnected() const { | 161 bool SSLClientSocket::IsConnected() const { |
| 162 // Ideally, we should also check if we have received the close_notify alert |
| 163 // message from the server, and return false in that case. We're not doing |
| 164 // that, so this function may return a false positive. Since the upper |
| 165 // layer (HttpNetworkTransaction) needs to handle a persistent connection |
| 166 // closed by the server when we send a request anyway, a false positive in |
| 167 // exchange for simpler code is a good trade-off. |
| 162 return completed_handshake_ && transport_->IsConnected(); | 168 return completed_handshake_ && transport_->IsConnected(); |
| 163 } | 169 } |
| 164 | 170 |
| 165 int SSLClientSocket::Read(char* buf, int buf_len, | 171 int SSLClientSocket::Read(char* buf, int buf_len, |
| 166 CompletionCallback* callback) { | 172 CompletionCallback* callback) { |
| 167 DCHECK(completed_handshake_); | 173 DCHECK(completed_handshake_); |
| 168 DCHECK(next_state_ == STATE_NONE); | 174 DCHECK(next_state_ == STATE_NONE); |
| 169 DCHECK(!user_callback_); | 175 DCHECK(!user_callback_); |
| 170 | 176 |
| 171 // If we have surplus decrypted plaintext, satisfy the Read with it without | 177 // If we have surplus decrypted plaintext, satisfy the Read with it without |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 if (policy_status.dwError) | 871 if (policy_status.dwError) |
| 866 return MapSecurityError(policy_status.dwError); | 872 return MapSecurityError(policy_status.dwError); |
| 867 | 873 |
| 868 CertFreeCertificateChain(chain_context); | 874 CertFreeCertificateChain(chain_context); |
| 869 | 875 |
| 870 return OK; | 876 return OK; |
| 871 } | 877 } |
| 872 | 878 |
| 873 } // namespace net | 879 } // namespace net |
| 874 | 880 |
| OLD | NEW |