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 library safe_http_server; | 5 library safe_http_server; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 // TODO(nweiz): remove this when issue 9140 is fixed. | 10 // TODO(nweiz): remove this when issue 9140 is fixed. |
(...skipping 12 matching lines...) Expand all Loading... |
23 static Future<SafeHttpServer> bind([String host = "localhost", | 23 static Future<SafeHttpServer> bind([String host = "localhost", |
24 int port = 0, int backlog = 0]) { | 24 int port = 0, int backlog = 0]) { |
25 return HttpServer.bind(host, port, backlog: backlog) | 25 return HttpServer.bind(host, port, backlog: backlog) |
26 .then((server) => new SafeHttpServer(server)); | 26 .then((server) => new SafeHttpServer(server)); |
27 } | 27 } |
28 | 28 |
29 SafeHttpServer(HttpServer server) | 29 SafeHttpServer(HttpServer server) |
30 : super(server), | 30 : super(server), |
31 _inner = server; | 31 _inner = server; |
32 | 32 |
33 void close() => _inner.close(); | 33 Future close() => _inner.close(); |
34 | 34 |
35 int get port => _inner.port; | 35 int get port => _inner.port; |
36 | 36 |
37 set sessionTimeout(int timeout) { | 37 set sessionTimeout(int timeout) { |
38 _inner.sessionTimeout = timeout; | 38 _inner.sessionTimeout = timeout; |
39 } | 39 } |
40 | 40 |
41 HttpConnectionsInfo connectionsInfo() => _inner.connectionsInfo(); | 41 HttpConnectionsInfo connectionsInfo() => _inner.connectionsInfo(); |
42 | 42 |
43 StreamSubscription<HttpRequest> listen(void onData(HttpRequest value), | 43 StreamSubscription<HttpRequest> listen(void onData(HttpRequest value), |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 Future<HttpResponse> addStream(Stream<List<int>> stream) => | 132 Future<HttpResponse> addStream(Stream<List<int>> stream) => |
133 _inner.addStream(stream); | 133 _inner.addStream(stream); |
134 Future close() => _inner.close(); | 134 Future close() => _inner.close(); |
135 void write(Object obj) => _inner.write(obj); | 135 void write(Object obj) => _inner.write(obj); |
136 void writeAll(Iterable objects, [String separator = ""]) => | 136 void writeAll(Iterable objects, [String separator = ""]) => |
137 _inner.writeAll(objects, separator); | 137 _inner.writeAll(objects, separator); |
138 void writeCharCode(int charCode) => _inner.writeCharCode(charCode); | 138 void writeCharCode(int charCode) => _inner.writeCharCode(charCode); |
139 void writeln([Object obj = ""]) => _inner.writeln(obj); | 139 void writeln([Object obj = ""]) => _inner.writeln(obj); |
140 void addError(error) => _inner.addError(error); | 140 void addError(error) => _inner.addError(error); |
141 } | 141 } |
OLD | NEW |