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 import 'dart:uri'; | 9 import 'dart:uri'; |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 static Future<SafeHttpServer> bind([String host = "127.0.0.1", | 24 static Future<SafeHttpServer> bind([String host = "127.0.0.1", |
25 int port = 0, int backlog = 0]) { | 25 int port = 0, int backlog = 0]) { |
26 return HttpServer.bind(host, port, backlog) | 26 return HttpServer.bind(host, port, backlog) |
27 .then((server) => new SafeHttpServer(server)); | 27 .then((server) => new SafeHttpServer(server)); |
28 } | 28 } |
29 | 29 |
30 SafeHttpServer(HttpServer server) | 30 SafeHttpServer(HttpServer server) |
31 : super(server), | 31 : super(server), |
32 _inner = server; | 32 _inner = server; |
33 | 33 |
34 Future close() => _inner.close(); | 34 void close() => _inner.close(); |
35 | 35 |
36 int get port => _inner.port; | 36 int get port => _inner.port; |
37 | 37 |
38 set sessionTimeout(int timeout) { | 38 set sessionTimeout(int timeout) { |
39 _inner.sessionTimeout = timeout; | 39 _inner.sessionTimeout = timeout; |
40 } | 40 } |
41 | 41 |
42 HttpConnectionsInfo connectionsInfo() => _inner.connectionsInfo(); | 42 HttpConnectionsInfo connectionsInfo() => _inner.connectionsInfo(); |
43 | 43 |
44 StreamSubscription<HttpRequest> listen(void onData(HttpRequest value), | 44 StreamSubscription<HttpRequest> listen(void onData(HttpRequest value), |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 _inner.encoding = value; | 127 _inner.encoding = value; |
128 } | 128 } |
129 | 129 |
130 HttpHeaders get headers => _inner.headers; | 130 HttpHeaders get headers => _inner.headers; |
131 List<Cookie> get cookies => _inner.cookies; | 131 List<Cookie> get cookies => _inner.cookies; |
132 Future<Socket> detachSocket() => _inner.detachSocket(); | 132 Future<Socket> detachSocket() => _inner.detachSocket(); |
133 HttpConnectionInfo get connectionInfo => _inner.connectionInfo; | 133 HttpConnectionInfo get connectionInfo => _inner.connectionInfo; |
134 void add(List<int> data) => _inner.add(data); | 134 void add(List<int> data) => _inner.add(data); |
135 Future<HttpResponse> consume(Stream<List<int>> stream) => | 135 Future<HttpResponse> consume(Stream<List<int>> stream) => |
136 _inner.consume(stream); | 136 _inner.consume(stream); |
| 137 Future<HttpResponse> addStream(Stream<List<int>> stream) => |
| 138 _inner.addStream(stream); |
137 Future<HttpResponse> writeStream(Stream<List<int>> stream) => | 139 Future<HttpResponse> writeStream(Stream<List<int>> stream) => |
138 _inner.writeStream(stream); | 140 _inner.writeStream(stream); |
139 Future close() => _inner.close(); | 141 Future close() => _inner.close(); |
140 void write(Object obj) => _inner.write(obj); | 142 void write(Object obj) => _inner.write(obj); |
141 void writeAll(Iterable objects, [String separator = ""]) => | 143 void writeAll(Iterable objects, [String separator = ""]) => |
142 _inner.writeAll(objects, separator); | 144 _inner.writeAll(objects, separator); |
143 void writeCharCode(int charCode) => _inner.writeCharCode(charCode); | 145 void writeCharCode(int charCode) => _inner.writeCharCode(charCode); |
144 void writeln([Object obj = ""]) => _inner.writeln(obj); | 146 void writeln([Object obj = ""]) => _inner.writeln(obj); |
| 147 void addError(AsyncError error) => _inner.addError(error); |
145 } | 148 } |
OLD | NEW |