rfc454.txt

来自「RFC 的详细文档!」· 文本 代码 · 共 1,488 行 · 第 1/5 页

TXT
1,488
字号



McKenzie                                                       [Page 16]

RFC 454                  File Transfer Protocol                July 1972


IV.  FILE TRANSFER FUNCTIONS

   The TELNET connections on which FTP commands and replies are
   transmitted are initiated by the user-FTP process via an ICP to a
   standard server socket.  FTP commands are then transmitted from user
   to server, and replies are transmitted from server to user.  The user
   file transfer functions involve sending the FTP commands, interpret-
   ing the replies received and transferring data over the data connec-
   tion in the specified manner.  The server file transfer functions
   involve accepting and interpreting FTP commands, sending replies,
   setting up the data connection, and transferring data.








































McKenzie                                                       [Page 17]

RFC 454                  File Transfer Protocol                July 1972


IV.A  FTP Commands

   FTP commands are ASCII strings terminated by the ASCII character
   sequence CRLF (Carriage Return followed by Line Feed).  The command
   codes themselves are ASCII alphabetic characters terminated by the
   ASCII character 'space' (octal code 40).  For convenience, the com-
   mand codes are defined to be four (or less) ASCII alphanumeric char-
   acters (including both upper and lower case alphabetic characters).
   The command codes and the semantics of commands are described in this
   section, but the detailed syntax of commands is specified in Section
   V.B, the reply sequences are discussed in Section V.C, and scenarios
   illustrating the use of commands are provided in Section V.D.

   FTP commands may be partitioned as those specifying access-control
   identifiers, data transfer parameters, or FTP service requests.  Cer-
   tain commands (such as ABOR, STAT, BYE) may be sent over the TELNET
   connections while a data transfer is in progress.  Some servers may
   not be able to monitor the TELNET and data connections simultane-
   ously, in which case these commands should be preceded by a TELNET
   SYNC to awaken the server. (For other servers this may not be neces-
   sary and the SYNC will be ignored.)

IV.A.1  Access Control Commands

   The following commands specify access control identifiers (command
   codes are shown in parentheses).

      User name (USER) - The argument field is an ASCII string identify-
      ing 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
      TELNET 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 accounting information.  All parameters are
      unchanged and any file transfer in progress is completed under the
      old account.

      Password (PASS) - The argument field is an ASCII string identify-
      ing the user's password.  This command must be immediatly 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 type out.  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.




McKenzie                                                       [Page 18]

RFC 454                  File Transfer Protocol                July 1972


      Account (ACCT) - The argument field is an ASCII 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 two
      reply codes to differentiate these cases for the automaton: When
      account information is required for login and the server receives
      another command which he buffers, the legal response is reply code
      331 when an account is required for a specific transfer requested,
      the reply code 433 is returned and the request command is flushed.

      Reinitialize (REIN) - This command terminates a USER, flushing all
      I/O and account information, except to allow any transfer in pro-
      gress to be completed.  All parameters are reset to the default
      setting and the TELNET connection is left open.  A USER command is
      expected to follow.

      Logout (BYE) - This command terminates a USER and if file transfer
      is not in progress, closes the TELNET connection.  If file
      transfer is in progress, the connection will remain open for
      result response and will then close.  For "hot card-reader" mode
      the REIN command should be used instead.

      An unexpected close on the TELNET connection will cause the server
      to take the effective action of an abort (ABOR) and a logout
      (BYE).

IV.A.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 as stated here.  This implies that the server must
   "remember" the applicable default values.  The commands may be in any
   order except that they must precede the FTP service request.  The
   following commands specify data transfer parameters

      Byte size (BYTE) - The argument is an ASCII-represented decimal
      integer (1 through 255), specifying the byte size for the data
      connection.  The default byte size is 8 bits.  The byte size is
      always 8 bits in the ASCII and EBCDIC representation types.  A
      server may reject specific byte size/type combinations by sending
      an error reply code in response to a transfer request command.

      Data socket (SOCK) - The argument is a HOST-socket specification
      for the data socket to be used in data connection.  There may be
      two data sockets, one from server to user and the other for user



