Re: FTP returns wrong file size (and a fix)

From: Date: Wed, 13 Mar 2002 21:48:45 +0000
Subject: Re: FTP returns wrong file size (and a fix)
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-81171@lists.php.net to get a copy of this message
derick@php.net wrote:
On Wed, 13 Mar 2002, Vlad Krupin wrote:
I guess, we could do that too. Should I come up with a new patch?
I think it is better, decrease the WTF factor :) I think so too. However, two things:
1. after reading the source for a few functions, (like ftp_get() used to get files), it because apparent that they do not restore the type. 2. the type is a required parameter for the functions that need it (like ftp_get() for example), so preserving it is pointless. 3. figuring out what type there was before ftp_size() was called is a pain and requires parsing of a plain-English sentence. I'd rather abandon the idea than do it that way. In short, I first agreed that that would reduce the WTF factor, but, after reading the code I do not think there is a reason for 'WTF' at all. Any comments? Vlad
Derick
derick@php.net wrote:
On Wed, 13 Mar 2002, Vlad Krupin wrote:
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.
would it be possible to restore the FTPTYPE after the SIZE ? Derick
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
----------------------------------------------------------------------
            PHP: Scripting the Web - derick@php.net
              All your branches are belong to me!
          SRM: Site Resource Manager - www.vl-srm.net
-----------------------------------------------------------------------
----------------------------------------------------------------------
             PHP: Scripting the Web - derick@php.net
               All your branches are belong to me!
           SRM: Site Resource Manager - www.vl-srm.net
-----------------------------------------------------------------------


« previous php.dev (#81171) next »