OLD | NEW |
(Empty) | |
| 1 // (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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 // VMOptions= |
| 6 // VMOptions=--short_socket_read |
| 7 // VMOptions=--short_socket_write |
| 8 // VMOptions=--short_socket_read --short_socket_write |
| 9 |
| 10 import "package:expect/expect.dart"; |
| 11 import "dart:async"; |
| 12 import "dart:isolate"; |
| 13 import "dart:io"; |
| 14 |
| 15 // Client makes a HTTP 1.0 request without connection keep alive. The |
| 16 // server sets a content length but still needs to close the |
| 17 // connection as there is no keep alive. |
| 18 void testHttpIPv6() { |
| 19 HttpServer.bind("::", 0).then((server) { |
| 20 server.listen((HttpRequest request) { |
| 21 Expect.equals(request.headers["host"][0], "[::]:${server.port}"); |
| 22 Expect.equals(request.requestedUri.host, "::"); |
| 23 request.response.close(); |
| 24 }); |
| 25 |
| 26 var client = new HttpClient(); |
| 27 var url = Uri.parse('http://[::]:${server.port}/xxx'); |
| 28 Expect.equals(url.host, '::'); |
| 29 client.openUrl('GET', url) |
| 30 .then((request) => request.close()) |
| 31 .then((response) { |
| 32 Expect.equals(response.statusCode, HttpStatus.OK); |
| 33 }).whenComplete(() { |
| 34 server.close(); |
| 35 client.close(); |
| 36 }); |
| 37 }); |
| 38 } |
| 39 |
| 40 |
| 41 |
| 42 void main() { |
| 43 testHttpIPv6(); |
| 44 } |
OLD | NEW |