📄 rfc959.txt
字号:
may be flagged.
The restart marker is embedded in the data stream as an
integral number of 8-bit bytes representing printable
characters in the language being used over the control
connection (e.g., default--NVT-ASCII). <SP> (Space, in the
appropriate language) must not be used WITHIN a restart marker.
For example, to transmit a six-character marker, the following
would be sent:
+--------+--------+--------+
|Descrptr| Byte count |
|code= 16| = 6 |
+--------+--------+--------+
+--------+--------+--------+
| Marker | Marker | Marker |
| 8 bits | 8 bits | 8 bits |
+--------+--------+--------+
+--------+--------+--------+
| Marker | Marker | Marker |
| 8 bits | 8 bits | 8 bits |
+--------+--------+--------+
Postel & Reynolds [Page 22]
RFC 959 October 1985
File Transfer Protocol
3.4.3. COMPRESSED MODE
There are three kinds of information to be sent: regular data,
sent in a byte string; compressed data, consisting of
replications or filler; and control information, sent in a
two-byte escape sequence. If n>0 bytes (up to 127) of regular
data are sent, these n bytes are preceded by a byte with the
left-most bit set to 0 and the right-most 7 bits containing the
number n.
Byte string:
1 7 8 8
+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
|0| n | | d(1) | ... | d(n) |
+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
^ ^
|---n bytes---|
of data
String of n data bytes d(1),..., d(n)
Count n must be positive.
To compress a string of n replications of the data byte d, the
following 2 bytes are sent:
Replicated Byte:
2 6 8
+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
|1 0| n | | d |
+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
A string of n filler bytes can be compressed into a single
byte, where the filler byte varies with the representation
type. If the type is ASCII or EBCDIC the filler byte is <SP>
(Space, ASCII code 32, EBCDIC code 64). If the type is Image
or Local byte the filler is a zero byte.
Filler String:
2 6
+-+-+-+-+-+-+-+-+
|1 1| n |
+-+-+-+-+-+-+-+-+
The escape sequence is a double byte, the first of which is the
Postel & Reynolds [Page 23]
RFC 959 October 1985
File Transfer Protocol
escape byte (all zeros) and the second of which contains
descriptor codes as defined in Block mode. The descriptor
codes have the same meaning as in Block mode and apply to the
succeeding string of bytes.
Compressed mode is useful for obtaining increased bandwidth on
very large network transmissions at a little extra CPU cost.
It can be most effectively used to reduce the size of printer
files such as those generated by RJE hosts.
3.5. ERROR RECOVERY AND RESTART
There is no provision for detecting bits lost or scrambled in data
transfer; this level of error control is handled by the TCP.
However, a restart procedure is provided to protect users from
gross system failures (including failures of a host, an
FTP-process, or the underlying network).
The restart procedure is defined only for the block and compressed
modes of data transfer. It requires the sender of data to insert
a special marker code in the data stream with some marker
information. The marker information has meaning only to the
sender, but must consist of printable characters in the default or
negotiated language of the control connection (ASCII or EBCDIC).
The marker could represent a bit-count, a record-count, or any
other information by which a system may identify a data
checkpoint. The receiver of data, if it implements the restart
procedure, would then mark the corresponding position of this
marker in the receiving system, and return this information to the
user.
In the event of a system failure, the user can restart the data
transfer by identifying the marker point with the FTP restart
procedure. The following example illustrates the use of the
restart procedure.
The sender of the data inserts an appropriate marker block in the
data stream at a convenient point. The receiving host marks the
corresponding data point in its file system and conveys the last
known sender and receiver marker information to the user, either
directly or over the control connection in a 110 reply (depending
on who is the sender). In the event of a system failure, the user
or controller process restarts the server at the last server
marker by sending a restart command with server's marker code as
its argument. The restart command is transmitted over the control
Postel & Reynolds [Page 24]
RFC 959 October 1985
File Transfer Protocol
connection and is immediately followed by the command (such as
RETR, STOR or LIST) which was being executed when the system
failure occurred.
4. FILE TRANSFER FUNCTIONS
The communication channel from the user-PI to the server-PI is
established as a TCP connection from the user to the standard server
port. The user protocol interpreter is responsible for sending FTP
commands and interpreting the replies received; the server-PI
interprets commands, sends replies and directs its DTP to set up the
data connection and transfer the data. If the second party to the
data transfer (the passive transfer process) is the user-DTP, then it
is governed through the internal protocol of the user-FTP host; if it
is a second server-DTP, then it is governed by its PI on command from
the user-PI. The FTP replies are discussed in the next section. In
the description of a few of the commands in this section, it is
helpful to be explicit about the possible replies.
4.1. FTP COMMANDS
4.1.1. ACCESS CONTROL COMMANDS
The following commands specify access control identifiers
(command codes are shown in parentheses).
USER NAME (USER)
The argument field is a Telnet string identifying the user.
The user identification is that which is required by the
server for access to its file system. This command will
normally be the first command transmitted by the user after
the control connections are made (some servers may require
this). Additional identification information in the form of
a password and/or an account command may also be required by
some servers. Servers may allow a new USER command to be
entered at any point in order to change the access control
and/or accounting information. This has the effect of
flushing any user, password, and account information already
supplied and beginning the login sequence again. All
transfer parameters are unchanged and any file transfer in
progress is completed under the old access control
parameters.
Postel & Reynolds [Page 25]
RFC 959 October 1985
File Transfer Protocol
PASSWORD (PASS)
The argument field is a Telnet string specifying the user's
password. This command must be immediately preceded by the
user name command, and, for some sites, completes the user's
identification for access control. Since password
information is quite sensitive, it is desirable in general
to "mask" it or suppress typeout. It appears that the
server has no foolproof way to achieve this. It is
therefore the responsibility of the user-FTP process to hide
the sensitive password information.
ACCOUNT (ACCT)
The argument field is a Telnet string identifying the user's
account. The command is not necessarily related to the USER
command, as some sites may require an account for login and
others only for specific access, such as storing files. In
the latter case the command may arrive at any time.
There are reply codes to differentiate these cases for the
automation: when account information is required for login,
the response to a successful PASSword command is reply code
332. On the other hand, if account information is NOT
required for login, the reply to a successful PASSword
command is 230; and if the account information is needed for
a command issued later in the dialogue, the server should
return a 332 or 532 reply depending on whether it stores
(pending receipt of the ACCounT command) or discards the
command, respectively.
CHANGE WORKING DIRECTORY (CWD)
This command allows the user to work with a different
directory or dataset for file storage or retrieval without
altering his login or accounting information. Transfer
parameters are similarly unchanged. The argument is a
pathname specifying a directory or other system dependent
file group designator.
CHANGE TO PARENT DIRECTORY (CDUP)
This command is a special case of CWD, and is included to
simplify the implementation of programs for transferring
directory trees between operating systems having different
Postel & Reynolds [Page 26]
RFC 959 October 1985
File Transfer Protocol
syntaxes for naming the parent directory. The reply codes
shall be identical to the reply codes of CWD. See
Appendix II for further details.
STRUCTURE MOUNT (SMNT)
This command allows the user to mount a different file
system data structure without altering his login or
accounting information. Transfer parameters are similarly
unchanged. The argument is a pathname specifying a
directory or other system dependent file group designator.
REINITIALIZE (REIN)
This command terminates a USER, flushing all I/O and account
information, except to allow any transfer in progress to be
completed. All parameters are reset to the default settings
and the control connection is left open. This is identical
to the state in which a user finds himself immediately after
the control connection is opened. A USER command may be
expected to follow.
LOGOUT (QUIT)
This command terminates a USER and if file transfer is not
in progress, the server closes the control connection. If
file transfer is in progress, the connection will remain
open for result response and the server will then close it.
If the user-process is transferring files for several USERs
but does not wish to close and then reopen connections for
each, then the REIN command should be used instead of QUIT.
An unexpected close on the control connection will cause the
server to take the effective action of an abort (ABOR) and a
logout (QUIT).
4.1.2. TRANSFER PARAMETER COMMANDS
All data transfer parameters have default values, and the
commands specifying data transfer parameters are required only
if the default parameter values are to be changed. The default
value is the last specified value, or if no value has been
specified, the standard default value
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -