ascii-mode |
NcFTPd general.cf file configuration Don't forget to restart NcFTPd after modifying the general.cf file. |
The FTP protocol allows for files to be transferred verbatim (in "binary" mode), and in ASCII (text) mode. Unfortunately, what consitutes "text" varies from operating system to operating system. For MS-DOS and Microsoft Windows, the ending of a line of text is delimited by a carriage return (CR) character and a line feed (LF) character, forming "CRLF" line endings. For UNIX systems, a line ending requires just a single LF, and there are other operating systems that use just a single CR.
To handle these varying text formats, the FTP protocol specifies that clients and servers convert their text to a single network text format, and upon receiving the file, convert from the network text format to the local format. The network text format is defined as CRLF line endings. For example, with a UNIX client sending a file in ASCII mode to a UNIX server, the client first converts its text file from LF to network text's CRLF format, sends this data to the server, which then converts from network text's CRLF back to LF before storing the file.
NcFTPd features different algorithms for text conversion.
Algorithm 1: Strip all CR characters from the text file and pass the rest of the file verbatim. This is often the default algorithm for other FTP servers, but does not work when the file was incorrectly sent with only CR line endings; if there are no LF characters, then upon stripping the CRs the resulting file will have no line endings.
Algorithm 2: Try to determine if the text file was sent with CRLF, CR, or LF line endings. Also try to convert incorrectly formatted files with CRCRLF, which can result when a client naively adds one CR per LF character when the file was already stored as CRLF. This is the default algorithm for NcFTPd 2.8.2 and earlier.
Algorithm 3: Same result as 2, but implemented differently internally to account for some problems that can occur on internal block boundaries. This is the default algorithm for NcFTPd 2.8.3 and later.
Algorithm 0: No conversion. Do not choose this algorithm, as it is intended for testing FTP client programs only! This essentially treats ASCII as binary mode, which violates the FTP protocol.
Examples:
Recommendation: