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
ab93db22
Commit
ab93db22
authored
Dec 11, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test when client sends push response to server
parent
f14ac743
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
0 deletions
+56
-0
tests/main.c
tests/main.c
+2
-0
tests/nghttp2_session_test.c
tests/nghttp2_session_test.c
+53
-0
tests/nghttp2_session_test.h
tests/nghttp2_session_test.h
+1
-0
No files found.
tests/main.c
View file @
ab93db22
...
@@ -89,6 +89,8 @@ int main(int argc _U_, char *argv[] _U_) {
...
@@ -89,6 +89,8 @@ int main(int argc _U_, char *argv[] _U_) {
test_nghttp2_session_recv_headers_with_priority
)
||
test_nghttp2_session_recv_headers_with_priority
)
||
!
CU_add_test
(
pSuite
,
"session_recv_headers_early_response"
,
!
CU_add_test
(
pSuite
,
"session_recv_headers_early_response"
,
test_nghttp2_session_recv_headers_early_response
)
||
test_nghttp2_session_recv_headers_early_response
)
||
!
CU_add_test
(
pSuite
,
"session_server_recv_push_response"
,
test_nghttp2_session_server_recv_push_response
)
||
!
CU_add_test
(
pSuite
,
"session_recv_premature_headers"
,
!
CU_add_test
(
pSuite
,
"session_recv_premature_headers"
,
test_nghttp2_session_recv_premature_headers
)
||
test_nghttp2_session_recv_premature_headers
)
||
!
CU_add_test
(
pSuite
,
"session_recv_unknown_frame"
,
!
CU_add_test
(
pSuite
,
"session_recv_unknown_frame"
,
...
...
tests/nghttp2_session_test.c
View file @
ab93db22
...
@@ -1435,6 +1435,59 @@ void test_nghttp2_session_recv_headers_early_response(void) {
...
@@ -1435,6 +1435,59 @@ void test_nghttp2_session_recv_headers_early_response(void) {
nghttp2_bufs_free
(
&
bufs
);
nghttp2_bufs_free
(
&
bufs
);
}
}
void
test_nghttp2_session_server_recv_push_response
(
void
)
{
nghttp2_session
*
session
;
nghttp2_session_callbacks
callbacks
;
nghttp2_bufs
bufs
;
nghttp2_buf
*
buf
;
ssize_t
rv
;
my_user_data
ud
;
nghttp2_mem
*
mem
;
nghttp2_frame
frame
;
nghttp2_hd_deflater
deflater
;
nghttp2_nv
*
nva
;
size_t
nvlen
;
mem
=
nghttp2_mem_default
();
frame_pack_bufs_init
(
&
bufs
);
memset
(
&
callbacks
,
0
,
sizeof
(
nghttp2_session_callbacks
));
callbacks
.
on_invalid_frame_recv_callback
=
on_invalid_frame_recv_callback
;
nghttp2_session_server_new
(
&
session
,
&
callbacks
,
&
ud
);
nghttp2_hd_deflate_init
(
&
deflater
,
mem
);
nghttp2_session_open_stream
(
session
,
2
,
NGHTTP2_STREAM_FLAG_NONE
,
&
pri_spec_default
,
NGHTTP2_STREAM_RESERVED
,
NULL
);
nvlen
=
ARRLEN
(
resnv
);
nghttp2_nv_array_copy
(
&
nva
,
resnv
,
nvlen
,
mem
);
nghttp2_frame_headers_init
(
&
frame
.
headers
,
NGHTTP2_FLAG_END_HEADERS
,
2
,
NGHTTP2_HCAT_HEADERS
,
&
pri_spec_default
,
nva
,
nvlen
);
rv
=
nghttp2_frame_pack_headers
(
&
bufs
,
&
frame
.
headers
,
&
deflater
);
CU_ASSERT
(
0
==
rv
);
CU_ASSERT
(
nghttp2_bufs_len
(
&
bufs
)
>
0
);
nghttp2_frame_headers_free
(
&
frame
.
headers
,
mem
);
buf
=
&
bufs
.
head
->
buf
;
ud
.
invalid_frame_recv_cb_called
=
0
;
rv
=
nghttp2_session_mem_recv
(
session
,
buf
->
pos
,
nghttp2_buf_len
(
buf
));
CU_ASSERT
((
ssize_t
)
nghttp2_buf_len
(
buf
)
==
rv
);
CU_ASSERT
(
1
==
ud
.
invalid_frame_recv_cb_called
);
nghttp2_bufs_free
(
&
bufs
);
nghttp2_hd_deflate_free
(
&
deflater
);
nghttp2_session_del
(
session
);
}
void
test_nghttp2_session_recv_premature_headers
(
void
)
{
void
test_nghttp2_session_recv_premature_headers
(
void
)
{
nghttp2_session
*
session
;
nghttp2_session
*
session
;
nghttp2_session_callbacks
callbacks
;
nghttp2_session_callbacks
callbacks
;
...
...
tests/nghttp2_session_test.h
View file @
ab93db22
...
@@ -34,6 +34,7 @@ void test_nghttp2_session_recv_data_no_auto_flow_control(void);
...
@@ -34,6 +34,7 @@ void test_nghttp2_session_recv_data_no_auto_flow_control(void);
void
test_nghttp2_session_recv_continuation
(
void
);
void
test_nghttp2_session_recv_continuation
(
void
);
void
test_nghttp2_session_recv_headers_with_priority
(
void
);
void
test_nghttp2_session_recv_headers_with_priority
(
void
);
void
test_nghttp2_session_recv_headers_early_response
(
void
);
void
test_nghttp2_session_recv_headers_early_response
(
void
);
void
test_nghttp2_session_server_recv_push_response
(
void
);
void
test_nghttp2_session_recv_premature_headers
(
void
);
void
test_nghttp2_session_recv_premature_headers
(
void
);
void
test_nghttp2_session_recv_unknown_frame
(
void
);
void
test_nghttp2_session_recv_unknown_frame
(
void
);
void
test_nghttp2_session_recv_unexpected_continuation
(
void
);
void
test_nghttp2_session_recv_unexpected_continuation
(
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