| 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 if (len != null) { | 426 if (len != null) { |
| 427 if (len is! int || len < 0) { | 427 if (len is! int || len < 0) { |
| 428 throw new ArgumentError( | 428 throw new ArgumentError( |
| 429 "Invalid len parameter in SecureSocket.read (len: $len)"); | 429 "Invalid len parameter in SecureSocket.read (len: $len)"); |
| 430 } | 430 } |
| 431 if (len < toRead) { | 431 if (len < toRead) { |
| 432 toRead = len; | 432 toRead = len; |
| 433 } | 433 } |
| 434 } | 434 } |
| 435 List<int> result = (toRead == 0) ? null : | 435 List<int> result = (toRead == 0) ? null : |
| 436 buffer.data.getRange(buffer.start, toRead); | 436 buffer.data.sublist(buffer.start, buffer.start + toRead); |
| 437 buffer.advanceStart(toRead); | 437 buffer.advanceStart(toRead); |
| 438 | 438 |
| 439 // Set up a read event if the filter still has data. | 439 // Set up a read event if the filter still has data. |
| 440 if (!_filterReadEmpty) { | 440 if (!_filterReadEmpty) { |
| 441 Timer.run(_readHandler); | 441 Timer.run(_readHandler); |
| 442 } | 442 } |
| 443 | 443 |
| 444 if (_socketClosedRead) { // An onClose event is pending. | 444 if (_socketClosedRead) { // An onClose event is pending. |
| 445 // _closedRead is false, since we are in a read call. | 445 // _closedRead is false, since we are in a read call. |
| 446 if (!_filterReadEmpty) { | 446 if (!_filterReadEmpty) { |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 void destroy(); | 748 void destroy(); |
| 749 void handshake(); | 749 void handshake(); |
| 750 void init(); | 750 void init(); |
| 751 X509Certificate get peerCertificate; | 751 X509Certificate get peerCertificate; |
| 752 int processBuffer(int bufferIndex); | 752 int processBuffer(int bufferIndex); |
| 753 void registerBadCertificateCallback(Function callback); | 753 void registerBadCertificateCallback(Function callback); |
| 754 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler); | 754 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler); |
| 755 | 755 |
| 756 List<_ExternalBuffer> get buffers; | 756 List<_ExternalBuffer> get buffers; |
| 757 } | 757 } |
| OLD | NEW |