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 | 5 |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 import "dart:async"; | 7 import "dart:async"; |
8 import "dart:io"; | 8 import "dart:io"; |
9 import "dart:uri"; | |
10 | 9 |
11 void testHttp10Close(bool closeRequest) { | 10 void testHttp10Close(bool closeRequest) { |
12 HttpServer.bind("127.0.0.1", 0).then((server) { | 11 HttpServer.bind("127.0.0.1", 0).then((server) { |
13 server.listen((request) { | 12 server.listen((request) { |
14 request.response.close(); | 13 request.response.close(); |
15 }); | 14 }); |
16 | 15 |
17 Socket.connect("127.0.0.1", server.port) | 16 Socket.connect("127.0.0.1", server.port) |
18 .then((socket) { | 17 .then((socket) { |
19 socket.write("GET / HTTP/1.0\r\n\r\n"); | 18 socket.write("GET / HTTP/1.0\r\n\r\n"); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 }); | 81 }); |
83 } | 82 } |
84 | 83 |
85 main() { | 84 main() { |
86 testHttp10Close(false); | 85 testHttp10Close(false); |
87 testHttp10Close(true); | 86 testHttp10Close(true); |
88 testHttp11Close(false); | 87 testHttp11Close(false); |
89 testHttp11Close(true); | 88 testHttp11Close(true); |
90 testStreamResponse(); | 89 testStreamResponse(); |
91 } | 90 } |
OLD | NEW |