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 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 if (bytes == null) { | 1065 if (bytes == null) { |
1066 bytes = length; | 1066 bytes = length; |
1067 } else { | 1067 } else { |
1068 bytes = min(bytes, length); | 1068 bytes = min(bytes, length); |
1069 } | 1069 } |
1070 if (bytes == 0) return null; | 1070 if (bytes == 0) return null; |
1071 List<int> result = new Uint8List(bytes); | 1071 List<int> result = new Uint8List(bytes); |
1072 int bytesRead = 0; | 1072 int bytesRead = 0; |
1073 // Loop over zero, one, or two linear data ranges. | 1073 // Loop over zero, one, or two linear data ranges. |
1074 while (bytesRead < bytes) { | 1074 while (bytesRead < bytes) { |
1075 int toRead = linearLength; | 1075 int toRead = min(bytes, linearLength); |
1076 result.setRange(bytesRead, | 1076 result.setRange(bytesRead, |
1077 bytesRead + toRead, | 1077 bytesRead + toRead, |
1078 data, | 1078 data, |
1079 start); | 1079 start); |
1080 advanceStart(toRead); | 1080 advanceStart(toRead); |
1081 bytesRead += toRead; | 1081 bytesRead += toRead; |
1082 } | 1082 } |
1083 return result; | 1083 return result; |
1084 } | 1084 } |
1085 | 1085 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 /** | 1209 /** |
1210 * An exception that happens in the handshake phase of establishing | 1210 * An exception that happens in the handshake phase of establishing |
1211 * a secure network connection, when looking up or verifying a | 1211 * a secure network connection, when looking up or verifying a |
1212 * certificate. | 1212 * certificate. |
1213 */ | 1213 */ |
1214 class CertificateException extends TlsException { | 1214 class CertificateException extends TlsException { |
1215 const CertificateException([String message = "", | 1215 const CertificateException([String message = "", |
1216 OSError osError = null]) | 1216 OSError osError = null]) |
1217 : super._("CertificateException", message, osError); | 1217 : super._("CertificateException", message, osError); |
1218 } | 1218 } |
OLD | NEW |