From d1f40078c13e85c56332dcb7f908fe2a7b65eb22 Mon Sep 17 00:00:00 2001 From: oxalica Date: Fri, 12 Mar 2021 21:11:08 +0800 Subject: [PATCH] http2: fail if connection terminated without END_STREAM Closes #6736 --- lib/http2.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/http2.c b/lib/http2.c index c6507e6f63..01322cb013 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -1729,6 +1729,17 @@ static ssize_t http2_recv(struct Curl_easy *data, int sockindex, } if(nread == 0) { + if(!stream->closed) { + /* This will happen when the server or proxy server is SIGKILLed + during data transfer. We should emit an error since our data + received may be incomplete. */ + failf(data, "HTTP/2 stream %d was not closed cleanly before" + " end of the underlying stream", + stream->stream_id); + *err = CURLE_HTTP2_STREAM; + return -1; + } + H2BUGF(infof(data, "end of stream\n")); *err = CURLE_OK; return 0;