Subject: Re: SIZE command of ftpd depends on binary or ascii mode
To: None <tech-userlevel@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-userlevel
Date: 12/28/2005 00:34:54
>   SIZE README-all.html
>   550 README-all.html: file too large for SIZE

> The significant difference is that apache does not set the type of
> data (ascii or binary) explicitly before this SIZE command, while our
> /usr/bin/ftp does set type "binary" [...]

> Is this behaviour of ftpd intended (and correct)?

I believe it is.

See draft-ietf-ftpext-mlst-16; SIZE is defined to be the on-wire size
of the file, and in ASCII mode - whether explicitly or by default -
this demands converting from local line-delimiting conventions to the
CRLF pairs that ASCII mode uses.

This involves reading the entire file.  It does not seem unreasonable,
to me, for ftpd to refuse to do this if the file is larger than some
threshold.  (Whiel I'd prefer the threshold to be tweakable, I think
that 1210456 bytes - the size of README-all.html - is big enough that
it's not unreasonable for us to be rejecting SIZE commands for it.)

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B