diff --git a/lib/sendf.c b/lib/sendf.c index 6bd4b1bfba..43b30ecc7f 100644 --- a/lib/sendf.c +++ b/lib/sendf.c @@ -293,9 +293,9 @@ static CURLcode cw_download_write(struct Curl_easy *data, } if((type & CLIENTWRITE_EOS) && !data->req.no_body && - (data->req.maxdownload > data->req.bytecount)) { + (data->req.size > data->req.bytecount)) { failf(data, "end of response with %" FMT_OFF_T " bytes missing", - data->req.maxdownload - data->req.bytecount); + data->req.size - data->req.bytecount); return CURLE_PARTIAL_FILE; } } diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 1c0258e17c..184a54e92e 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -256,8 +256,8 @@ test2100 test2101 test2102 test2103 test2104 \ \ test2200 test2201 test2202 test2203 test2204 test2205 \ \ -test2300 test2301 test2302 test2303 test2304 test2306 \ -test2308 test2309 \ +test2300 test2301 test2302 test2303 test2304 test2306 test2307 test2308 \ +test2309 \ \ test2400 test2401 test2402 test2403 test2404 test2405 test2406 \ \ diff --git a/tests/data/test2307 b/tests/data/test2307 new file mode 100644 index 0000000000..cbb581a4ab --- /dev/null +++ b/tests/data/test2307 @@ -0,0 +1,60 @@ + + + +FTP +EPSV +RETR +Range + + +# Server-side + + +0123456789abcdef +0123456789abcdef +0123456789abcdef +0123456789abcdef + + +0123456789abcdef +0123456789abcdef +0123456789abcdef +012345678 + + +64 + + + +# Client-side + + +ftp + + +FTP retrieve a byte-range with end larger than file + + +-r 4-1000 ftp://%HOSTIP:%FTPPORT/%TESTNUMBER + + + +# Verify data after the test has been "shot" + + +QUIT + + +USER anonymous +PASS ftp@example.com +PWD +EPSV +TYPE I +SIZE %TESTNUMBER +REST 4 +RETR %TESTNUMBER +ABOR +QUIT + + +