mirror of
https://github.com/nghttp2/nghttp2.git
synced 2025-12-07 02:28:53 +08:00
Test that FLAG_FIN is set if the read callback is NULL.
This commit is contained in:
@@ -87,6 +87,8 @@ int main(int argc, char* argv[])
|
||||
!CU_add_test(pSuite, "submit_response", test_spdylay_submit_response) ||
|
||||
!CU_add_test(pSuite, "submit_request_with_data",
|
||||
test_spdylay_submit_request_with_data) ||
|
||||
!CU_add_test(pSuite, "submit_request_without_data",
|
||||
test_spdylay_submit_request_with_null_data_read_callback) ||
|
||||
!CU_add_test(pSuite, "session_reply_fail",
|
||||
test_spdylay_session_reply_fail) ||
|
||||
!CU_add_test(pSuite, "session_on_headers_received",
|
||||
|
||||
@@ -590,6 +590,28 @@ void test_spdylay_submit_request_with_data()
|
||||
spdylay_session_del(session);
|
||||
}
|
||||
|
||||
void test_spdylay_submit_request_with_null_data_read_callback()
|
||||
{
|
||||
spdylay_session *session;
|
||||
spdylay_session_callbacks callbacks = {
|
||||
null_send_callback,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
const char *nv[] = { "Version", "HTTP/1.1", NULL };
|
||||
spdylay_data_provider data_prd = {{-1}, NULL};
|
||||
spdylay_outbound_item *item;
|
||||
|
||||
CU_ASSERT(0 == spdylay_session_client_new(&session, &callbacks, NULL));
|
||||
CU_ASSERT(0 == spdylay_submit_request(session, 3, nv, &data_prd, NULL));
|
||||
item = spdylay_session_get_next_ob_item(session);
|
||||
CU_ASSERT(0 == strcmp("version", item->frame->syn_stream.nv[0]));
|
||||
CU_ASSERT(item->frame->syn_stream.hd.flags & SPDYLAY_FLAG_FIN);
|
||||
|
||||
spdylay_session_del(session);
|
||||
}
|
||||
|
||||
void test_spdylay_session_reply_fail()
|
||||
{
|
||||
spdylay_session *session;
|
||||
|
||||
@@ -35,6 +35,7 @@ void test_spdylay_session_send_syn_stream();
|
||||
void test_spdylay_session_send_syn_reply();
|
||||
void test_spdylay_submit_response();
|
||||
void test_spdylay_submit_request_with_data();
|
||||
void test_spdylay_submit_request_with_null_data_read_callback();
|
||||
void test_spdylay_session_reply_fail();
|
||||
void test_spdylay_session_on_headers_received();
|
||||
void test_spdylay_session_on_ping_received();
|
||||
|
||||
Reference in New Issue
Block a user