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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // server sets a content length so the persistent connection can be | 121 // server sets a content length so the persistent connection can be |
122 // used. | 122 // used. |
123 void testHttp10KeepAlive() { | 123 void testHttp10KeepAlive() { |
124 HttpServer.bind("127.0.0.1", 0).then((server) { | 124 HttpServer.bind("127.0.0.1", 0).then((server) { |
125 server.listen( | 125 server.listen( |
126 (HttpRequest request) { | 126 (HttpRequest request) { |
127 Expect.isNull(request.headers.value('content-length')); | 127 Expect.isNull(request.headers.value('content-length')); |
128 Expect.equals(-1, request.contentLength); | 128 Expect.equals(-1, request.contentLength); |
129 var response = request.response; | 129 var response = request.response; |
130 response.contentLength = 1; | 130 response.contentLength = 1; |
| 131 response.persistentConnection = true; |
131 Expect.equals("1.0", request.protocolVersion); | 132 Expect.equals("1.0", request.protocolVersion); |
132 response.write("Z"); | 133 response.write("Z"); |
133 response.close(); | 134 response.close(); |
134 }, | 135 }, |
135 onError: (e, trace) { | 136 onError: (e, trace) { |
136 String msg = "Unexpected error $e"; | 137 String msg = "Unexpected error $e"; |
137 if (trace != null) msg += "\nStackTrace: $trace"; | 138 if (trace != null) msg += "\nStackTrace: $trace"; |
138 Expect.fail(msg); | 139 Expect.fail(msg); |
139 }); | 140 }); |
140 | 141 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 }); | 221 }); |
221 } | 222 } |
222 | 223 |
223 | 224 |
224 void main() { | 225 void main() { |
225 testHttp10NoKeepAlive(); | 226 testHttp10NoKeepAlive(); |
226 testHttp10ServerClose(); | 227 testHttp10ServerClose(); |
227 testHttp10KeepAlive(); | 228 testHttp10KeepAlive(); |
228 testHttp10KeepAliveServerCloses(); | 229 testHttp10KeepAliveServerCloses(); |
229 } | 230 } |
OLD | NEW |