OLD | NEW |
1 // (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 Socket.connect("127.0.0.1", server.port).then((socket) { | 43 Socket.connect("127.0.0.1", server.port).then((socket) { |
44 socket.write("GET / HTTP/1.0\r\n\r\n"); | 44 socket.write("GET / HTTP/1.0\r\n\r\n"); |
45 | 45 |
46 List<int> response = []; | 46 List<int> response = []; |
47 socket.listen( | 47 socket.listen( |
48 response.addAll, | 48 response.addAll, |
49 onDone: () { | 49 onDone: () { |
50 count++; | 50 count++; |
51 socket.destroy(); | 51 socket.destroy(); |
52 String s = new String.fromCharCodes(response).toLowerCase(); | 52 String s = new String.fromCharCodes(response).toLowerCase(); |
53 Expect.isTrue(s.indexOf("\r\ncontent-length: 1\r\n") > 0); | |
54 Expect.equals(-1, s.indexOf("keep-alive")); | 53 Expect.equals(-1, s.indexOf("keep-alive")); |
55 if (count < 10) { | 54 if (count < 10) { |
56 makeRequest(); | 55 makeRequest(); |
57 } else { | 56 } else { |
58 server.close(); | 57 server.close(); |
59 } | 58 } |
60 }); | 59 }); |
61 }); | 60 }); |
62 } | 61 } |
63 makeRequest(); | 62 makeRequest(); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 }); | 220 }); |
222 } | 221 } |
223 | 222 |
224 | 223 |
225 void main() { | 224 void main() { |
226 testHttp10NoKeepAlive(); | 225 testHttp10NoKeepAlive(); |
227 testHttp10ServerClose(); | 226 testHttp10ServerClose(); |
228 testHttp10KeepAlive(); | 227 testHttp10KeepAlive(); |
229 testHttp10KeepAliveServerCloses(); | 228 testHttp10KeepAliveServerCloses(); |
230 } | 229 } |
OLD | NEW |