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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 void destroy(); | 753 void destroy(); |
754 void handshake(); | 754 void handshake(); |
755 void init(); | 755 void init(); |
756 X509Certificate get peerCertificate; | 756 X509Certificate get peerCertificate; |
757 int processBuffer(int bufferIndex); | 757 int processBuffer(int bufferIndex); |
758 void registerBadCertificateCallback(Function callback); | 758 void registerBadCertificateCallback(Function callback); |
759 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler); | 759 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler); |
760 | 760 |
761 List<_ExternalBuffer> get buffers; | 761 List<_ExternalBuffer> get buffers; |
762 } | 762 } |
OLD | NEW |