Fix strange use of session_detect_idle_stream

This commit is contained in:
Tatsuhiro Tsujikawa 2015-12-20 13:19:29 +09:00
parent dd93b29397
commit 9f0083309e
1 changed files with 4 additions and 1 deletions

View File

@ -3429,6 +3429,8 @@ int nghttp2_session_on_request_headers_received(nghttp2_session *session,
return NGHTTP2_ERR_IGN_HEADER_BLOCK;
}
assert(session->server);
if (!session_is_new_peer_stream_id(session, frame->hd.stream_id)) {
/* The spec says if an endpoint receives a HEADERS with invalid
stream ID, it MUST issue connection error with error code
@ -3437,7 +3439,8 @@ int nghttp2_session_on_request_headers_received(nghttp2_session *session,
Then connection error is too harsh. It means that we only use
connection error if stream ID refers idle stream. OTherwise we
just ignore HEADERS for now. */
if (session_detect_idle_stream(session, frame->hd.stream_id)) {
if (frame->hd.stream_id == 0 ||
nghttp2_session_is_my_stream_id(session, frame->hd.stream_id)) {
return session_inflate_handle_invalid_connection(
session, frame, NGHTTP2_ERR_PROTO,
"request HEADERS: invalid stream_id");