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
68c5deea
Commit
68c5deea
authored
Dec 11, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify the condition when opening new stream from remote is allowed
parent
ab93db22
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
12 deletions
+22
-12
lib/nghttp2_session.c
lib/nghttp2_session.c
+22
-12
No files found.
lib/nghttp2_session.c
View file @
68c5deea
...
@@ -1320,6 +1320,15 @@ int nghttp2_session_close_stream_if_shut_rdwr(nghttp2_session *session,
...
@@ -1320,6 +1320,15 @@ int nghttp2_session_close_stream_if_shut_rdwr(nghttp2_session *session,
return
0
;
return
0
;
}
}
/*
* Returns nonzero if local endpoint allows reception of new stream
* from remote.
*/
static
int
session_allow_incoming_new_stream
(
nghttp2_session
*
session
)
{
return
(
session
->
goaway_flags
&
(
NGHTTP2_GOAWAY_TERM_ON_SEND
|
NGHTTP2_GOAWAY_SENT
))
==
0
;
}
/*
/*
* This function returns nonzero if session is closing.
* This function returns nonzero if session is closing.
*/
*/
...
@@ -3438,17 +3447,17 @@ int nghttp2_session_on_request_headers_received(nghttp2_session *session,
...
@@ -3438,17 +3447,17 @@ int nghttp2_session_on_request_headers_received(nghttp2_session *session,
}
}
session
->
last_recv_stream_id
=
frame
->
hd
.
stream_id
;
session
->
last_recv_stream_id
=
frame
->
hd
.
stream_id
;
if
(
session
->
goaway_flags
&
NGHTTP2_GOAWAY_SENT
)
{
/* We just ignore stream after GOAWAY was queued */
return
NGHTTP2_ERR_IGN_HEADER_BLOCK
;
}
if
(
session_is_incoming_concurrent_streams_max
(
session
))
{
if
(
session_is_incoming_concurrent_streams_max
(
session
))
{
return
session_inflate_handle_invalid_connection
(
return
session_inflate_handle_invalid_connection
(
session
,
frame
,
NGHTTP2_ERR_PROTO
,
session
,
frame
,
NGHTTP2_ERR_PROTO
,
"request HEADERS: max concurrent streams exceeded"
);
"request HEADERS: max concurrent streams exceeded"
);
}
}
if
(
!
session_allow_incoming_new_stream
(
session
))
{
/* We just ignore stream after GOAWAY was sent */
return
NGHTTP2_ERR_IGN_HEADER_BLOCK
;
}
if
(
frame
->
headers
.
pri_spec
.
stream_id
==
frame
->
hd
.
stream_id
)
{
if
(
frame
->
headers
.
pri_spec
.
stream_id
==
frame
->
hd
.
stream_id
)
{
return
session_inflate_handle_invalid_connection
(
return
session_inflate_handle_invalid_connection
(
session
,
frame
,
NGHTTP2_ERR_PROTO
,
"request HEADERS: depend on itself"
);
session
,
frame
,
NGHTTP2_ERR_PROTO
,
"request HEADERS: depend on itself"
);
...
@@ -3513,16 +3522,18 @@ int nghttp2_session_on_push_response_headers_received(nghttp2_session *session,
...
@@ -3513,16 +3522,18 @@ int nghttp2_session_on_push_response_headers_received(nghttp2_session *session,
session
,
frame
,
NGHTTP2_ERR_PROTO
,
session
,
frame
,
NGHTTP2_ERR_PROTO
,
"push response HEADERS: stream_id == 0"
);
"push response HEADERS: stream_id == 0"
);
}
}
if
(
session
->
goaway_flags
)
{
/* We don't accept new stream after GOAWAY is sent or received. */
return
NGHTTP2_ERR_IGN_HEADER_BLOCK
;
}
if
(
session_is_incoming_concurrent_streams_max
(
session
))
{
if
(
session_is_incoming_concurrent_streams_max
(
session
))
{
return
session_inflate_handle_invalid_connection
(
return
session_inflate_handle_invalid_connection
(
session
,
frame
,
NGHTTP2_ERR_PROTO
,
session
,
frame
,
NGHTTP2_ERR_PROTO
,
"push response HEADERS: max concurrent streams exceeded"
);
"push response HEADERS: max concurrent streams exceeded"
);
}
}
if
(
!
session_allow_incoming_new_stream
(
session
))
{
/* We don't accept new stream after GOAWAY was sent. */
return
NGHTTP2_ERR_IGN_HEADER_BLOCK
;
}
if
(
session_is_incoming_concurrent_streams_pending_max
(
session
))
{
if
(
session_is_incoming_concurrent_streams_pending_max
(
session
))
{
return
session_inflate_handle_invalid_stream
(
session
,
frame
,
return
session_inflate_handle_invalid_stream
(
session
,
frame
,
NGHTTP2_ERR_REFUSED_STREAM
);
NGHTTP2_ERR_REFUSED_STREAM
);
...
@@ -4127,9 +4138,8 @@ int nghttp2_session_on_push_promise_received(nghttp2_session *session,
...
@@ -4127,9 +4138,8 @@ int nghttp2_session_on_push_promise_received(nghttp2_session *session,
session
,
frame
,
NGHTTP2_ERR_PROTO
,
"PUSH_PROMISE: invalid stream_id"
);
session
,
frame
,
NGHTTP2_ERR_PROTO
,
"PUSH_PROMISE: invalid stream_id"
);
}
}
if
(
session
->
goaway_flags
)
{
if
(
!
session_allow_incoming_new_stream
(
session
))
{
/* We just dicard PUSH_PROMISE after GOAWAY is sent or
/* We just discard PUSH_PROMISE after GOAWAY was sent */
received. */
return
NGHTTP2_ERR_IGN_HEADER_BLOCK
;
return
NGHTTP2_ERR_IGN_HEADER_BLOCK
;
}
}
...
...
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