mirror of
https://github.com/moparisthebest/curl
synced 2025-03-03 10:51:49 -05:00
ftp: avoid SIZE when asking for a TYPE A file
... as we ignore it anyway because servers don't report the correct size and proftpd even blatantly returns a 550. Updates a set of tests accordingly. Reported-by: awesomenode on github Fixes #6564 Closes #6565
This commit is contained in:
parent
5f08a5acd5
commit
e32601e13a
20
lib/ftp.c
20
lib/ftp.c
@ -1747,13 +1747,19 @@ static CURLcode ftp_state_quote(struct Curl_easy *data,
|
|||||||
result = ftp_state_retr(data, ftpc->known_filesize);
|
result = ftp_state_retr(data, ftpc->known_filesize);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(data->set.ignorecl) {
|
if(data->set.ignorecl || data->set.prefer_ascii) {
|
||||||
/* This code is to support download of growing files. It prevents
|
/* 'ignorecl' is used to support download of growing files. It
|
||||||
the state machine from requesting the file size from the
|
prevents the state machine from requesting the file size from
|
||||||
server. With an unknown file size the download continues until
|
the server. With an unknown file size the download continues
|
||||||
the server terminates it, otherwise the client stops if the
|
until the server terminates it, otherwise the client stops if
|
||||||
received byte count exceeds the reported file size. Set option
|
the received byte count exceeds the reported file size. Set
|
||||||
CURLOPT_IGNORE_CONTENT_LENGTH to 1 to enable this behavior.*/
|
option CURLOPT_IGNORE_CONTENT_LENGTH to 1 to enable this
|
||||||
|
behavior.
|
||||||
|
|
||||||
|
In addition: asking for the size for 'TYPE A' transfers is not
|
||||||
|
constructive since servers don't report the converted size. So
|
||||||
|
skip it.
|
||||||
|
*/
|
||||||
result = Curl_pp_sendf(data, &ftpc->pp, "RETR %s", ftpc->file);
|
result = Curl_pp_sendf(data, &ftpc->pp, "RETR %s", ftpc->file);
|
||||||
if(!result)
|
if(!result)
|
||||||
state(data, FTP_RETR);
|
state(data, FTP_RETR);
|
||||||
|
@ -34,7 +34,7 @@ test90 test91 test92 test93 test94 test95 test96 test97 test98 test99 \
|
|||||||
test100 test101 test102 test103 test104 test105 test106 test107 test108 \
|
test100 test101 test102 test103 test104 test105 test106 test107 test108 \
|
||||||
test109 test110 test111 test112 test113 test114 test115 test116 test117 \
|
test109 test110 test111 test112 test113 test114 test115 test116 test117 \
|
||||||
test118 test119 test120 test121 test122 test123 test124 test125 test126 \
|
test118 test119 test120 test121 test122 test123 test124 test125 test126 \
|
||||||
test127 test128 test129 test130 test131 test132 test133 test134 test135 \
|
test127 test128 test130 test131 test132 test133 test134 test135 \
|
||||||
test136 test137 test138 test139 test140 test141 test142 test143 test144 \
|
test136 test137 test138 test139 test140 test141 test142 test143 test144 \
|
||||||
test145 test146 test147 test148 test149 test150 test151 test152 test153 \
|
test145 test146 test147 test148 test149 test150 test151 test152 test153 \
|
||||||
test154 test155 test156 test157 test158 test159 test160 test161 test162 \
|
test154 test155 test156 test157 test158 test159 test160 test161 test162 \
|
||||||
|
@ -19,7 +19,6 @@ works
|
|||||||
</data>
|
</data>
|
||||||
<servercmd>
|
<servercmd>
|
||||||
REPLY EPSV 500 no such command
|
REPLY EPSV 500 no such command
|
||||||
REPLY SIZE 500 no such command
|
|
||||||
</servercmd>
|
</servercmd>
|
||||||
</reply>
|
</reply>
|
||||||
|
|
||||||
@ -45,7 +44,6 @@ PWD
|
|||||||
EPSV
|
EPSV
|
||||||
PASV
|
PASV
|
||||||
TYPE A
|
TYPE A
|
||||||
SIZE 105
|
|
||||||
RETR 105
|
RETR 105
|
||||||
QUIT
|
QUIT
|
||||||
</protocol>
|
</protocol>
|
||||||
|
@ -44,7 +44,6 @@ CWD path with spaces
|
|||||||
CWD and things2
|
CWD and things2
|
||||||
EPSV
|
EPSV
|
||||||
TYPE A
|
TYPE A
|
||||||
SIZE 106
|
|
||||||
RETR 106
|
RETR 106
|
||||||
QUIT
|
QUIT
|
||||||
</protocol>
|
</protocol>
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
<testcase>
|
|
||||||
<info>
|
|
||||||
<keywords>
|
|
||||||
FTP
|
|
||||||
EPSV
|
|
||||||
TYPE A
|
|
||||||
RETR
|
|
||||||
type=
|
|
||||||
</keywords>
|
|
||||||
</info>
|
|
||||||
# Server-side
|
|
||||||
<reply>
|
|
||||||
<size>
|
|
||||||
37
|
|
||||||
</size>
|
|
||||||
<data>
|
|
||||||
data
|
|
||||||
to
|
|
||||||
see
|
|
||||||
that FTP
|
|
||||||
works
|
|
||||||
so does it?
|
|
||||||
</data>
|
|
||||||
</reply>
|
|
||||||
|
|
||||||
# Client-side
|
|
||||||
<client>
|
|
||||||
<server>
|
|
||||||
ftp
|
|
||||||
</server>
|
|
||||||
<name>
|
|
||||||
FTP GET with type=A style ASCII URL and understated server SIZE
|
|
||||||
</name>
|
|
||||||
<command>
|
|
||||||
"ftp://%HOSTIP:%FTPPORT/129;type=A"
|
|
||||||
</command>
|
|
||||||
</client>
|
|
||||||
|
|
||||||
# Verify data after the test has been "shot"
|
|
||||||
<verify>
|
|
||||||
<protocol>
|
|
||||||
USER anonymous
|
|
||||||
PASS ftp@example.com
|
|
||||||
PWD
|
|
||||||
EPSV
|
|
||||||
TYPE A
|
|
||||||
SIZE 129
|
|
||||||
RETR 129
|
|
||||||
QUIT
|
|
||||||
</protocol>
|
|
||||||
</verify>
|
|
||||||
</testcase>
|
|
@ -37,7 +37,6 @@ CWD tmp
|
|||||||
CWD moo
|
CWD moo
|
||||||
EPSV
|
EPSV
|
||||||
TYPE A
|
TYPE A
|
||||||
SIZE 143
|
|
||||||
RETR 143
|
RETR 143
|
||||||
QUIT
|
QUIT
|
||||||
</protocol>
|
</protocol>
|
||||||
|
@ -35,7 +35,7 @@ ftp
|
|||||||
FTP range download when SIZE doesn't work
|
FTP range download when SIZE doesn't work
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
ftp://%HOSTIP:%FTPPORT/336 --use-ascii --range 3-6
|
ftp://%HOSTIP:%FTPPORT/336 --range 3-6
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ PASS ftp@example.com
|
|||||||
PWD
|
PWD
|
||||||
EPSV
|
EPSV
|
||||||
PASV
|
PASV
|
||||||
TYPE A
|
TYPE I
|
||||||
SIZE 336
|
SIZE 336
|
||||||
REST 3
|
REST 3
|
||||||
RETR 336
|
RETR 336
|
||||||
|
@ -35,7 +35,7 @@ ftp
|
|||||||
FTP range download with SIZE returning extra crap
|
FTP range download with SIZE returning extra crap
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
ftp://%HOSTIP:%FTPPORT/337 --use-ascii --range 3-6
|
ftp://%HOSTIP:%FTPPORT/337 --range 3-6
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ PASS ftp@example.com
|
|||||||
PWD
|
PWD
|
||||||
EPSV
|
EPSV
|
||||||
PASV
|
PASV
|
||||||
TYPE A
|
TYPE I
|
||||||
SIZE 337
|
SIZE 337
|
||||||
REST 3
|
REST 3
|
||||||
RETR 337
|
RETR 337
|
||||||
|
@ -45,7 +45,6 @@ PASS ftp@example.com
|
|||||||
PWD
|
PWD
|
||||||
EPSV
|
EPSV
|
||||||
TYPE A
|
TYPE A
|
||||||
SIZE 562
|
|
||||||
RETR 562
|
RETR 562
|
||||||
QUIT
|
QUIT
|
||||||
</protocol>
|
</protocol>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user