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 * HTTP status codes. | 8 * HTTP status codes. |
9 */ | 9 */ |
10 abstract class HttpStatus { | 10 abstract class HttpStatus { |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 * only. | 227 * only. |
228 * | 228 * |
229 * If [port] has the value [:0:] an ephemeral port will be chosen by | 229 * If [port] has the value [:0:] an ephemeral port will be chosen by |
230 * the system. The actual port used can be retrieved using the | 230 * the system. The actual port used can be retrieved using the |
231 * [port] getter. | 231 * [port] getter. |
232 * | 232 * |
233 * The optional argument [backlog] can be used to specify the listen | 233 * The optional argument [backlog] can be used to specify the listen |
234 * backlog for the underlying OS listen setup. If [backlog] has the | 234 * backlog for the underlying OS listen setup. If [backlog] has the |
235 * value of [:0:] (the default) a reasonable value will be chosen by | 235 * value of [:0:] (the default) a reasonable value will be chosen by |
236 * the system. | 236 * the system. |
237 * | |
238 * The optional argument [shared] specify whether additional binds | |
239 * to the same `address`, `port` and `v6Only` combination is | |
240 * possible from the same Dart process. If `shared` is `true` and | |
241 * additional binds are preformed, then the incoming (incoming) | |
kustermann
2015/02/17 11:30:55
preformed -> performed
remove "(incoming)"?
- al
Søren Gjesse
2015/02/17 12:53:10
Done.
| |
242 * connections will be distributed between that set | |
kustermann
2015/02/17 11:30:56
that set -> that set of
- also below
Søren Gjesse
2015/02/17 12:53:10
Done.
| |
243 * `HttpServer`s. One way of using this is to have number of | |
244 * isolates between which incoming connections are distributed. | |
237 */ | 245 */ |
kustermann
2015/02/17 11:30:56
Maybe also describe [v6Only] - also below
Søren Gjesse
2015/02/17 12:53:10
Done.
| |
238 static Future<HttpServer> bind(address, | 246 static Future<HttpServer> bind(address, |
239 int port, | 247 int port, |
240 {int backlog: 0}) | 248 {int backlog: 0, |
241 => _HttpServer.bind(address, port, backlog); | 249 bool v6Only: false, |
250 bool shared: false}) | |
251 => _HttpServer.bind(address, port, backlog, v6Only, shared); | |
242 | 252 |
243 /** | 253 /** |
244 * The [address] can either be a [String] or an | 254 * The [address] can either be a [String] or an |
245 * [InternetAddress]. If [address] is a [String], [bind] will | 255 * [InternetAddress]. If [address] is a [String], [bind] will |
246 * perform a [InternetAddress.lookup] and use the first value in the | 256 * perform a [InternetAddress.lookup] and use the first value in the |
247 * list. To listen on the loopback adapter, which will allow only | 257 * list. To listen on the loopback adapter, which will allow only |
248 * incoming connections from the local host, use the value | 258 * incoming connections from the local host, use the value |
249 * [InternetAddress.LOOPBACK_IP_V4] or | 259 * [InternetAddress.LOOPBACK_IP_V4] or |
250 * [InternetAddress.LOOPBACK_IP_V6]. To allow for incoming | 260 * [InternetAddress.LOOPBACK_IP_V6]. To allow for incoming |
251 * connection from the network use either one of the values | 261 * connection from the network use either one of the values |
(...skipping 12 matching lines...) Expand all Loading... | |
264 * | 274 * |
265 * The optional argument [backlog] can be used to specify the listen | 275 * The optional argument [backlog] can be used to specify the listen |
266 * backlog for the underlying OS listen setup. If [backlog] has the | 276 * backlog for the underlying OS listen setup. If [backlog] has the |
267 * value of [:0:] (the default) a reasonable value will be chosen by | 277 * value of [:0:] (the default) a reasonable value will be chosen by |
268 * the system. | 278 * the system. |
269 * | 279 * |
270 * The certificate with nickname or distinguished name (DN) [certificateName] | 280 * The certificate with nickname or distinguished name (DN) [certificateName] |
271 * is looked up in the certificate database, and is used as the server | 281 * is looked up in the certificate database, and is used as the server |
272 * certificate. If [requestClientCertificate] is true, the server will | 282 * certificate. If [requestClientCertificate] is true, the server will |
273 * request clients to authenticate with a client certificate. | 283 * request clients to authenticate with a client certificate. |
284 * | |
285 * The optional argument [shared] specify whether additional binds | |
286 * to the same `address`, `port` and `v6Only` combination is | |
287 * possible from the same Dart process. If `shared` is `true` and | |
288 * additional binds are preformed, then the incoming (incoming) | |
289 * connections will be distributed between that set | |
290 * `HttpServer`s. One way of using this is to have number of | |
291 * isolates between which incoming connections are distributed. | |
274 */ | 292 */ |
275 | 293 |
276 static Future<HttpServer> bindSecure(address, | 294 static Future<HttpServer> bindSecure(address, |
277 int port, | 295 int port, |
278 {int backlog: 0, | 296 {int backlog: 0, |
297 bool v6Only: false, | |
279 String certificateName, | 298 String certificateName, |
280 bool requestClientCertificate: false}) | 299 bool requestClientCertificate: false, |
300 bool shared: false}) | |
281 => _HttpServer.bindSecure(address, | 301 => _HttpServer.bindSecure(address, |
282 port, | 302 port, |
283 backlog, | 303 backlog, |
304 v6Only, | |
284 certificateName, | 305 certificateName, |
285 requestClientCertificate); | 306 requestClientCertificate, |
307 shared); | |
286 | 308 |
287 /** | 309 /** |
288 * Attaches the HTTP server to an existing [ServerSocket]. When the | 310 * Attaches the HTTP server to an existing [ServerSocket]. When the |
289 * [HttpServer] is closed, the [HttpServer] will just detach itself, | 311 * [HttpServer] is closed, the [HttpServer] will just detach itself, |
290 * closing current connections but not closing [serverSocket]. | 312 * closing current connections but not closing [serverSocket]. |
291 */ | 313 */ |
292 factory HttpServer.listenOn(ServerSocket serverSocket) | 314 factory HttpServer.listenOn(ServerSocket serverSocket) |
293 => new _HttpServer.listenOn(serverSocket); | 315 => new _HttpServer.listenOn(serverSocket); |
294 | 316 |
295 /** | 317 /** |
(...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1990 class RedirectException implements HttpException { | 2012 class RedirectException implements HttpException { |
1991 final String message; | 2013 final String message; |
1992 final List<RedirectInfo> redirects; | 2014 final List<RedirectInfo> redirects; |
1993 | 2015 |
1994 const RedirectException(this.message, this.redirects); | 2016 const RedirectException(this.message, this.redirects); |
1995 | 2017 |
1996 String toString() => "RedirectException: $message"; | 2018 String toString() => "RedirectException: $message"; |
1997 | 2019 |
1998 Uri get uri => redirects.last.location; | 2020 Uri get uri => redirects.last.location; |
1999 } | 2021 } |
OLD | NEW |