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 request = "GET / HTTP/1.1\r\nKeep-Alive: False\r\nbadheader\r\n\r\n"; | |
| 545 _testParseInvalidRequest(request); | |
|
Søren Gjesse
2012/04/02 07:36:02
You should open a bug on this, and then wrap this
Anders Johnsen
2012/04/02 08:19:01
Done.
| |
| 543 } | 546 } |
| 544 | 547 |
| 545 static void testParseInvalidResponse() { | 548 static void testParseInvalidResponse() { |
| 546 String response; | 549 String response; |
| 547 | 550 |
| 548 response = "HTTP/1.1\r\nContent-Length: 0\r\n\r\n"; | 551 response = "HTTP/1.1\r\nContent-Length: 0\r\n\r\n"; |
| 549 _testParseInvalidResponse(response); | 552 _testParseInvalidResponse(response); |
| 550 | 553 |
| 551 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"; |
| 552 _testParseInvalidResponse(response); | 555 _testParseInvalidResponse(response); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 588 0123456789012345678901234567890\r | 591 0123456789012345678901234567890\r |
| 589 0\r\n\r\n"""; | 592 0\r\n\r\n"""; |
| 590 _testParseInvalidResponse(response); | 593 _testParseInvalidResponse(response); |
| 591 } | 594 } |
| 592 } | 595 } |
| 593 | 596 |
| 594 | 597 |
| 595 void main() { | 598 void main() { |
| 596 HttpParserTest.runAllTests(); | 599 HttpParserTest.runAllTests(); |
| 597 } | 600 } |
| OLD | NEW |