| 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 23 matching lines...) Expand all Loading... |
| 34 * If [port] has the value [:0:] an ephemeral port will be chosen by | 34 * If [port] has the value [:0:] an ephemeral port will be chosen by |
| 35 * the system. The actual port used can be retrieved using the | 35 * the system. The actual port used can be retrieved using the |
| 36 * [port] getter. | 36 * [port] getter. |
| 37 * | 37 * |
| 38 * The optional argument [backlog] can be used to specify the listen | 38 * The optional argument [backlog] can be used to specify the listen |
| 39 * backlog for the underlying OS listen setup. If [backlog] has the | 39 * backlog for the underlying OS listen setup. If [backlog] has the |
| 40 * value of [:0:] (the default) a reasonable value will be chosen by | 40 * value of [:0:] (the default) a reasonable value will be chosen by |
| 41 * the system. | 41 * the system. |
| 42 * | 42 * |
| 43 * Incoming client connections are promoted to secure connections, using | 43 * Incoming client connections are promoted to secure connections, using |
| 44 * the server certificate given by [certificateName]. | 44 * the server certificate and key set in [context]. |
| 45 * | 45 * |
| 46 * [address] must be given as a numeric address, not a host name. | 46 * [address] must be given as a numeric address, not a host name. |
| 47 * | 47 * |
| 48 * To request or require that clients authenticate by providing an SSL (TLS) | 48 * To request or require that clients authenticate by providing an SSL (TLS) |
| 49 * client certificate, set the optional parameter [requestClientCertificate] | 49 * client certificate, set the optional parameter [requestClientCertificate] |
| 50 * or [requireClientCertificate] to true. Requiring a certificate implies | 50 * or [requireClientCertificate] to true. Requiring a certificate implies |
| 51 * requesting a certificate, so one doesn't need to set both to true. | 51 * requesting a certificate, so setting both is redundant. |
| 52 * To check whether a client certificate was received, check | 52 * To check whether a client certificate was received, check |
| 53 * SecureSocket.peerCertificate after connecting. If no certificate | 53 * SecureSocket.peerCertificate after connecting. If no certificate |
| 54 * was received, the result will be null. | 54 * was received, the result will be null. |
| 55 * | 55 * |
| 56 * The optional argument [shared] specify whether additional binds | 56 * The optional argument [shared] specifies whether additional |
| 57 * to the same `address`, `port` and `v6Only` combination is | 57 * SecureServerSocket objects can bind to the same combination of `address`, |
| 58 * possible from the same Dart process. If `shared` is `true` and | 58 * `port` and `v6Only`. If `shared` is `true` and more `SecureServerSocket`s |
| 59 * additional binds are performed, then the incoming connections | 59 * from this isolate or other isolates are bound to the port, then the |
| 60 * will be distributed between that set of | 60 * incoming connections will be distributed among all the bound |
| 61 * `SecureServerSocket`s. One way of using this is to have number of | 61 * `SecureServerSocket`s. Connections can be distributed over multiple |
| 62 * isolates between which incoming connections are distributed. | 62 * isolates this way. |
| 63 */ | 63 */ |
| 64 static Future<SecureServerSocket> bind( | 64 static Future<SecureServerSocket> bind( |
| 65 address, | 65 address, |
| 66 int port, | 66 int port, |
| 67 SecurityContext context, | 67 SecurityContext context, |
| 68 {int backlog: 0, | 68 {int backlog: 0, |
| 69 bool v6Only: false, | 69 bool v6Only: false, |
| 70 bool requestClientCertificate: false, | 70 bool requestClientCertificate: false, |
| 71 bool requireClientCertificate: false, | 71 bool requireClientCertificate: false, |
| 72 List<String> supportedProtocols, | 72 List<String> supportedProtocols, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 * If [port] has the value [:0:] an ephemeral port will be chosen by | 163 * If [port] has the value [:0:] an ephemeral port will be chosen by |
| 164 * the system. The actual port used can be retrieved using the | 164 * the system. The actual port used can be retrieved using the |
| 165 * [port] getter. | 165 * [port] getter. |
| 166 * | 166 * |
| 167 * The optional argument [backlog] can be used to specify the listen | 167 * The optional argument [backlog] can be used to specify the listen |
| 168 * backlog for the underlying OS listen setup. If [backlog] has the | 168 * backlog for the underlying OS listen setup. If [backlog] has the |
| 169 * value of [:0:] (the default) a reasonable value will be chosen by | 169 * value of [:0:] (the default) a reasonable value will be chosen by |
| 170 * the system. | 170 * the system. |
| 171 * | 171 * |
| 172 * Incoming client connections are promoted to secure connections, | 172 * Incoming client connections are promoted to secure connections, |
| 173 * using the server certificate given by [certificateName]. | 173 * using the server certificate and key set in [context]. |
| 174 * | 174 * |
| 175 * [address] must be given as a numeric address, not a host name. | 175 * [address] must be given as a numeric address, not a host name. |
| 176 * | 176 * |
| 177 * [certificateName] is the nickname or the distinguished name (DN) of | |
| 178 * the certificate in the certificate database. It is looked up in the | |
| 179 * NSS certificate database set by SecureSocket.setCertificateDatabase. | |
| 180 * If [certificateName] contains "CN=", it is assumed to be a distinguished | |
| 181 * name. Otherwise, it is looked up as a nickname. | |
| 182 * | |
| 183 * To request or require that clients authenticate by providing an SSL (TLS) | 177 * To request or require that clients authenticate by providing an SSL (TLS) |
| 184 * client certificate, set the optional parameters requestClientCertificate or | 178 * client certificate, set the optional parameters requestClientCertificate or |
| 185 * requireClientCertificate to true. Require implies request, so one doesn't | 179 * requireClientCertificate to true. Require implies request, so one doesn't |
| 186 * need to specify both. To check whether a client certificate was received, | 180 * need to specify both. To check whether a client certificate was received, |
| 187 * check SecureSocket.peerCertificate after connecting. If no certificate | 181 * check SecureSocket.peerCertificate after connecting. If no certificate |
| 188 * was received, the result will be null. | 182 * was received, the result will be null. |
| 189 * | 183 * |
| 190 * The optional argument [shared] specify whether additional binds | 184 * The optional argument [shared] specifies whether additional |
| 191 * to the same `address`, `port` and `v6Only` combination is | 185 * RawSecureServerSocket objects can bind to the same combination of |
| 192 * possible from the same Dart process. If `shared` is `true` and | 186 * `address`, `port` and `v6Only`. If `shared` is `true` and more |
| 193 * additional binds are performed, then the incoming connections | 187 * `RawSecureServerSocket`s from this isolate or other isolates are bound to |
| 194 * will be distributed between that set of | 188 * the port, then the incoming connections will be distributed among all the |
| 195 * `RawSecureServerSocket`s. One way of using this is to have number | 189 * bound `RawSecureServerSocket`s. Connections can be distributed over |
| 196 * of isolates between which incoming connections are distributed. | 190 * multiple isolates this way. |
| 197 */ | 191 */ |
| 198 static Future<RawSecureServerSocket> bind( | 192 static Future<RawSecureServerSocket> bind( |
| 199 address, | 193 address, |
| 200 int port, | 194 int port, |
| 201 SecurityContext context, | 195 SecurityContext context, |
| 202 {int backlog: 0, | 196 {int backlog: 0, |
| 203 bool v6Only: false, | 197 bool v6Only: false, |
| 204 bool requestClientCertificate: false, | 198 bool requestClientCertificate: false, |
| 205 bool requireClientCertificate: false, | 199 bool requireClientCertificate: false, |
| 206 List<String> supportedProtocols, | 200 List<String> supportedProtocols, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 close(); | 286 close(); |
| 293 } | 287 } |
| 294 } | 288 } |
| 295 | 289 |
| 296 void set _owner(owner) { | 290 void set _owner(owner) { |
| 297 (_socket as dynamic)._owner = owner; | 291 (_socket as dynamic)._owner = owner; |
| 298 } | 292 } |
| 299 } | 293 } |
| 300 | 294 |
| 301 | 295 |
| OLD | NEW |