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 // OtherResources=http_server_response_test.dart | 9 // OtherResources=http_server_response_test.dart |
10 | 10 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 .fold(0, (s, b) => s + b.length) | 274 .fold(0, (s, b) => s + b.length) |
275 .then((bytes) { | 275 .then((bytes) { |
276 Expect.equals(8, bytes); | 276 Expect.equals(8, bytes); |
277 server.close(); | 277 server.close(); |
278 }); | 278 }); |
279 }); | 279 }); |
280 }); | 280 }); |
281 } | 281 } |
282 | 282 |
283 | 283 |
| 284 void testBadHeaders() { |
| 285 testServerRequest((server, request) { |
| 286 var value = "a"; |
| 287 for (int i = 0; i < 8 * 1024; i++) { |
| 288 value += 'a'; |
| 289 } |
| 290 request.response.headers.set('name', value); |
| 291 request.response.close().catchError((error) { |
| 292 server.close(); |
| 293 }, test: (e) => e is HttpException); |
| 294 }); |
| 295 } |
| 296 |
| 297 |
284 void testWriteCharCode() { | 298 void testWriteCharCode() { |
285 testServerRequest((server, request) { | 299 testServerRequest((server, request) { |
286 // Test that default is latin-1 (only 2 bytes). | 300 // Test that default is latin-1 (only 2 bytes). |
287 request.response.writeCharCode(0xFF); | 301 request.response.writeCharCode(0xFF); |
288 request.response.writeCharCode(0xFF); | 302 request.response.writeCharCode(0xFF); |
289 request.response.close().then((_) { | 303 request.response.close().then((_) { |
290 server.close(); | 304 server.close(); |
291 }); | 305 }); |
292 }, bytes: 2); | 306 }, bytes: 2); |
293 } | 307 } |
294 | 308 |
295 | 309 |
296 void main() { | 310 void main() { |
297 testResponseDone(); | 311 testResponseDone(); |
298 testResponseAddStream(); | 312 testResponseAddStream(); |
299 testResponseAddStreamClosed(); | 313 testResponseAddStreamClosed(); |
300 testResponseAddClosed(); | 314 testResponseAddClosed(); |
301 testBadResponseAdd(); | 315 testBadResponseAdd(); |
302 testBadResponseClose(); | 316 testBadResponseClose(); |
303 testIgnoreRequestData(); | 317 testIgnoreRequestData(); |
| 318 testBadHeaders(); |
304 testWriteCharCode(); | 319 testWriteCharCode(); |
305 } | 320 } |
OLD | NEW |