IETF-SSH archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

SFTP File open modes



The current specification of SFTP states that files are always opened in
"binary" mode - no translations between different character sets and newline
encodings.

It is well known that different systems use different methods of encoding
text files.  If SFTP desires to be able to provide a secure way of
interchanging files between systems, then it must specify a method in which
text files can be exchanged in a uniform manner.  To address this problem, I
propose the following:

add the flag SSH_FXF_ASCII to the SSH_FXP_OPEN message.
When this flag is set, the file will be transferred in system independent
ASCII text format, if appropriate.
The system independent format is defined as characters separated by a
newline character to specify end of line.  The system that is storing the
file may make any changes necessary to store the text in a manner that is
compatible with standard methods for that system.  When a file is
transferred in ASCII mode, the total number of bytes transferred may be
different from the size provided by the SSH_FXP_xSTAT function.  Ideally,
the number of bytes transmitted should never be greater.

A request to open a file in ASCII format that can not be opened in ASCII
format (and should probably be transferred in binary format) will return a
failure status of FX_OP_UNSUPPORTED.

It may be desirable to include information in the response to a xSTAT
function and READDIR stating whether or not a file is candidate to be opened
in ASCII format.  This could be indicated in the file type information, in a
manner similar to the way that a directory file is indicated.


----------------------
Richard Whalen
Process Software
508-879-6994




Home | Main Index | Thread Index | Old Index