Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #source("../../../../runtime/bin/http_parser.dart"); | 5 #source("../../../../runtime/bin/http_parser.dart"); |
| 6 | 6 |
| 7 class HttpParserTest { | 7 class HttpParserTest { |
| 8 static void runAllTests() { | 8 static void runAllTests() { |
| 9 testParseRequest(); | 9 testParseRequest(); |
| 10 testParseResponse(); | 10 testParseResponse(); |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 | 533 |
| 534 request = "GET / TTP/1.1\r\n\r\n"; | 534 request = "GET / TTP/1.1\r\n\r\n"; |
| 535 _testParseInvalidRequest(request); | 535 _testParseInvalidRequest(request); |
| 536 | 536 |
| 537 request = "GET / HTTP/1.\r\n\r\n"; | 537 request = "GET / HTTP/1.\r\n\r\n"; |
| 538 _testParseInvalidRequest(request); | 538 _testParseInvalidRequest(request); |
| 539 | 539 |
| 540 // Currently no HTTP 1.0 support. | 540 // Currently no HTTP 1.0 support. |
| 541 request = "GET / HTTP/1.0\r\n\r\n"; | 541 request = "GET / HTTP/1.0\r\n\r\n"; |
| 542 _testParseInvalidRequest(request); | 542 _testParseInvalidRequest(request); |
| 543 | |
| 544 Expect.throws(() { | |
| 545 // Issue #2370 | |
|
Søren Gjesse
2012/04/02 08:23:46
We normally format like this:
// TODO(2370): HTTP
Anders Johnsen
2012/04/02 08:25:44
Ah, right, thank you!
| |
| 546 request = "GET / HTTP/1.1\r\nKeep-Alive: False\r\nbadheader\r\n\r\n"; | |
| 547 _testParseInvalidRequest(request); | |
| 548 }); | |
| 543 } | 549 } |
| 544 | 550 |
| 545 static void testParseInvalidResponse() { | 551 static void testParseInvalidResponse() { |
| 546 String response; | 552 String response; |
| 547 | 553 |
| 548 response = "HTTP/1.1\r\nContent-Length: 0\r\n\r\n"; | 554 response = "HTTP/1.1\r\nContent-Length: 0\r\n\r\n"; |
| 549 _testParseInvalidResponse(response); | 555 _testParseInvalidResponse(response); |
| 550 | 556 |
| 551 response = "HTTP/1.1 \r\nContent-Length: 0\r\n\r\n"; | 557 response = "HTTP/1.1 \r\nContent-Length: 0\r\n\r\n"; |
| 552 _testParseInvalidResponse(response); | 558 _testParseInvalidResponse(response); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 588 0123456789012345678901234567890\r | 594 0123456789012345678901234567890\r |
| 589 0\r\n\r\n"""; | 595 0\r\n\r\n"""; |
| 590 _testParseInvalidResponse(response); | 596 _testParseInvalidResponse(response); |
| 591 } | 597 } |
| 592 } | 598 } |
| 593 | 599 |
| 594 | 600 |
| 595 void main() { | 601 void main() { |
| 596 HttpParserTest.runAllTests(); | 602 HttpParserTest.runAllTests(); |
| 597 } | 603 } |
| OLD | NEW |