| 3548 | } |
| 3549 | |
| 3550 | int |
| 3551 | main (void) |
| 3552 | { |
| 3553 | parser = NULL; |
| 3554 | int i, j, k; |
| 3555 | int request_count; |
| 3556 | int response_count; |
| 3557 | unsigned long version; |
| 3558 | unsigned major; |
| 3559 | unsigned minor; |
| 3560 | unsigned patch; |
| 3561 | |
| 3562 | version = http_parser_version(); |
| 3563 | major = (version >> 16) & 255; |
| 3564 | minor = (version >> 8) & 255; |
| 3565 | patch = version & 255; |
| 3566 | printf("http_parser v%u.%u.%u (0x%06lx)\n", major, minor, patch, version); |
| 3567 | |
| 3568 | printf("sizeof(http_parser) = %u\n", (unsigned int)sizeof(http_parser)); |
| 3569 | |
| 3570 | for (request_count = 0; requests[request_count].name; request_count++); |
| 3571 | for (response_count = 0; responses[response_count].name; response_count++); |
| 3572 | |
| 3573 | //// API |
| 3574 | test_preserve_data(); |
| 3575 | test_parse_url(); |
| 3576 | test_method_str(); |
| 3577 | |
| 3578 | //// NREAD |
| 3579 | test_header_nread_value(); |
| 3580 | |
| 3581 | //// OVERFLOW CONDITIONS |
| 3582 | |
| 3583 | test_header_overflow_error(HTTP_REQUEST); |
| 3584 | test_no_overflow_long_body(HTTP_REQUEST, 1000); |
| 3585 | test_no_overflow_long_body(HTTP_REQUEST, 100000); |
| 3586 | |
| 3587 | test_header_overflow_error(HTTP_RESPONSE); |
| 3588 | test_no_overflow_long_body(HTTP_RESPONSE, 1000); |
| 3589 | test_no_overflow_long_body(HTTP_RESPONSE, 100000); |
| 3590 | |
| 3591 | test_header_content_length_overflow_error(); |
| 3592 | test_chunk_content_length_overflow_error(); |
| 3593 | |
| 3594 | //// RESPONSES |
| 3595 | |
| 3596 | for (i = 0; i < response_count; i++) { |
| 3597 | test_message(&responses[i]); |
| 3598 | } |
| 3599 | |
| 3600 | for (i = 0; i < response_count; i++) { |
| 3601 | test_message_pause(&responses[i]); |
| 3602 | } |
| 3603 | |
| 3604 | for (i = 0; i < response_count; i++) { |
| 3605 | if (!responses[i].should_keep_alive) continue; |
| 3606 | for (j = 0; j < response_count; j++) { |
| 3607 | if (!responses[j].should_keep_alive) continue; |
nothing calls this directly
no test coverage detected