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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 if (sendClientCertificate is! bool) { | 596 if (sendClientCertificate is! bool) { |
597 throw new ArgumentError("sendClientCertificate is not a bool"); | 597 throw new ArgumentError("sendClientCertificate is not a bool"); |
598 } | 598 } |
599 if (onBadCertificate != null && onBadCertificate is! Function) { | 599 if (onBadCertificate != null && onBadCertificate is! Function) { |
600 throw new ArgumentError("onBadCertificate is not null or a Function"); | 600 throw new ArgumentError("onBadCertificate is not null or a Function"); |
601 } | 601 } |
602 } | 602 } |
603 | 603 |
604 int get port => _socket.port; | 604 int get port => _socket.port; |
605 | 605 |
606 String get remoteHost => _socket.remoteHost; | 606 InternetAddress get remoteAddress => _socket.remoteAddress; |
607 | 607 |
608 int get remotePort => _socket.remotePort; | 608 int get remotePort => _socket.remotePort; |
609 | 609 |
610 int available() { | 610 int available() { |
611 if (_status != CONNECTED) return 0; | 611 if (_status != CONNECTED) return 0; |
612 return _secureFilter.buffers[READ_PLAINTEXT].length; | 612 return _secureFilter.buffers[READ_PLAINTEXT].length; |
613 } | 613 } |
614 | 614 |
615 Future<RawSecureSocket> close() { | 615 Future<RawSecureSocket> close() { |
616 shutdown(SocketDirection.BOTH); | 616 shutdown(SocketDirection.BOTH); |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 /** | 1266 /** |
1267 * An exception that happens in the handshake phase of establishing | 1267 * An exception that happens in the handshake phase of establishing |
1268 * a secure network connection, when looking up or verifying a | 1268 * a secure network connection, when looking up or verifying a |
1269 * certificate. | 1269 * certificate. |
1270 */ | 1270 */ |
1271 class CertificateException extends TlsException { | 1271 class CertificateException extends TlsException { |
1272 const CertificateException([String message = "", | 1272 const CertificateException([String message = "", |
1273 OSError osError = null]) | 1273 OSError osError = null]) |
1274 : super._("CertificateException", message, osError); | 1274 : super._("CertificateException", message, osError); |
1275 } | 1275 } |
OLD | NEW |