1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-12 04:25:08 -05:00

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
This commit is contained in:
Michael Kaufmann 2020-05-21 13:10:04 +02:00 committed by Daniel Stenberg
parent 18e63b1679
commit 3d44bfb08d
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -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);