SFTP 传输中的 ASCII 模式

ASCII mode in SFTP transfers

SFTP传输中的ASCII模式是什么意思。是否要以文本格式传输文件。

引用关于文本(又名 ASCII)访问远程文件的 SFTP 规范:

5.3. Determining Server Newline Convention

In order to correctly process text files in a cross platform compatible way, newline sequences must be converted between client and server conventions.

The SSH_FXF_TEXT_MODE file open flag (Section 8.1.1) makes it possible to request that the server translate a file to a 'canonical' wire format. This format uses CRLF as the line separator.

Servers for systems using other conventions MUST translate to and from the canonical form.

请注意,仅 SFTP 版本 4 支持“文本模式”。许多现有的 SFTP 实现(包括最广泛使用的 OpenSSH)仅支持 SFTP 版本 3。所以他们根本不支持text/ASCII模式。