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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 return ERR_NO_SSL_VERSIONS_ENABLED; | 273 return ERR_NO_SSL_VERSIONS_ENABLED; |
274 creds_ = GetCredHandle(ssl_version_mask); | 274 creds_ = GetCredHandle(ssl_version_mask); |
275 | 275 |
276 next_state_ = STATE_CONNECT; | 276 next_state_ = STATE_CONNECT; |
277 int rv = DoLoop(OK); | 277 int rv = DoLoop(OK); |
278 if (rv == ERR_IO_PENDING) | 278 if (rv == ERR_IO_PENDING) |
279 user_callback_ = callback; | 279 user_callback_ = callback; |
280 return rv; | 280 return rv; |
281 } | 281 } |
282 | 282 |
283 int SSLClientSocketWin::ReconnectIgnoringLastError( | |
284 CompletionCallback* callback) { | |
285 // TODO(darin): implement me! | |
286 return ERR_FAILED; | |
287 } | |
288 | |
289 void SSLClientSocketWin::Disconnect() { | 283 void SSLClientSocketWin::Disconnect() { |
290 // TODO(wtc): Send SSL close_notify alert. | 284 // TODO(wtc): Send SSL close_notify alert. |
291 completed_handshake_ = false; | 285 completed_handshake_ = false; |
292 transport_->Disconnect(); | 286 transport_->Disconnect(); |
293 | 287 |
294 if (send_buffer_.pvBuffer) | 288 if (send_buffer_.pvBuffer) |
295 FreeSendBuffer(); | 289 FreeSendBuffer(); |
296 if (ctxt_.dwLower || ctxt_.dwUpper) { | 290 if (ctxt_.dwLower || ctxt_.dwUpper) { |
297 DeleteSecurityContext(&ctxt_); | 291 DeleteSecurityContext(&ctxt_); |
298 memset(&ctxt_, 0, sizeof(ctxt_)); | 292 memset(&ctxt_, 0, sizeof(ctxt_)); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 rv = ERR_UNEXPECTED; | 437 rv = ERR_UNEXPECTED; |
444 NOTREACHED() << "unexpected state"; | 438 NOTREACHED() << "unexpected state"; |
445 break; | 439 break; |
446 } | 440 } |
447 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); | 441 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); |
448 return rv; | 442 return rv; |
449 } | 443 } |
450 | 444 |
451 int SSLClientSocketWin::DoConnect() { | 445 int SSLClientSocketWin::DoConnect() { |
452 next_state_ = STATE_CONNECT_COMPLETE; | 446 next_state_ = STATE_CONNECT_COMPLETE; |
453 return transport_->Connect(&io_callback_); | 447 |
| 448 // The caller has to make sure that the transport socket is connected. If |
| 449 // it isn't, we will eventually fail when trying to negotiate an SSL session. |
| 450 // But we cannot call transport_->Connect(), as we do not know if there is |
| 451 // any proxy negotiation that needs to be performed prior to establishing |
| 452 // the SSL session. |
| 453 return OK; |
454 } | 454 } |
455 | 455 |
456 int SSLClientSocketWin::DoConnectComplete(int result) { | 456 int SSLClientSocketWin::DoConnectComplete(int result) { |
457 if (result < 0) | 457 if (result < 0) |
458 return result; | 458 return result; |
459 | 459 |
460 memset(&ctxt_, 0, sizeof(ctxt_)); | 460 memset(&ctxt_, 0, sizeof(ctxt_)); |
461 | 461 |
462 SecBufferDesc buffer_desc; | 462 SecBufferDesc buffer_desc; |
463 DWORD out_flags; | 463 DWORD out_flags; |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 } | 974 } |
975 } | 975 } |
976 | 976 |
977 void SSLClientSocketWin::FreeSendBuffer() { | 977 void SSLClientSocketWin::FreeSendBuffer() { |
978 SECURITY_STATUS status = FreeContextBuffer(send_buffer_.pvBuffer); | 978 SECURITY_STATUS status = FreeContextBuffer(send_buffer_.pvBuffer); |
979 DCHECK(status == SEC_E_OK); | 979 DCHECK(status == SEC_E_OK); |
980 memset(&send_buffer_, 0, sizeof(send_buffer_)); | 980 memset(&send_buffer_, 0, sizeof(send_buffer_)); |
981 } | 981 } |
982 | 982 |
983 } // namespace net | 983 } // namespace net |
OLD | NEW |