mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
set type before checking --head size, as the type may cause the server
to return different sizes
This commit is contained in:
parent
920579ba11
commit
4035543763
17
lib/ftp.c
17
lib/ftp.c
@ -661,6 +661,23 @@ CURLcode _ftp(struct connectdata *conn)
|
|||||||
may not support it! It is however the only way we have to get a file's
|
may not support it! It is however the only way we have to get a file's
|
||||||
size! */
|
size! */
|
||||||
int filesize;
|
int filesize;
|
||||||
|
|
||||||
|
/* Some servers return different sizes for different modes, and thus we
|
||||||
|
must set the proper type before we check the size */
|
||||||
|
ftpsendf(data->firstsocket, conn, "TYPE %s",
|
||||||
|
(data->bits.ftp_ascii)?"A":"I");
|
||||||
|
|
||||||
|
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||||
|
if(nread < 0)
|
||||||
|
return CURLE_OPERATION_TIMEOUTED;
|
||||||
|
|
||||||
|
if(strncmp(buf, "200", 3)) {
|
||||||
|
failf(data, "Couldn't set %s mode",
|
||||||
|
(data->bits.ftp_ascii)?"ASCII":"binary");
|
||||||
|
return (data->bits.ftp_ascii)? CURLE_FTP_COULDNT_SET_ASCII:
|
||||||
|
CURLE_FTP_COULDNT_SET_BINARY;
|
||||||
|
}
|
||||||
|
|
||||||
ftpsendf(data->firstsocket, conn, "SIZE %s", ftp->file);
|
ftpsendf(data->firstsocket, conn, "SIZE %s", ftp->file);
|
||||||
|
|
||||||
nread = GetLastResponse(data->firstsocket, buf, conn);
|
nread = GetLastResponse(data->firstsocket, buf, conn);
|
||||||
|
Loading…
Reference in New Issue
Block a user