summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroxalica <oxalicc@pm.me>2021-03-12 21:11:08 +0800
committerDaniel Stenberg <daniel@haxx.se>2021-03-12 17:54:39 +0100
commitd1f40078c13e85c56332dcb7f908fe2a7b65eb22 (patch)
tree804e595ad76821e5b07b1c1fe55048781a634e51
parentf8a5e9660e7d8ddbb722e2ef70db02876eceb00d (diff)
downloadcurl-d1f40078c13e85c56332dcb7f908fe2a7b65eb22.tar.gz
http2: fail if connection terminated without END_STREAM
Closes #6736
-rw-r--r--lib/http2.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/http2.c b/lib/http2.c
index c6507e6f6..01322cb01 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;