add tests for should_keep_alive()

event_stream
Ryan Dahl 15 years ago
parent 5b00b6a64f
commit 4226a8f63b

@ -631,6 +631,7 @@ headers_complete_cb (http_parser *parser)
messages[num_messages].http_major = parser->http_major;
messages[num_messages].http_minor = parser->http_minor;
messages[num_messages].headers_complete_cb_called = TRUE;
messages[num_messages].should_keep_alive = http_should_keep_alive(parser);
return 0;
}
@ -638,6 +639,14 @@ int
message_complete_cb (http_parser *parser)
{
assert(parser);
if (messages[num_messages].should_keep_alive != http_should_keep_alive(parser))
{
fprintf(stderr, "\n\n *** Error http_should_keep_alive() should have same "
"value in both on_message_complete and on_headers_complete "
"but it doesn't! ***\n\n");
assert(0);
exit(1);
}
messages[num_messages].message_complete_cb_called = TRUE;
num_messages++;
return 0;
@ -714,6 +723,8 @@ message_eq (int index, const struct message *expected)
MESSAGE_CHECK_NUM_EQ(expected, m, status_code);
}
MESSAGE_CHECK_NUM_EQ(expected, m, should_keep_alive);
assert(m->message_begin_cb_called);
assert(m->headers_complete_cb_called);
assert(m->message_complete_cb_called);

Loading…
Cancel
Save