| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart.io; | 5 part of dart.io; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A high-level class for communicating securely over a TCP socket, using | 8 * A high-level class for communicating securely over a TCP socket, using |
| 9 * TLS and SSL. The [SecureSocket] exposes both a [Stream] and an | 9 * TLS and SSL. The [SecureSocket] exposes both a [Stream] and an |
| 10 * [IOSink] interface, making it ideal for using together with | 10 * [IOSink] interface, making it ideal for using together with |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 // create a new one. | 551 // create a new one. |
| 552 _socketSubscription = _socket.listen(_eventDispatcher, | 552 _socketSubscription = _socket.listen(_eventDispatcher, |
| 553 onError: _reportError, | 553 onError: _reportError, |
| 554 onDone: _doneHandler); | 554 onDone: _doneHandler); |
| 555 } else { | 555 } else { |
| 556 if (_socketSubscription.isPaused) { | 556 if (_socketSubscription.isPaused) { |
| 557 _socket.close(); | 557 _socket.close(); |
| 558 throw new ArgumentError( | 558 throw new ArgumentError( |
| 559 "Subscription passed to TLS upgrade is paused"); | 559 "Subscription passed to TLS upgrade is paused"); |
| 560 } | 560 } |
| 561 // If we are upgrading a socket that is already closed for read, |
| 562 // report an error as if we received READ_CLOSED during the handshake. |
| 563 if (_socket._socket.closedReadEventSent) { |
| 564 _eventDispatcher(RawSocketEvent.READ_CLOSED); |
| 565 } |
| 561 _socketSubscription | 566 _socketSubscription |
| 562 ..onData(_eventDispatcher) | 567 ..onData(_eventDispatcher) |
| 563 ..onError(_reportError) | 568 ..onError(_reportError) |
| 564 ..onDone(_doneHandler); | 569 ..onDone(_doneHandler); |
| 565 } | 570 } |
| 566 try { | 571 try { |
| 567 _secureFilter.connect(address.host, | 572 _secureFilter.connect(address.host, |
| 568 (address as dynamic)._in_addr, | 573 (address as dynamic)._in_addr, |
| 569 port, | 574 port, |
| 570 is_server, | 575 is_server, |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1423 /** | 1428 /** |
| 1424 * An exception that happens in the handshake phase of establishing | 1429 * An exception that happens in the handshake phase of establishing |
| 1425 * a secure network connection, when looking up or verifying a | 1430 * a secure network connection, when looking up or verifying a |
| 1426 * certificate. | 1431 * certificate. |
| 1427 */ | 1432 */ |
| 1428 class CertificateException extends TlsException { | 1433 class CertificateException extends TlsException { |
| 1429 const CertificateException([String message = "", | 1434 const CertificateException([String message = "", |
| 1430 OSError osError = null]) | 1435 OSError osError = null]) |
| 1431 : super._("CertificateException", message, osError); | 1436 : super._("CertificateException", message, osError); |
| 1432 } | 1437 } |
| OLD | NEW |