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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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, | 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. | 562 // report an error as if we received READ_CLOSED during the handshake. |
563 if (_socket._socket.closedReadEventSent) { | 563 dynamic s = _socket; // Cast to dynamic to avoid warning. |
karlklose
2015/03/10 09:20:40
'var s' would be shorter. Is there a better type y
Søren Gjesse
2015/03/10 16:29:01
The type is _RawSocket, but that is currently defi
| |
564 if (s._socket.closedReadEventSent) { | |
564 _eventDispatcher(RawSocketEvent.READ_CLOSED); | 565 _eventDispatcher(RawSocketEvent.READ_CLOSED); |
565 } | 566 } |
566 _socketSubscription | 567 _socketSubscription |
567 ..onData(_eventDispatcher) | 568 ..onData(_eventDispatcher) |
568 ..onError(_reportError) | 569 ..onError(_reportError) |
569 ..onDone(_doneHandler); | 570 ..onDone(_doneHandler); |
570 } | 571 } |
571 try { | 572 try { |
572 _secureFilter.connect(address.host, | 573 _secureFilter.connect(address.host, |
573 (address as dynamic)._in_addr, | 574 (address as dynamic)._in_addr, |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1428 /** | 1429 /** |
1429 * An exception that happens in the handshake phase of establishing | 1430 * An exception that happens in the handshake phase of establishing |
1430 * a secure network connection, when looking up or verifying a | 1431 * a secure network connection, when looking up or verifying a |
1431 * certificate. | 1432 * certificate. |
1432 */ | 1433 */ |
1433 class CertificateException extends TlsException { | 1434 class CertificateException extends TlsException { |
1434 const CertificateException([String message = "", | 1435 const CertificateException([String message = "", |
1435 OSError osError = null]) | 1436 OSError osError = null]) |
1436 : super._("CertificateException", message, osError); | 1437 : super._("CertificateException", message, osError); |
1437 } | 1438 } |
OLD | NEW |