McKenzie                                                       [Page 19]

RFC 454                  File Transfer Protocol                July 1972


      to server data transfer.  An odd socket number defines a send
      socket and an even socket number defines a receive socket.  The
      default HOST is the user HOST to which TELNET connections are
      made.  The default data sockets are (U+4) and (U+5) where U is the
      socket number used in the TELNET ICP and the TELNET connections
      are on sockets (U+2) and (U+3).

      Listen (LSTN) - The argument is a single ASCII character code to
      specify the direction of the socket that the server must allocate
      for use as a data connection.  The server is to "listen" on the
      allocated socket when an appropriate transfer command is given.
      The following codes are assigned:

            S - send
            R - receive

      Representation Type (TYPE) - The argument is a single ASCII char-
      acter code specifying the representation types described in Sec-
      tion III.B.  The following codes are assigned for type:

            A - ASCII
            I - Image
            L - Local Byte
            E - EBCDIC

      The default representation type is ASCII.

      Format (FORM) - The argument is a single ASCII character code
      specifying the formats described in Section III.B. The following
      codes are assigned for format:

            U - Unformatted
            P - Printfile

      The default format is Unformatted.

      File Structure (STRU) - The argument is a single ASCII character
      code specifying file structure described in Section III.C.  The
      following codes are assigned for structure:

            F - File (no ecord structure)
            R - Record structure

      The default structure is File (ie. no records).

      Transfer Mode (MODE) - The argument is a single ASCII character
      code specifying the data transfer modes described in Section
      III.C.  The following codes are assigned for transfer modes:



McKenzie                                                       [Page 20]

RFC 454                  File Transfer Protocol                July 1972


            S - Stream (bytes, close is EOF)
            B - Block (header with descriptor and count)
            T - Text (TELNET control code for EOR, EOF)
            H - Hasp (specially formatted compressed data)

      The default transfer mode is Stream.

IV.A.3  FTP Service Commands

   The FTP service commands define the file transfer or the file system
   function requested by the user.  The argument of an FTP service com-
   mand will normally be a pathname.  The syntax of pathnames must con-
   form to server site conventions (with standard defaults applicable),
   except that ASCII characters must be used (in conformance with the
   TELNET Protocol).  The suggested default handling is to use the last
   specified device, directory or file name, or the standard default
   defined for local users.  The command may be in any order except that
   a "rename from" command, must be followed by a "rename to" command,
   and some servers may require an "allocate" command before a "store"
   command.  The data, when transferred in response to FTP service
   commands, shall always be sent over the data connection.  The follow-
   ing commands specify FTP service requests:

      Retrieve (RETR) - This command achieves the transfer of a copy of
      the file specified in the pathname, from server to user site.  The
      status and contents of the file at the server site shall be unaf-
      fected.

      Store (STOR) - This command achieves the transfer of a copy of a
      file from user to server site.  If the file specified in the path-
      name exists at the server site, then its contents shall be
      replaced by the contents of the file being transferred.  A new
      file is created at the server site if the file specified in the
      pathname does not already exist.

      Append (with create) (APPE) - This command achieves the transfer
      of data from using to serving site.  If the file specified in the
      pathname exists at the server site, then the data transferred
      shall be appended to that file, otherwise the file specified in
      the pathname shall be created at the server site.

      Allocate (ALLO) - This command may required by some servers to
      reserve sufficient storage to accommodate the new file to be
      transferred.  The argument field shall be a decimal integer
      representing the number of bytes (of size specified by the byte
      size command) of storage to be reserved for the file.  This





McKenzie                                                       [Page 21]

RFC 454                  File Transfer Protocol                July 1972


      command shall be followed by a store or append command.  The ALLO
      command should be treated as a NO-OP (no operation) by those
      servers which do not require that the maximum size of the file be
      declared beforehand.

      Restart (REST) - The argument field represents the server marker
      at which file transfer is to be restarted.  This command does not
      cause file transfer but "spaces" over the file to the specified
      data checkpoint.  This command shall be immediately followed by
      the appropriate FTP service command which shall cause file

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?