| 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 // 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 "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 _requestHandlers["/expires2"] = _expires2Handler; | 199 _requestHandlers["/expires2"] = _expires2Handler; |
| 200 _requestHandlers["/contenttype1"] = _contentType1Handler; | 200 _requestHandlers["/contenttype1"] = _contentType1Handler; |
| 201 _requestHandlers["/contenttype2"] = _contentType2Handler; | 201 _requestHandlers["/contenttype2"] = _contentType2Handler; |
| 202 _requestHandlers["/cookie1"] = _cookie1Handler; | 202 _requestHandlers["/cookie1"] = _cookie1Handler; |
| 203 _requestHandlers["/cookie2"] = _cookie2Handler; | 203 _requestHandlers["/cookie2"] = _cookie2Handler; |
| 204 } | 204 } |
| 205 | 205 |
| 206 void dispatch(message, replyTo) { | 206 void dispatch(message, replyTo) { |
| 207 if (message.isStart) { | 207 if (message.isStart) { |
| 208 try { | 208 try { |
| 209 HttpServer.bind().then((server) { | 209 HttpServer.bind("127.0.0.1", 0).then((server) { |
| 210 _server = server; | 210 _server = server; |
| 211 _server.listen(_requestReceivedHandler); | 211 _server.listen(_requestReceivedHandler); |
| 212 replyTo.send(new IsolatedHttpServerStatus.started(_server.port), | 212 replyTo.send(new IsolatedHttpServerStatus.started(_server.port), |
| 213 null); | 213 null); |
| 214 }); | 214 }); |
| 215 } catch (e) { | 215 } catch (e) { |
| 216 replyTo.send(new IsolatedHttpServerStatus.error(), null); | 216 replyTo.send(new IsolatedHttpServerStatus.error(), null); |
| 217 } | 217 } |
| 218 } else if (message.isStop) { | 218 } else if (message.isStop) { |
| 219 _server.close(); | 219 _server.close(); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 | 421 |
| 422 void main() { | 422 void main() { |
| 423 testHost().then((_) { | 423 testHost().then((_) { |
| 424 return testExpires().then((_) { | 424 return testExpires().then((_) { |
| 425 return testContentType().then((_) { | 425 return testContentType().then((_) { |
| 426 return testCookies(); | 426 return testCookies(); |
| 427 }); | 427 }); |
| 428 }); | 428 }); |
| 429 }); | 429 }); |
| 430 } | 430 } |
| OLD | NEW |