OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// A Shelf adapter for handling [HttpRequest] objects from `dart:io`. | 5 /// A Shelf adapter for handling [HttpRequest] objects from `dart:io`. |
6 /// | 6 /// |
7 /// One can provide an instance of [HttpServer] as the `requests` parameter in | 7 /// One can provide an instance of [HttpServer] as the `requests` parameter in |
8 /// [serveRequests]. | 8 /// [serveRequests]. |
9 /// | 9 /// |
10 /// This adapter supports request hijacking; see [Request.hijack]. It also | 10 /// This adapter supports request hijacking; see [Request.hijack]. It also |
11 /// supports the `"shelf.io.buffer_output"` `Response.context` property. If this | 11 /// supports the `"shelf.io.buffer_output"` `Response.context` property. If this |
12 /// property is `true` (the default), streamed responses will be buffered to | 12 /// property is `true` (the default), streamed responses will be buffered to |
13 /// improve performance; if it's `false`, all chunks will be pushed over the | 13 /// improve performance; if it's `false`, all chunks will be pushed over the |
14 /// wire as they're received. See [`HttpResponse.bufferOutput`][bufferOutput] | 14 /// wire as they're received. See [`HttpResponse.bufferOutput`][bufferOutput] |
15 /// for more information. | 15 /// for more information. |
16 /// | 16 /// |
17 /// [bufferOutput]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-vie
wer/dart:io.HttpResponse#id_bufferOutput | 17 /// [bufferOutput]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-vie
wer/dart:io.HttpResponse#id_bufferOutput |
18 library shelf.io; | |
19 | |
20 import 'dart:async'; | 18 import 'dart:async'; |
21 import 'dart:io'; | 19 import 'dart:io'; |
22 | 20 |
23 import 'package:stack_trace/stack_trace.dart'; | 21 import 'package:stack_trace/stack_trace.dart'; |
24 | 22 |
25 import 'shelf.dart'; | 23 import 'shelf.dart'; |
26 import 'src/util.dart'; | 24 import 'src/util.dart'; |
27 | 25 |
28 export 'src/io_server.dart'; | 26 export 'src/io_server.dart'; |
29 | 27 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 chain = new Chain.forTrace(stackTrace); | 175 chain = new Chain.forTrace(stackTrace); |
178 } | 176 } |
179 chain = chain | 177 chain = chain |
180 .foldFrames((frame) => frame.isCore || frame.package == 'shelf').terse; | 178 .foldFrames((frame) => frame.isCore || frame.package == 'shelf').terse; |
181 | 179 |
182 stderr.writeln('ERROR - ${new DateTime.now()}'); | 180 stderr.writeln('ERROR - ${new DateTime.now()}'); |
183 stderr.writeln(message); | 181 stderr.writeln(message); |
184 stderr.writeln(chain); | 182 stderr.writeln(chain); |
185 return new Response.internalServerError(); | 183 return new Response.internalServerError(); |
186 } | 184 } |
OLD | NEW |