Subject: ftp/ftpd & SIZE
To: None <>
From: Manuel Bouyer <>
List: tech-userlevel
Date: 07/26/2002 11:06:57
I've found a problem with either our ftp or ftpd (both from 1.5.3):
if you're in binary mode, issue a 'ls' followed by a 'size', the
size command is handled as ascii:
ftp> bin
200 Type set to I.
ftp> size i386pkg-cdlabel.pdf.gz
i386pkg-cdlabel.pdf.gz  1429702
ftp> ls
229 Entering Extended Passive Mode (|||56044|)
150 Opening ASCII mode data connection for '/bin/ls'.
total 2577006
-r--r--r--  1 ftpmaint  wheel       5350 Apr 15 15:47 README.i386pkg
-r--r--r--  1 ftpmaint  wheel    1429702 Apr 17 09:17 i386pkg-cdlabel.pdf.gz
-r--r--r--  1 ftpmaint  wheel    1686664 Apr 17 09:17
-r--r--r--  1 ftpmaint  wheel  638568448 Apr 15 14:52 i386pkg1.iso
-r--r--r--  1 ftpmaint  wheel  644192256 Apr 15 15:05 i386pkg2.iso
-r--r--r--  1 ftpmaint  wheel  568348672 Apr 15 15:16 i386pkg3.iso
-r--r--r--  1 ftpmaint  wheel  645306368 Apr 15 15:29 i386pkg4.iso
-r--r--r--  1 ftpmaint  wheel  137928704 Apr 15 15:31 i386pkg5.iso
226 Transfer complete.
ftp> size i386pkg-cdlabel.pdf.gz
i386pkg-cdlabel.pdf.gz  1435121

note that the size results differ.
This is probably because 'ls' is done in ascii and either ftp or ftpd
remember that. This is probably wrong.
Now if I had issued the size on i386pkg1.iso it would be more annoying:
in binary, ftpd just returns the result of a stat, but in ascii it has
to parse the whole file to do the NL/CR-NL convertion. On a +600MB file
this takes a lot of time, the client times out, etc ...

Manuel Bouyer, LIP6, Universite Paris VI.