summaryrefslogtreecommitdiff
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-26 08:48:25 +0200
commit5d8963fc4099c5fb135d74dc75e6c149ceee80a6 (patch)
tree78ce7d6b26845b66c7873a5f31eae29e9f6edeba
parentd23cc224e6d25eec99a988f4db18c040bde3e97b (diff)
downloadcurl-5d8963fc4099c5fb135d74dc75e6c149ceee80a6.tar.gz
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.
-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);