mirror of
https://github.com/curl/curl.git
synced 2026-04-15 00:21:42 +03:00
sendf: getting less data than "max allowed" is okay
Easily triggered when doing an FTP ranged download with the end range
larger than the file size.
A regression since 30de937bda (shipped in curl 8.9.0)
Add test 2307 to verify.
Reported-by: kupavcevdenis on github
Fixes #18283
Closes #18295
This commit is contained in:
parent
b2294996b6
commit
c5f76b8096
3 changed files with 64 additions and 4 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 \
|
||||
\
|
||||
|
|
|
|||
60
tests/data/test2307
Normal file
60
tests/data/test2307
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
FTP
|
||||
EPSV
|
||||
RETR
|
||||
Range
|
||||
</keywords>
|
||||
</info>
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
0123456789abcdef
|
||||
0123456789abcdef
|
||||
0123456789abcdef
|
||||
0123456789abcdef
|
||||
</data>
|
||||
<datacheck nonewline="yes">
|
||||
0123456789abcdef
|
||||
0123456789abcdef
|
||||
0123456789abcdef
|
||||
012345678
|
||||
</datacheck>
|
||||
<size>
|
||||
64
|
||||
</size>
|
||||
</reply>
|
||||
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
ftp
|
||||
</server>
|
||||
<name>
|
||||
FTP retrieve a byte-range with end larger than file
|
||||
</name>
|
||||
<command>
|
||||
-r 4-1000 ftp://%HOSTIP:%FTPPORT/%TESTNUMBER
|
||||
</command>
|
||||
</client>
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<strip>
|
||||
QUIT
|
||||
</strip>
|
||||
<protocol crlf="yes">
|
||||
USER anonymous
|
||||
PASS ftp@example.com
|
||||
PWD
|
||||
EPSV
|
||||
TYPE I
|
||||
SIZE %TESTNUMBER
|
||||
REST 4
|
||||
RETR %TESTNUMBER
|
||||
ABOR
|
||||
QUIT
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
||||
Loading…
Add table
Add a link
Reference in a new issue