Just ran into a problem:
when we request a file size from an FTP server, the answer will depend
on whether the server state is ASCII or BINARY.
If it is not BINARY, the filesize won't be the true filesize, but will
depend on how many newline characters you have in that file :( Thus,
currently ftp_size() returns bogus results - it can return different
values for the same file, depending on what commands were issued before
the ftp_size().
I suggest that we always request the filesize after issuing a 'binary'
command. The fix is a one-liner, and I was wondering if there would be
objections to merging it into the release branch as well.
Do you guys mind if I commit that patch?
--- ftp.c-old Sat Aug 11 09:38:27 2001
+++ ftp.c Wed Mar 13 17:07:00 2002
@@ -653,6 +653,8 @@
if (ftp == NULL)
return -1;
+ if (!ftp_type(ftp, FTPTYPE_IMAGE))
+ return -1;
if (!ftp_putcmd(ftp, "SIZE", path))
return -1;
if (!ftp_getresp(ftp) || ftp->resp != 213)
Vlad
--
Vlad Krupin
Software Engineer
echospace.com
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php