]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
http2: fail if connection terminated without END_STREAM
authoroxalica <oxalicc@pm.me>
Fri, 12 Mar 2021 13:11:08 +0000 (21:11 +0800)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 12 Mar 2021 16:54:39 +0000 (17:54 +0100)
Closes #6736

lib/http2.c

index c6507e6f63531d5f8075775ce5418f60bf75ccd8..01322cb01321bfd6e85fee629b27a24c3db7ffd7 100644 (file)
@@ -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;