aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kaufmann <mail@michael-kaufmann.ch>2020-05-21 13:10:04 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-05-27 08:16:35 +0200
commit3d44bfb08d4b230d2ad8b111469a8ae4c6957bca (patch)
tree1e42f4a2a6f1a47f0a530458a11d9a82b3436d8f
parent18e63b1679248c9a884201871379bfd0b13fc3f3 (diff)
transfer: close connection after excess data has been read
For HTTP 1.x, it's a protocol error when the server sends more bytes than announced. If this happens, don't reuse the connection, because the start position of the next response is undefined. Closes #5440
-rw-r--r--lib/transfer.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index cc13bae18..dc43cf6ce 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -838,6 +838,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
", maxdownload = %" CURL_FORMAT_CURL_OFF_T
", bytecount = %" CURL_FORMAT_CURL_OFF_T "\n",
excess, k->size, k->maxdownload, k->bytecount);
+ connclose(conn, "excess found in a read");
}
nread = (ssize_t) (k->maxdownload - k->bytecount);