From cb0ebb38c6bc31a3e5eca7a6db65fac0816cbce9 Mon Sep 17 00:00:00 2001 From: Gil Pedersen Date: Tue, 15 Sep 2020 12:36:34 +0000 Subject: [PATCH] Check content-length before calling stream_close_callback with error code 0 --- lib/nghttp2_session.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 2e7e907f..d28810ed 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -1196,6 +1196,11 @@ int nghttp2_session_close_stream(nghttp2_session *session, int32_t stream_id, } } + if (error_code == NGHTTP2_NO_ERROR && + nghttp2_http_on_remote_end_stream(stream) == -1) { + error_code = NGHTTP2_PROTOCOL_ERROR; + } + /* We call on_stream_close_callback even if stream->state is NGHTTP2_STREAM_INITIAL. This will happen while sending request HEADERS, a local endpoint receives RST_STREAM for that stream. It