From 9f0083309e469fa4802ff226af0b24ae02ff2407 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 20 Dec 2015 13:19:29 +0900 Subject: [PATCH] Fix strange use of session_detect_idle_stream --- lib/nghttp2_session.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 0e32fc18..97cc2553 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -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");