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
35229b25
Commit
35229b25
authored
Aug 20, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Treat reception of DATA in reserved stream as connection error
parent
5ae86058
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
lib/nghttp2_session.c
lib/nghttp2_session.c
+6
-1
tests/nghttp2_session_test.c
tests/nghttp2_session_test.c
+11
-0
No files found.
lib/nghttp2_session.c
View file @
35229b25
...
@@ -2571,6 +2571,9 @@ int nghttp2_session_on_data_received(nghttp2_session *session,
...
@@ -2571,6 +2571,9 @@ int nghttp2_session_on_data_received(nghttp2_session *session,
}
else
if
(
stream
->
state
!=
NGHTTP2_STREAM_CLOSING
)
{
}
else
if
(
stream
->
state
!=
NGHTTP2_STREAM_CLOSING
)
{
error_code
=
NGHTTP2_PROTOCOL_ERROR
;
error_code
=
NGHTTP2_PROTOCOL_ERROR
;
}
}
}
else
if
(
stream
->
state
==
NGHTTP2_STREAM_RESERVED
)
{
/* reserved (remote) and receiving DATA is connection error */
return
nghttp2_session_fail_session
(
session
,
NGHTTP2_PROTOCOL_ERROR
);
}
else
if
(
stream
->
state
!=
NGHTTP2_STREAM_CLOSING
)
{
}
else
if
(
stream
->
state
!=
NGHTTP2_STREAM_CLOSING
)
{
/* It is OK if this is remote peer initiated stream and we did
/* It is OK if this is remote peer initiated stream and we did
not receive END_STREAM unless stream is in
not receive END_STREAM unless stream is in
...
@@ -2740,10 +2743,12 @@ static int nghttp2_session_check_data_recv_allowed(nghttp2_session *session,
...
@@ -2740,10 +2743,12 @@ static int nghttp2_session_check_data_recv_allowed(nghttp2_session *session,
if
(
stream
->
state
==
NGHTTP2_STREAM_OPENED
)
{
if
(
stream
->
state
==
NGHTTP2_STREAM_OPENED
)
{
return
1
;
return
1
;
}
}
}
else
if
(
stream
->
state
!=
NGHTTP2_STREAM_CLOSING
)
{
}
else
if
(
stream
->
state
!=
NGHTTP2_STREAM_CLOSING
&&
stream
->
state
!=
NGHTTP2_STREAM_RESERVED
)
{
/* It is OK if this is remote peer initiated stream and we did
/* It is OK if this is remote peer initiated stream and we did
not receive END_STREAM unless stream is in
not receive END_STREAM unless stream is in
NGHTTP2_STREAM_CLOSING state. This is a race condition. */
NGHTTP2_STREAM_CLOSING state. This is a race condition. */
/* But DATA must not be received in reserved state */
return
1
;
return
1
;
}
}
}
}
...
...
tests/nghttp2_session_test.c
View file @
35229b25
...
@@ -1233,6 +1233,17 @@ void test_nghttp2_session_on_data_received(void)
...
@@ -1233,6 +1233,17 @@ void test_nghttp2_session_on_data_received(void)
/* CU_ASSERT(NGHTTP2_RST_STREAM == OB_CTRL_TYPE(top)); */
/* CU_ASSERT(NGHTTP2_RST_STREAM == OB_CTRL_TYPE(top)); */
/* CU_ASSERT(NGHTTP2_PROTOCOL_ERROR == OB_CTRL(top)->rst_stream.error_code); */
/* CU_ASSERT(NGHTTP2_PROTOCOL_ERROR == OB_CTRL(top)->rst_stream.error_code); */
/* Receiving DATA against the reserved stream is subject to
connection error */
stream
=
nghttp2_session_open_stream
(
session
,
6
,
NGHTTP2_FLAG_NONE
,
NGHTTP2_PRI_DEFAULT
,
NGHTTP2_STREAM_RESERVED
,
NULL
);
CU_ASSERT
(
0
==
nghttp2_session_on_data_received
(
session
,
4096
,
NGHTTP2_FLAG_NONE
,
6
));
top
=
nghttp2_session_get_ob_pq_top
(
session
);
CU_ASSERT
(
NGHTTP2_GOAWAY
==
OB_CTRL_TYPE
(
top
));
CU_ASSERT
(
NGHTTP2_PROTOCOL_ERROR
==
OB_CTRL
(
top
)
->
goaway
.
error_code
);
nghttp2_session_del
(
session
);
nghttp2_session_del
(
session
);
}
}
...
...
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