Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
40a666e7
Commit
40a666e7
authored
Nov 28, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add nghttp2_submit_response2 tests
parent
d1049f38
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
0 deletions
+73
-0
tests/main.c
tests/main.c
+4
-0
tests/nghttp2_session_test.c
tests/nghttp2_session_test.c
+67
-0
tests/nghttp2_session_test.h
tests/nghttp2_session_test.h
+2
-0
No files found.
tests/main.c
View file @
40a666e7
...
@@ -139,6 +139,10 @@ int main(int argc, char* argv[])
...
@@ -139,6 +139,10 @@ int main(int argc, char* argv[])
test_nghttp2_submit_request2_with_data
)
||
test_nghttp2_submit_request2_with_data
)
||
!
CU_add_test
(
pSuite
,
"submit_request2_without_data"
,
!
CU_add_test
(
pSuite
,
"submit_request2_without_data"
,
test_nghttp2_submit_request2_without_data
)
||
test_nghttp2_submit_request2_without_data
)
||
!
CU_add_test
(
pSuite
,
"submit_response2_with_data"
,
test_nghttp2_submit_response2_with_data
)
||
!
CU_add_test
(
pSuite
,
"submit_response2_without_data"
,
test_nghttp2_submit_response2_without_data
)
||
!
CU_add_test
(
pSuite
,
"submit_headers_start_stream"
,
!
CU_add_test
(
pSuite
,
"submit_headers_start_stream"
,
test_nghttp2_submit_headers_start_stream
)
||
test_nghttp2_submit_headers_start_stream
)
||
!
CU_add_test
(
pSuite
,
"submit_headers_reply"
,
!
CU_add_test
(
pSuite
,
"submit_headers_reply"
,
...
...
tests/nghttp2_session_test.c
View file @
40a666e7
...
@@ -2073,6 +2073,73 @@ void test_nghttp2_submit_request2_without_data(void)
...
@@ -2073,6 +2073,73 @@ void test_nghttp2_submit_request2_without_data(void)
nghttp2_session_del
(
session
);
nghttp2_session_del
(
session
);
}
}
void
test_nghttp2_submit_response2_with_data
(
void
)
{
nghttp2_session
*
session
;
nghttp2_session_callbacks
callbacks
;
nghttp2_nv
nva
[]
=
{
MAKE_NV
(
":version"
,
"HTTP/1.1"
)};
nghttp2_data_provider
data_prd
;
my_user_data
ud
;
nghttp2_outbound_item
*
item
;
memset
(
&
callbacks
,
0
,
sizeof
(
nghttp2_session_callbacks
));
callbacks
.
send_callback
=
null_send_callback
;
data_prd
.
read_callback
=
fixed_length_data_source_read_callback
;
ud
.
data_source_length
=
64
*
1024
-
1
;
CU_ASSERT
(
0
==
nghttp2_session_server_new
(
&
session
,
&
callbacks
,
&
ud
));
nghttp2_session_open_stream
(
session
,
1
,
NGHTTP2_FLAG_END_STREAM
,
NGHTTP2_PRI_DEFAULT
,
NGHTTP2_STREAM_OPENING
,
NULL
);
CU_ASSERT
(
0
==
nghttp2_submit_response2
(
session
,
1
,
nva
,
ARRLEN
(
nva
),
&
data_prd
));
item
=
nghttp2_session_get_next_ob_item
(
session
);
CU_ASSERT
(
nvnameeq
(
":version"
,
&
OB_CTRL
(
item
)
->
headers
.
nva
[
0
]));
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
0
==
ud
.
data_source_length
);
nghttp2_session_del
(
session
);
}
void
test_nghttp2_submit_response2_without_data
(
void
)
{
nghttp2_session
*
session
;
nghttp2_session_callbacks
callbacks
;
accumulator
acc
;
nghttp2_nv
nva
[]
=
{
MAKE_NV
(
":version"
,
"HTTP/1.1"
)};
nghttp2_data_provider
data_prd
=
{{
-
1
},
NULL
};
nghttp2_outbound_item
*
item
;
my_user_data
ud
;
nghttp2_frame
frame
;
nghttp2_hd_context
inflater
;
acc
.
length
=
0
;
ud
.
acc
=
&
acc
;
memset
(
&
callbacks
,
0
,
sizeof
(
nghttp2_session_callbacks
));
callbacks
.
send_callback
=
accumulator_send_callback
;
CU_ASSERT
(
0
==
nghttp2_session_server_new
(
&
session
,
&
callbacks
,
&
ud
));
nghttp2_hd_inflate_init
(
&
inflater
,
NGHTTP2_HD_SIDE_RESPONSE
);
nghttp2_session_open_stream
(
session
,
1
,
NGHTTP2_FLAG_END_STREAM
,
NGHTTP2_PRI_DEFAULT
,
NGHTTP2_STREAM_OPENING
,
NULL
);
CU_ASSERT
(
0
==
nghttp2_submit_response2
(
session
,
1
,
nva
,
ARRLEN
(
nva
),
&
data_prd
));
item
=
nghttp2_session_get_next_ob_item
(
session
);
CU_ASSERT
(
nvnameeq
(
":version"
,
&
OB_CTRL
(
item
)
->
headers
.
nva
[
0
]));
CU_ASSERT
(
OB_CTRL
(
item
)
->
hd
.
flags
&
NGHTTP2_FLAG_END_STREAM
);
CU_ASSERT
(
0
==
nghttp2_session_send
(
session
));
CU_ASSERT
(
0
==
unpack_frame_with_nv_block
(
&
frame
,
NGHTTP2_HEADERS
,
&
inflater
,
acc
.
buf
,
acc
.
length
));
CU_ASSERT
(
nvnameeq
(
":version"
,
&
frame
.
headers
.
nva
[
0
]));
nghttp2_frame_headers_free
(
&
frame
.
headers
);
nghttp2_hd_end_headers
(
&
inflater
);
nghttp2_hd_inflate_free
(
&
inflater
);
nghttp2_session_del
(
session
);
}
void
test_nghttp2_submit_headers_start_stream
(
void
)
void
test_nghttp2_submit_headers_start_stream
(
void
)
{
{
nghttp2_session
*
session
;
nghttp2_session
*
session
;
...
...
tests/nghttp2_session_test.h
View file @
40a666e7
...
@@ -59,6 +59,8 @@ void test_nghttp2_submit_request_with_data(void);
...
@@ -59,6 +59,8 @@ void test_nghttp2_submit_request_with_data(void);
void
test_nghttp2_submit_request_without_data
(
void
);
void
test_nghttp2_submit_request_without_data
(
void
);
void
test_nghttp2_submit_request2_with_data
(
void
);
void
test_nghttp2_submit_request2_with_data
(
void
);
void
test_nghttp2_submit_request2_without_data
(
void
);
void
test_nghttp2_submit_request2_without_data
(
void
);
void
test_nghttp2_submit_response2_with_data
(
void
);
void
test_nghttp2_submit_response2_without_data
(
void
);
void
test_nghttp2_submit_headers_start_stream
(
void
);
void
test_nghttp2_submit_headers_start_stream
(
void
);
void
test_nghttp2_submit_headers_reply
(
void
);
void
test_nghttp2_submit_headers_reply
(
void
);
void
test_nghttp2_submit_headers_push_reply
(
void
);
void
test_nghttp2_submit_headers_push_reply
(
void
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment