Re: FTP type proposed solution..

From: Nigel Metheringham <Nigel.Metheringham@dont-contact.us>
Date: Tue, 25 Feb 1997 15:20:50 +0000

tpaquett@AEC.CA said:
} if you cannot find a MIME type from the above.. extract the first X
} bytes from the file. Scan the bytes looking for a character with the
} high bit set.

} If you find one byte with the high bit set, then set the MIME type to
} application/octet-stream.

} If you do not find one, assume text/plain.

ongbh@zpoprp.zpo.dec.com said:
} There will be some performance problem with this method. For instance,
} if someone were to check the directory of a large ftp archive with 100
} files, you will have to download 100 * x bytes and fire up 100
} connections.

This isn't the case... you only fetch the file if it is being retrieved
not if the directory is being listed. Its simply a case of putting a one
or 2 kilobyte buffer into the ftpget program and filling and inspecting
that prior to putting out the header and first part of the file.

Nice, simple and elegant, although not fool-proof.

Incidently the test should be for high bit characters or null bytes.

I think that you should also be able to hand over an extra bit of URL in
the same way that parameters for a GET type cgi script (ie add
?parameter=something), and be able to pass over the mime type that way.

        Nigel.

-- 
[ Nigel.Metheringham@theplanet.net   -  Systems Software Engineer ]
[ Tel : +44 113 251 6012                   Fax : +44 113 224 0003 ]
[            Dedicated to the replacement of sendmail!            ]
Received on Tue Feb 25 1997 - 07:42:19 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:34:32 MST