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 // VMOptions= | 5 // VMOptions= |
6 // VMOptions=--short_socket_read | 6 // VMOptions=--short_socket_read |
7 // VMOptions=--short_socket_write | 7 // VMOptions=--short_socket_write |
8 // VMOptions=--short_socket_read --short_socket_write | 8 // VMOptions=--short_socket_read --short_socket_write |
9 | 9 |
10 #import("dart:isolate"); | 10 #import("dart:isolate"); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 void dispatch(message, replyTo) { | 214 void dispatch(message, replyTo) { |
215 if (message.isStart) { | 215 if (message.isStart) { |
216 _server = new HttpServer(); | 216 _server = new HttpServer(); |
217 try { | 217 try { |
218 _server.listen("127.0.0.1", 0); | 218 _server.listen("127.0.0.1", 0); |
219 _server.defaultRequestHandler = (HttpRequest req, HttpResponse rsp) { | 219 _server.defaultRequestHandler = (HttpRequest req, HttpResponse rsp) { |
220 _requestReceivedHandler(req, rsp); | 220 _requestReceivedHandler(req, rsp); |
221 }; | 221 }; |
222 replyTo.send(new TestServerStatus.started(_server.port), null); | 222 replyTo.send(new TestServerStatus.started(_server.port), null); |
223 } catch (var e) { | 223 } catch (e) { |
224 replyTo.send(new TestServerStatus.error(), null); | 224 replyTo.send(new TestServerStatus.error(), null); |
225 } | 225 } |
226 } else if (message.isStop) { | 226 } else if (message.isStop) { |
227 _server.close(); | 227 _server.close(); |
228 port.close(); | 228 port.close(); |
229 replyTo.send(new TestServerStatus.stopped(), null); | 229 replyTo.send(new TestServerStatus.stopped(), null); |
230 } else if (message.isChunkedEncoding) { | 230 } else if (message.isChunkedEncoding) { |
231 _chunkedEncoding = true; | 231 _chunkedEncoding = true; |
232 } | 232 } |
233 } | 233 } |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 }); | 404 }); |
405 testServerMain.start(); | 405 testServerMain.start(); |
406 } | 406 } |
407 | 407 |
408 void main() { | 408 void main() { |
409 testHost(); | 409 testHost(); |
410 testExpires(); | 410 testExpires(); |
411 testContentType(); | 411 testContentType(); |
412 testCookies(); | 412 testCookies(); |
413 } | 413 } |
OLD | NEW |