| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 * The [SecureServerSocket] is a server socket, providing a stream of high-level | 8 * The [SecureServerSocket] is a server socket, providing a stream of high-level |
| 9 * [Socket]s. | 9 * [Socket]s. |
| 10 * | 10 * |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 * requesting a certificate, so one doesn't need to set both to true. | 57 * requesting a certificate, so one doesn't need to set both to true. |
| 58 * To check whether a client certificate was received, check | 58 * To check whether a client certificate was received, check |
| 59 * SecureSocket.peerCertificate after connecting. If no certificate | 59 * SecureSocket.peerCertificate after connecting. If no certificate |
| 60 * was received, the result will be null. | 60 * was received, the result will be null. |
| 61 */ | 61 */ |
| 62 static Future<SecureServerSocket> bind( | 62 static Future<SecureServerSocket> bind( |
| 63 address, | 63 address, |
| 64 int port, | 64 int port, |
| 65 String certificateName, | 65 String certificateName, |
| 66 {int backlog: 0, | 66 {int backlog: 0, |
| 67 bool v6Only: false, |
| 67 bool requestClientCertificate: false, | 68 bool requestClientCertificate: false, |
| 68 bool requireClientCertificate: false}) { | 69 bool requireClientCertificate: false}) { |
| 69 return RawSecureServerSocket.bind( | 70 return RawSecureServerSocket.bind( |
| 70 address, | 71 address, |
| 71 port, | 72 port, |
| 72 certificateName, | 73 certificateName, |
| 73 backlog: backlog, | 74 backlog: backlog, |
| 75 v6Only: v6Only, |
| 74 requestClientCertificate: requestClientCertificate, | 76 requestClientCertificate: requestClientCertificate, |
| 75 requireClientCertificate: requireClientCertificate).then( | 77 requireClientCertificate: requireClientCertificate).then( |
| 76 (serverSocket) => new SecureServerSocket._(serverSocket)); | 78 (serverSocket) => new SecureServerSocket._(serverSocket)); |
| 77 } | 79 } |
| 78 | 80 |
| 79 StreamSubscription<SecureSocket> listen(void onData(SecureSocket socket), | 81 StreamSubscription<SecureSocket> listen(void onData(SecureSocket socket), |
| 80 {void onError(error), | 82 {void onError(error), |
| 81 void onDone(), | 83 void onDone(), |
| 82 bool cancelOnError}) { | 84 bool cancelOnError}) { |
| 83 return _socket.map((rawSocket) => new SecureSocket._(rawSocket)) | 85 return _socket.map((rawSocket) => new SecureSocket._(rawSocket)) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 * requireClientCertificate to true. Require implies request, so one doesn't | 169 * requireClientCertificate to true. Require implies request, so one doesn't |
| 168 * need to specify both. To check whether a client certificate was received, | 170 * need to specify both. To check whether a client certificate was received, |
| 169 * check SecureSocket.peerCertificate after connecting. If no certificate | 171 * check SecureSocket.peerCertificate after connecting. If no certificate |
| 170 * was received, the result will be null. | 172 * was received, the result will be null. |
| 171 */ | 173 */ |
| 172 static Future<RawSecureServerSocket> bind( | 174 static Future<RawSecureServerSocket> bind( |
| 173 String address, | 175 String address, |
| 174 int port, | 176 int port, |
| 175 String certificateName, | 177 String certificateName, |
| 176 {int backlog: 0, | 178 {int backlog: 0, |
| 179 bool v6Only: false, |
| 177 bool requestClientCertificate: false, | 180 bool requestClientCertificate: false, |
| 178 bool requireClientCertificate: false}) { | 181 bool requireClientCertificate: false}) { |
| 179 return RawServerSocket.bind(address, port, backlog: backlog) | 182 return RawServerSocket.bind(address, port, backlog: backlog, v6Only: v6Only) |
| 180 .then((serverSocket) => new RawSecureServerSocket._( | 183 .then((serverSocket) => new RawSecureServerSocket._( |
| 181 serverSocket, | 184 serverSocket, |
| 182 certificateName, | 185 certificateName, |
| 183 requestClientCertificate, | 186 requestClientCertificate, |
| 184 requireClientCertificate)); | 187 requireClientCertificate)); |
| 185 } | 188 } |
| 186 | 189 |
| 187 StreamSubscription<RawSecureSocket> listen(void onData(RawSecureSocket s), | 190 StreamSubscription<RawSecureSocket> listen(void onData(RawSecureSocket s), |
| 188 {void onError(error), | 191 {void onError(error), |
| 189 void onDone(), | 192 void onDone(), |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 _subscription = _socket.listen(_onData, | 257 _subscription = _socket.listen(_onData, |
| 255 onDone: _onDone, | 258 onDone: _onDone, |
| 256 onError: _onError); | 259 onError: _onError); |
| 257 } else { | 260 } else { |
| 258 close(); | 261 close(); |
| 259 } | 262 } |
| 260 } | 263 } |
| 261 } | 264 } |
| 262 | 265 |
| 263 | 266 |
| OLD | NEW |