]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
transfer: close connection after excess data has been read
authorMichael Kaufmann <mail@michael-kaufmann.ch>
Thu, 21 May 2020 11:10:04 +0000 (13:10 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 27 May 2020 06:16:35 +0000 (08:16 +0200)
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

lib/transfer.c

index cc13bae181f015a70db006861ed5645afa4e51da..dc43cf6ce14ee765d0eb1f93dd309b96c130114d 100644 (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);