home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / rfc / 1 / rfc0354.txt < prev    next >
Encoding:
Text File  |  2003-06-11  |  56.7 KB  |  1,404 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                     Abhay Bhushan
  8. Request for Comments: 354                                       MIT-MAC
  9. NIC: 10596                                                 July 8, 1972
  10. Categories D.4, D.5, D.7
  11. Obsoletes: RFC 264 and 265
  12.  
  13.  
  14.                        THE FILE TRANSFER PROTOCOL
  15.  
  16.  
  17. I. INTRODUCTION
  18.  
  19.     The File Transfer Protocol (FTP) is a protocol for file
  20. transfer betweet HOSTs (including terminal IMPs), on the ARPA
  21. Computer Network (ARPANET). The primary function of FTP is to
  22. transfer files efficiently and reliably among HOSTs and to allow
  23. the convenient use of remote file storage capabilities.
  24.  
  25.     The objectives of FTP are 1) to promote sharing of files
  26. (computer programs and/or data), 2) fo encourage indirect or
  27. implicit (via programs) use of remote computers, 3) to shield a
  28. user from variations in file storage systems among HOSTs, and
  29. 4) to transfer data reliably and efficiently. FTP, though usable
  30. directly by user at a terminal, is designed mainly for use by
  31. programs.
  32.  
  33.     The attempt in this specification is to satisfy the diverse
  34. needs of users of maxi-HOSTs, mini-HOSTs, TIPs, and the
  35. Datacomputer, with a simple, elegant, and easily implemented
  36. protocol design.
  37.  
  38.     This paper assumes knowledge of the following protocols:
  39.  
  40.          1) The HOST-HOST Protocol (NIC #8246)
  41.  
  42.          2) The initial Connection Protocol (NIC #7101)
  43.  
  44.          3) The TELNET Protocol (NWG/RFC #318, NIC #9348)
  45.  
  46. II. DISCUSSION
  47.  
  48.     In this section, the terminology and the FTP model are
  49. discussed. The terms defined in this section are only those that
  50. have special significance in FTP.
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.                                                                 [Page 1]
  59.  
  60. The File Transfer Protocol                                  July 8, 1972
  61.  
  62.  
  63. 11.A. Terminology
  64.  
  65. ASCII               The USASCII character set as defined in NIC
  66.                     #7104. In FTP, ASCII characters are defined
  67.                     to be the lower half of an eight bit code set
  68.                     (i.e., the most significant bit es zero).
  69.  
  70. access controls     Access controls define users' access
  71.                     privileges to the use of a system, and to the
  72.                     files in that system. Access controls are
  73.                     necessary to prevent unauthorized or
  74.                     accidental use of files. It is the
  75.                     prerogative of a user-FTP process to provide
  76.                     access controls.
  77.  
  78. byte size           The byte size specified for the transfer of
  79.                     data. The data connection is opened with
  80.                     this byte size. Data connection byte size is
  81.                     not necessarily the byte size in which data
  82.                     is to be stored in a system, and may not be
  83.                     related to the structure of data.
  84.  
  85. data connection     A simplex connection over which data is
  86.                     transferred, in a specified byte size, mode
  87.                     and type. The data transferred may be a part
  88.                     of a file, an entire file or a number of
  89.                     files. The data connection may be in either
  90.                     direction (server-to-user or user-to server).
  91.  
  92. data socket         The socket on which a User-FTP process
  93.                     "listens" for a data connection.
  94.  
  95. EOF                 The end-of-file conidition that defines the
  96.                     end of a file being transferred.
  97.  
  98. EOR                 The end-of-record condition that defines the
  99.                     end of a record being transferred.
  100.  
  101. error recovery      A procedure that allows a user to recover
  102.                     form certain errors such as failure of either
  103.                     Host system or transfer process In FTP,
  104.                     error recovery may involve restarting a file
  105.                     transfer at a given checkpoint
  106.  
  107. FTP commands        A set of commands that comprise the control
  108.                     information flowing from the user-FTP to the
  109.                     server-FTP process.
  110.  
  111.  
  112.  
  113.  
  114.                                                                 [Page 2]
  115.  
  116. The File Transfer Protocol                                  July 8, 1972
  117.  
  118.  
  119. file                An ordered set of computer data (including
  120.                     programs) of arbitrary length uniquely
  121.                     identified by a pathname.
  122.  
  123. mode                The mode in which data is to be transferred
  124.                     via the data connection. The mode defines
  125.                     the data format including EOR and EOF. The
  126.                     transfer modes defined in FTP are described
  127.                     in Section III.A.
  128.  
  129. NVT                 The Network Virtual Terminal as defined in
  130.                     the ARPANET TELNET Protocol.
  131.  
  132. NVFS                The Network Virtual File System. A concept
  133.                     which defines a standard network file system
  134.                     with standard commands and pathname
  135.                     conventions. FTP only partially embraces the
  136.                     NFS concept at this time.
  137.  
  138. pathname            Pathname is defined to be the character
  139.                     string which must be input to a file system
  140.                     by a user in order to identify a file.
  141.                     Pathname normally contains device and/or
  142.                     directory names, and file name specification.
  143.                     FTP does not yet specify a standard pathname
  144.                     convention. Each user must follow the file
  145.                     naming conventions of hte file systems he
  146.                     wishes to use.
  147.  
  148. record              A sequential file may be structured as a
  149.                     number of contiguous parts called records.
  150.                     Record structures are supported by FTP but
  151.                     are not mandatory.
  152.  
  153. reply               A reply is an acknowledgment (positive or
  154.                     negative) sent from server to user via the
  155.                     telnet connections in response to FTP
  156.                     commands. The general form of a reply is a
  157.                     completion code (including error codes)
  158.                     followed by an ASCII text string. The codes
  159.                     are for use by programs and the text is for
  160.                     human users.
  161.  
  162. server-FTP process  A process or set of processes which perform
  163.                     the function of file transfer in cooperation
  164.                     with a user-FTP process. The server-FTP
  165.                     process must interpret and respond to user
  166.                     commands and initiate the data connection.
  167.  
  168.  
  169.  
  170.                                                                 [Page 3]
  171.  
  172. The File Transfer Protocol                                  July 8, 1972
  173.  
  174.  
  175. server site         A HOST site wich has a server-FTP process.
  176.  
  177. server-TELNET       A TELNET process which listens on a specified
  178.                     socket for an ICP initiated by a user-TELNET,
  179.                     and perform in accordance with the ARPANET
  180.                     TELNET Protocol.
  181.  
  182. TELNET connections  The full-duplex communication path between a
  183.                     user-TELNET and a server-TELNET. The TELNET
  184.                     connections are established via the standard
  185.                     ARPANET initial Connection Protocol (ICP).
  186.  
  187. type                The data representation type used for data
  188.                     transfer and storage. Type implies certain
  189.                     transformations between the time of data
  190.                     storage and data transfer. The
  191.                     representation types defined in FTP are
  192.                     described in Section III.B.
  193.  
  194. user                A process on behalf of a human being or a
  195.                     human being wishing to obtain file transfer
  196.                     service.
  197.  
  198. user site           A HOST site satisfying any of the following
  199.                     conditions: 1) The site where a user is
  200.                     located, 2) a site where a user-FTP process
  201.                     is located, 3) a site to which a data
  202.                     connection is made by a server. In the
  203.                     normal case, the sites defined by 1, 2, and 3
  204.                     are the same site, but nothing in FTP
  205.                     requires that this be so.
  206.  
  207. user-FTP process    A process or set of precesses which perform
  208.                     the function of file transfer in cooperation
  209.                     with a server-FTP process. The user-FTP
  210.                     process 1) initiates the ICP (via a
  211.                     user-TELNET, 2) initiates FTP commands and
  212.                     3) "listens" on the data socket for the data
  213.                     connection. In some obvious cases (use from
  214.                     TIPs and other mini-HOSTs) a user-FTP process
  215.                     will be subsumed under the term "user".
  216.  
  217. user-TELNET         A TELNET process which initiates an ICP to a
  218.                     specified server-TELNET socket, and performs
  219.                     in accordance with the ARPANET TELNET
  220.                     protocol.
  221.  
  222.  
  223.  
  224.  
  225.  
  226.                                                                 [Page 4]
  227.  
  228. The File Transfer Protocol                                  July 8, 1972
  229.  
  230.  
  231. II.B. The FTP Model
  232.  
  233.     With the above definitions in mind, the following model
  234. (shown in Figure 1) may be diagrammed for an FTP service.
  235.  
  236.  
  237.                             TELNET
  238.                           connections
  239. File      Server    Server<------------ User     User      File
  240. Systems<->  FTP  <->TELNET FTP Commands TELNET<->FTP    <->System
  241.           Process         ------------>          Process
  242.  
  243.                                                   Data
  244.                  <------------------------------>Socket
  245.                         Data Connection(s)         |
  246.                                                    |
  247.                                                   USER
  248.  
  249.  
  250.  
  251.  
  252. Notes:  1. The data connection may be in either direction.
  253.  
  254.         2. The data connection need not exist all of the time.
  255.  
  256.         3. The distinctions between user-FTP and user-TELNET,
  257.            and between server-FTP and server-TELNET may not
  258.            be as clear-cut as shown above. For example, a user-
  259.            TELNET may be directly driven by the user.
  260.  
  261.  
  262.  
  263.                 FIGURE 1 Model for FTP Use
  264.  
  265.  
  266.     In the model described in Figure 1, the user-TELNET
  267. initiates the TELNET connection. Standard FTP commands are then
  268. generated by the user and transmitted to the server site via the TELNET
  269. connections. FTP commands are in ASCII, in accordance with NVT
  270. conventions and the TELNET protocol. Note that commands may be initiated
  271. by the user directly through the user-TELNET or via a user-FTP process.
  272. Standard replies are sent from the server to the user in response to the
  273. commands over the TELNET connections.
  274.  
  275.     The FTP commands specify the parameters for teh data
  276. connection (data socket, byte size, transfer mode, and representation
  277. type), and the nature of file system operation (store, retrieve, append,
  278. delete, etc.). The user-FTP process or its designate should "listen" on
  279.  
  280.  
  281.  
  282.                                                                 [Page 5]
  283.  
  284. The File Transfer Protocol                                  July 8, 1972
  285.  
  286.  
  287. the specified data socket, and it is the server's responsibility to
  288. initiate the data connection and data transfer in accordance with the
  289. specified data connection parameters. It should be noted that the data
  290. socket need not be in the same HOST that initiates the FTP commands via
  291. the TELNET connection, but the user or his user-FTP process must ensure
  292. a "listen" on the specified data socket. A practical example of such
  293. file transfer to third HOSTs is a maxi-HOST user (who may actually be a
  294. TIP user) whishing to transmit a file to or from an I/O device attached
  295. to a TIP. It should also be noted that two data connections, one for
  296. send and the other for receive, may exist simultaneously.
  297.  
  298.     The protocol requires that the TELNET connections be open
  299. while data transfer is in progress. It is the responsibility of the user
  300. to close the TELNET connections when finished using the FTP service. The
  301. server may abort data transfer if the TELNET connections are closed.
  302.  
  303. III. DATA TRANSFER FUNCTIONS
  304.  
  305.     Data and files are transferred only via the data connection.
  306. The data transfer of data is governed by FTP data transfer commands
  307. received on the TELNET connections. The data transfer functions include
  308. establishing the data connection to the specified data socket in the
  309. specified HOST (using the specified byte size), transmitting and
  310. receiving data in the specified representation type and transfer mode,
  311. handling EOR and EOF conditions and error recovery (where applicable).
  312.  
  313. III.A Establishing Data Connection
  314.  
  315.     The user site shall "listen" on the specified data socket.
  316. The FTP request command determines the direction of data transfer, and
  317. the socket number (odd or even) which is to be used in establishing the
  318. data connection. The server on receiving the appropriate store or
  319. retrieve request shall initiate the data connection to the specified
  320. user data socket in the specified byte size (default byte size is 8
  321. bits) and send a reply indicating that file transfer may proceed. Prior
  322. to this the server should send a reply indicating the server socket for
  323. the data connection. The user may use this server socket information to
  324. ensure the security of his data transfer. The server may send this reply
  325. either before of after initiating the data connection.
  326.  
  327.     The byte size for the data connection is specified by the
  328. TYPE (ASCII is 8 bits), or TYPE and BYTE commands. It is not required by
  329. the protocol that servers accept all possible byte size. The user of
  330. various byte size is for efficiency in data transfer and servers may
  331. implement only those byte size for which their data transfer is
  332. efficient. It is however recommended that servers implement at least the
  333. byte size of 8 bits.
  334.  
  335.  
  336.  
  337.  
  338.                                                                 [Page 6]
  339.  
  340. The File Transfer Protocol                                  July 8, 1972
  341.  
  342.  
  343.     After the data transfer is completed, it is the server's
  344. responsibility to close the data connection except when the user is
  345. sender of data. The data connection shall be closed under any of the
  346. following conditions:
  347.  
  348.     1) server receives an abort command form user.
  349.  
  350.     2) EOF in stream mode indicated by closing data connection.
  351.  
  352.     3) the socket or byte size specification is changed.
  353.  
  354.     4) any of the TELNET connections are closed.
  355.  
  356.     5) an irrecoverable error condition.
  357.  
  358.     It should be noted that two simultaneous data connections
  359. (for send and receive) may exist. It is a server option, however, to
  360. close the data connection after each instance of file transfer.
  361.  
  362. III.B Data Representation and Storage
  363.  
  364.     Data is transferred from a storage device in sending HOST to
  365. a storage device in receiving HOST. Often it is necessary to perform
  366. certain transformations on the data because data storage representations
  367. in the two systems are different. For example, NVT-ASCII has different
  368. data storage representations in different systems. PDP-10's generally
  369. store NVT-ASCII as five 7-bit ASCII characters, left justified in a 36
  370. bit word. 360's store NVT-ASCII as 8-bit EBCDIC codes. Multics stores
  371. NVT-ASCII as four 9-bit characters in a 36-bit word. It may desirable to
  372. convert characters into the standard NVT-ASCII representation when
  373. transmitting text between disimilar systems. The sending and receiving
  374. site would have to perform the necessary transformations between the
  375. standard representation and their internal representations.
  376.  
  377.     A different problem in representation arises when
  378. transmitting binary data (not character codes) between HOST systems with
  379. different word length. it is not always clear how the sender should send
  380. data, and the receiver store it. For example, when transmitting 32-bit
  381. bytes from a 32-bit word-length system to a 36-bit word-length system,
  382. it may be desirable (for reasons of efficiency and usefulness) o store
  383. the 32-bit bytes right justified in a 36-bit word in the latter system.
  384. In any case, the user should have the option of specifying data
  385. representation and transformation functions. It should be noted that FTP
  386. provides for very limited data types reprentations.  Transformations
  387. desired beyond this limited capability should be performed by the user
  388. directly or via the use of the Data Reconfiguration Service (DRS, RFC
  389. #138, NIC #6715). Additional representation types may be defined later
  390. if there is a demonstrable need.
  391.  
  392.  
  393.  
  394.                                                                 [Page 7]
  395.  
  396. The File Transfer Protocol                                  July 8, 1972
  397.  
  398.  
  399.     Data representations are handled in FTP by a user specifying
  400. a representation type. The type may also specify a fixed transfer byte
  401. size. For example in ASCII and Print File representations, the transfer
  402. byte size must be 8 bits. Only in the Image and Local Byte
  403. representations the byte size specified by the BYTE command is to be
  404. used. The following data representation types are currently defined in
  405. FTP:
  406.  
  407. 1. ASCII            The sender converts data form its internal
  408.                     character representation to the standard
  409.                     ARPANET ASCII form. The receiver converts
  410.                     the data from the standard form to its own
  411.                     internal form. The data is transferred in
  412.                     the standard form. The transfer byte size
  413.                     must be 8 bits. This type would be used for
  414.                     transfer of text files. This is be default
  415.                     type, and it is recommended that this type be
  416.                     implemented by all.
  417.  
  418. 2. Image            The sender transforms data from contiguous
  419.                     bits to bytes for transfer. The receiver
  420.                     transforms the bytes into bits, storing them
  421.                     contiguously independent of the byte size
  422.                     chosen for data transfer. Typical uses for
  423.                     the Image type are transfer of executable
  424.                     programs between like machines, and transfer
  425.                     of binary (non-text) data. It is recommended
  426.                     that this type be implemented by all for some
  427.                     byte size preferably including the 8 bit byte
  428.                     size.
  429.  
  430. 3. Local Byte       This representation allows for efficient
  431.                     storage, use, and retrieval of data. The
  432.                     mann in which data is to be transformed
  433.                     depends on the byte size for data transfer,
  434.                     and the particular HOST being used. The
  435.                     transformation scheme for different byte size
  436.                     is to be well publicized b all server sites.
  437.                     This transformation shall be invertible
  438.                     (i.e., if a file is stored using a certain
  439.                     transfer byte size, an identical file must be
  440.                     retrievable using the same byte size and
  441.                     representation type). It is the user's
  442.                     responsibility to keep track of the
  443.                     representation type and byte size used for
  444.                     his transfer. Typical uses of the Local Byte
  445.                     type are in efficient storage and retrieval
  446.                     of files, and transfer of structured binary
  447.  
  448.  
  449.  
  450.                                                                 [Page 8]
  451.  
  452. The File Transfer Protocol                                  July 8, 1972
  453.  
  454.  
  455.                     data. This type may be identical to the
  456.                     image type for byte size which are integral
  457.                     multiples of or factors of the computer word
  458.                     length-
  459.  
  460. 4. Print File-      The server site will transform the ASCII
  461.    ASCII            file in a form suitable for printing at the
  462.                     server site. The byte size must be 8 bits.
  463.                     The transformation may not be invertible.
  464.                     This type is different from ASCII in that
  465.                     TABs, FFs and other ASCII format effector
  466.                     characters may be replaced by SPs, LFs, and
  467.                     other substitute characters. The print file
  468.                     conversions are to be well publicized by all
  469.                     server sites. This type would be used when
  470.                     the file is destined for an ASCII printer.
  471.                     This type in some systems may be identical to
  472.                     the ASCII type. It is recommended that this
  473.                     type be implemented by all.
  474.  
  475. 5. EBCDIC Print     The server site will transform the EBCDIC
  476.    File             file into a form suitable for printing at the
  477.                     server site. The byte size must be 8 bits.
  478.                     the transformation may not be invertible.
  479.                     This type would be used when the file is
  480.                     destined for an EBCDIC printer. Only systems
  481.                     which use EBCDIC for their internal character
  482.                     representation need accept this type.
  483.  
  484.     It should be noted that a serving HOST need not accept all
  485. representation types and/or byte size, but it must inform the user of
  486. the fact by sending an appropriate reply.
  487.  
  488. III.C File Structure and Transfer Modes
  489.  
  490.     The only file structures supported directly in FTP at the
  491. present time are record structures. However, the use of record
  492. structures is not mandatory. A user with no record structure in his file
  493. should be able to store and retrieve his file at any HOST. A user
  494. wishing to transmit a record structured file must send the appropriate
  495. FTP 'STRU' command (the default assumption is no record structure). A
  496. serving HOST need not accept record structures, but it must inform the
  497. user of this fact by sending an appropriate reply. Any record structure
  498. information in the data stream may subsequently be discarded by the
  499. receiver.
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.                                                                 [Page 9]
  507.  
  508. The File Transfer Protocol                                  July 8, 1972
  509.  
  510.  
  511.     All data transfer must end with an EOF. The EOF is defined
  512. by the data transfer mode. For files that have record structures, an EOR
  513. is also defined by the transfer mode. Only the transfer modes and
  514. representation type combinations that have EOR defined may be used for
  515. transfer or files with record structures. Records may be of zero length
  516. but they must be contained in file boundaries. The relationship between
  517. files and records is heirarchical and an EOF implies an EOR.
  518.  
  519.     The following data transfer modes are defined in FTP:
  520.  
  521. 1. Stream           The file is transmitted as a stream of bytes of the
  522.                     specified byte size. The EOF is signalled by
  523.                     closing the data connection. Any representation
  524.                     type and byte size may be used in the stream mode
  525.                     but record structures are possible only with the
  526.                     ASCII representation type. The convention is that
  527.                     the ASCII character CR (Carriage Return, Code 13.)
  528.                     followed by LF (Line Feed, Code 10.) Indicates an
  529.                     EOR in stream mode and ASCII representation type.
  530.                     This is the default mode, and it is recommended
  531.                     that this mode be implemented by all.
  532.  
  533. 2. Text             The file is ASCII text transmitted as sequence of
  534.                     8-bit bytes in the ASCII representation type.
  535.                     Record structures are allowed in this mode. The
  536.                     EOR and EOF are defined by the presence of special
  537.                     "TELNET-control" codes (most significant bit set
  538.                     of one) in the data stream. The EOR code is 192
  539.                     (octal 300, hex C0). The EOF code os 193 (octal
  540.                     301, hex C1). The byte size for transfer is 8
  541.                     bits.
  542.  
  543. 3. Block            The file is transmitted as a series of data blocks
  544.                     preceded by one or more header bytes. The header
  545.                     bytes contain a count field and descriptor code.
  546.                     The count field indicates the total length of the
  547.                     data block in bytes, thus marking the beginning of
  548.                     the next data block (there are no filler bits).
  549.                     The descriptor code defines last file block (EOF),
  550.                     last record block (EOR), restart marker (see
  551.                     section III.D), or suspect data (i.e. the data
  552.                     being transferred is suspected of errors and is
  553.                     not reliable). Record structures are allowed in
  554.                     this mode, and any representation type or byte
  555.                     size may be used. The header consists of integral
  556.                     number of bytes whose length is greater than or
  557.                     equal to 24 bits. Only the least significant 24
  558.                     bits (right-jusified) of header shall have
  559.  
  560.  
  561.  
  562.                                                                [Page 10]
  563.  
  564. The File Transfer Protocol                                  July 8, 1972
  565.  
  566.  
  567.                     information, other must significant bits must be
  568.                     zero. Of the 24 bits of header information, the
  569.                     16 low order bits shall represent byte count, and
  570.                     the 8 high order bits shall represent descriptor
  571.                     codes as shown below.
  572.  
  573.                             Integral data bytes > 24
  574.  
  575.  
  576.                     | Must be Zero  | Descriptor    | Byte Count    |
  577.                     | 0 to 231 bits |   8 bits      |    16 bits    |
  578.  
  579.                     The following descriptor codes are assigned:
  580.  
  581.                     Code  Meaning
  582.                       0   An ordinary block of data.
  583.                       1   End of data block is EOR.
  584.                       2   End of data block is EOF.
  585.                       3   Suspected errors in data block.
  586.                       4   Data block is a restart marker.
  587.  
  588.                     The restart marker is imbedded in the data stream
  589.                     as integral number of 8-bit bytes (representing
  590.                     printable ASCII characters) right-justified in
  591.                     integral number of data bytes greater than 8 bits.
  592.                     For example if the byte size is 7 bits, the
  593.                     restart marker byte would be one byte
  594.                     right-justified per two 7-bit bytes as shown
  595.                     below:
  596.  
  597.                       Two 7-bit bytes
  598.  
  599.                     |           | Marker Char|
  600.                     |           |    8 bits  |
  601.  
  602.                     For byte size of 16 bits or more, two more
  603.                     marker bytes shall be packed right-justified. The
  604.                     end of the marker may be delimited by the
  605.                     character SP (code 32.). If marker characters do
  606.                     no exactly fit an integral byte, the unused
  607.                     character slots should contain the ASCII character
  608.                     SP (code 32.). For example, to transmit a six
  609.                     character marker in a 36-bit byte size, the
  610.                     following three 36.bit bytes would be sent:
  611.  
  612.                     |   Zero    |  Descriptor  |               |
  613.                     |   12 bits |  code=4      | Byte count=2  |
  614.  
  615.  
  616.  
  617.  
  618.                                                                [Page 11]
  619.  
  620. The File Transfer Protocol                                  July 8, 1972
  621.  
  622.  
  623.                     |    | Marker  | Marker | Marker | Marker |
  624.                     |    | 8 bits  | 8 bits | 8 bits | 8 bits |
  625.  
  626.  
  627.                     |    | Marker  | Marker | SP     | SP     |
  628.                     |    | 8 bits  | 8 bits | 8 bits | 8 bits |
  629.  
  630. 4 Hasp              The file is transmitted as a sequence of 8-bit bytes
  631.                     in the standard Hasp-compressed data format
  632.                     (document to be issued by Bob Braden, UCLA). This
  633.                     mode achieves considerable compression of data for
  634.                     print files. Record structures are allowed in the
  635.                     Hasp mode.
  636.  
  637. III.D Error Recovery and Restart
  638.  
  639.     There is no provision for detecting bits lost or scrambled
  640. in data transfer. This issue is perhaps handled best at the NCP level
  641. where it benefits most users. However, a restart procedure is provided
  642. to protect user from system failures (such as failure of either HOST,
  643. FTP-process, or the IMP subnet).
  644.  
  645.     The restart procedure is defined only for the block mode of
  646. data transfer. It requires the sender of data to insert a special marker
  647. code in teh data stream with some marker information. The marker
  648. information has meaning only to the sender, but must consist of
  649. printable ASCII characters. The printable ASCII characters are defined
  650. to be codes 33. through 126. (i.e., not including codes 0. through 31.
  651. and the characters SP and DEL). The marker could represent a bit-count,a
  652. record-count, or any other information by wich a system may identify a
  653. data checkpoint. The receiver of data, if it implements the restart
  654. procedure, would then mark the corresponding position of this marker in
  655. the receiving system, and return this information to the user.
  656.  
  657.     In the event of a system failure, the user can restart the
  658. data transfer by identifying the marker point with the FTP restart
  659. procedure. The following examples Illustrate the use of the restart
  660. procedure.
  661.  
  662.     1. When server is the sender of data, the server-FTP process
  663. inserts an appropriate marker block in the data stream at a convenient
  664. data point. The user-FTP process receiving the data, marks the
  665. coressponding data point in its file system and conveys the last known
  666. sender and receiver marker information to the user. In the event of
  667. system failure, the user or user-FTP process restarts the server at the
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.                                                                [Page 12]
  675.  
  676. The File Transfer Protocol                                  July 8, 1972
  677.  
  678.  
  679. last server marker by sending a restart command with the server's marker
  680. code at its argument.  The restart command is transmitted over the
  681. TELNET connection and is immediately followed by the command (such as
  682. store or retrieve) which was being executed when the system failure
  683. occured.
  684.  
  685.     2. When user is the sender of data, the user-FTP process
  686. inserts the appropriate marker block in the data stream. The server-FTP
  687. process receiving the data, marks the corresponding data point in its
  688. file system. The server does not store this marker but conveys the last
  689. known sender and receiver marker information to the user over the TELNET
  690. connections by appropriate reply codes. The user or the user-FTP process
  691. then restarts transfer in a manner identical to that described in the
  692. first example.
  693.  
  694. IV. FILE TRANSFER FUNCTIONS
  695.  
  696.     The TELNET connections on which FTP commands and replies are
  697. transmitted, are initiated by the user-FTP process via an ICP to a
  698. standard server socket. FTP commands are then transmitted from user to
  699. server, and replies are transmitted from server to user.  The user file
  700. transfer functions invoive sending the FTP commands, interpreting the
  701. replies received and transferring data over the data connection in the
  702. specified manner. The server file transfer functions involve accepting
  703. and interpreting FTP commands, sending replies, setting up the data
  704. connection, and transferring data.
  705.  
  706. IV.A FTP Commands
  707.  
  708.     FTP commands are ASCII terminated by the ASCII
  709. character sequence CRLF (Carriage Return follow by Line Feed).  The
  710. command codes themselves are ASCII alpabetic characters terminated by
  711. the ASCII character 'space' (code = 32.). For convenience, the command
  712. codes are defined to be four (or less) ASCII alphanumeric characters
  713. (including both upper and lower case alphabetic characters). The command
  714. codes and the semantics of commands are described in this section, but
  715. the detailed syntax of commands is specified in Section V.b, the reply
  716. sequence are discussed in Section V.C, and scenarios illustrating the
  717. use of commands are provided in Section V.D.
  718.  
  719.     FTP commands may be partitioned as those specifying
  720. access-control identifiers, data transfer parameters, or FTP service
  721. requests.
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.                                                                [Page 13]
  731.  
  732. The File Transfer Protocol                                  July 8, 1972
  733.  
  734.  
  735. IV.A.1 Access Control Commands
  736.  
  737. The following commands specify access control identifiers
  738.        (command codes are shown in parentheses).
  739.  
  740.        User name (USER) - The argument field is an ASCII string
  741.        identifying the user. The user identification is that wich is
  742.        required by the server for access to its file system. This
  743.        command will normally be the first command transmitted by the
  744.        user after the TELNET connections are made (some servers may
  745.        require this). Additional identification information in the form
  746.        of pasword command may also be required by some servers.
  747.  
  748.        Password (PASS) - The argument field is an ASCII string
  749.        identifying the user's password. This command must be immediately
  750.        preceded by the user name command, and together it completes the
  751.        user's identifecation for access control.
  752.  
  753. IV.A.2 Data Transfer Commands
  754.  
  755.        All data transfer parameters have default values, and the
  756.        commands specifying data transfer parameters are required only if
  757.        the default parameter values are to be changed.  The default
  758.        value is teh last specified value, or if no value has been
  759.        specified, the standard default value specified here. This
  760.        implies that the server must "remember" the applicable default
  761.        values. The commands may be in any order except that they must
  762.        precede the FTP service request. The following commands specify
  763.        data transfer parameters.
  764.  
  765.        Byte size (BYTE) - The argument is an ASCII-represented decimal
  766.        integer (1 through 255), specifying the byte size for the data
  767.        connection for local byte and image representation types. The
  768.        default byte size is 8 bits.  The byte size is always 8 bits in
  769.        the ASCII and Print file representation types. A server may
  770.        reject specific byte size/type combinations by sending an
  771.        appropriate reply.
  772.  
  773.        Data socket (SOCK) - The argument is a HOST-socket specification
  774.        for the data socket to be used in data connection. There may be
  775.        two data sockets, one from server to user and the other for user
  776.        to server data transfer. An odd socket number defines a send
  777.        socket and an even socket number defines a receive socket. The
  778.        default HOST is the user HOST to which TELNET connections are
  779.        made. The default data sockets are (U+4) and (U+5) where U is the
  780.        socket number used in the TELNET ICP and the TELNET connections
  781.        are on sockets (U+2) and (U+3).
  782.  
  783.  
  784.  
  785.  
  786.                                                                [Page 14]
  787.  
  788. The File Transfer Protocol                                  July 8, 1972
  789.  
  790.  
  791.        Representation Type (TYPE) - The argument is a single ASCII
  792.        character code specifying the representation types described in
  793.        section III.B. The following codes are assigned for type:
  794.  
  795.           A - ASCII
  796.           I - Image
  797.           L - Local Byte
  798.           P - Print file in ASCII
  799.           E - EBCDIC print file
  800.  
  801.        The default representation type is ASCII
  802.  
  803.        File Structure (STRU) - The argument is a single ASCII character
  804.        code specifying file structure described in section III.C. The
  805.        following codes are assigned for structure:
  806.  
  807.           F - File (no record structure)
  808.           R - Record structure
  809.  
  810.        The default structure is File (i.e., no records).
  811.  
  812.        Transfer Mode (MODE) - The argument is a single ASCII character
  813.        code specifying the data transfer modes described in Section
  814.        III.C. The following codes are assigned for transfer modes:
  815.  
  816.           S - Stream (bytes, close is EOF)
  817.           B - Block (Header with descriptor and count)
  818.           T - Text (TELNET control mode for EOR, EOF)
  819.           H - Hasp (specially formatted compressed data)
  820.  
  821.        The default transfer mode is Stream.
  822.  
  823. IV.A.3 FTP Service Commands.
  824.  
  825.        The FTP service commands define the file transfer or the file
  826.        system function requested by the user. The argument of an FTP
  827.        service command will normally be a pathname.  the syntax of
  828.        pathnames must conform to server site conventions (with standard
  829.        defaults applicable), except that ASCII characters must be used
  830.        (in conformance with the TELNET Protool). The suggested default
  831.        handling is to use the last specified device directory or file
  832.        name, or the standard default defined for local users. The
  833.        commands may be in any order except that a "rename from" command,
  834.        must be followed by a "rename to" command, and some servers may
  835.        require an "allocate" command before a "store" command. The data
  836.        when transferred in response to FTP service commands shall always
  837.        be over the data connection. The following commands specify FTP
  838.        service requests:
  839.  
  840.  
  841.  
  842.                                                                [Page 15]
  843.  
  844. The File Transfer Protocol                                  July 8, 1972
  845.  
  846.  
  847.        Retrieve (RETR) - This command achieves the transfer of a copy of
  848.        file specified in pathname, from server to user site. The status
  849.        and contents of a file at server site shall be unaffected.
  850.  
  851.        Store (STOR) - This command achieves the transfer of a copy of
  852.        file from user to server site. If file specified in pathname
  853.        exists at the server site, then its contents shall be replaced by
  854.        the contents of the file being transferred. A new file is created
  855.        at the server site if the file specified in pathname does not
  856.        already exist.
  857.  
  858.        Append (with create) (APPE) - This command achieves the transfer
  859.        of data from using to serving site. If file specified in pathname
  860.        exists at the server site, then the data transferred shall be
  861.        appended to that file, otherwise the file specified in pathname
  862.        shall be created at the server site.
  863.  
  864.        Rename from (RNFR) - This command specifies the file which is to
  865.        be renamed. This command must be immediately followed by a
  866.        "rename to" command specifying the new file pathname.
  867.  
  868.        Delete (DELE) - This command causes teh file specified in
  869.        pathname to be deleted at the server site. If an extra level of
  870.        protection is desired (such as the query, "Do you really wish to
  871.        delete?"), it should be provided by the user-FTP process.
  872.  
  873.        List (LIST) - This command causes a list to be sent from server
  874.        to user site. If pathname specifies a directory, the server
  875.        should transfer a list of files in the specified directory. If
  876.        pathname specifies a file then server should send current
  877.        information on the file. This command may be used to obtain the
  878.        contents of a file directory (the response should be sent in
  879.        ASCII type) or test the existence of a file and its current
  880.        status.
  881.  
  882.        Allocate (ALLO) - This command my be required by some servers to
  883.        reserve sufficient storage to accomodate the new file to be
  884.        transferred. The command field shall be a decimal integer
  885.        representing the number of bytes (of size specified by the byte
  886.        size command) of storage to be reserved for the file. This
  887.        command shall be followed by a store or append command. The ALLO
  888.        command should be treated as a NO-OP (no operation) by thuse
  889.        servers which do not require that the maximum size of the file be
  890.        declared beforehand.
  891.  
  892.        Restart (REST) - The argument field represents the server marker
  893.        at which file transfer is to be restarted. This command does not
  894.        cause file transfer but "spaces" over the file to the specified
  895.  
  896.  
  897.  
  898.                                                                [Page 16]
  899.  
  900. The File Transfer Protocol                                  July 8, 1972
  901.  
  902.  
  903.        data checkpoint. This command shall be immediately followed by
  904.        the appropriate FTP service command which shall cause file
  905.        transfer to resume.
  906.  
  907.        Status (STAT) - This command shall cause a status response to be
  908.        sent over the TELNET connection in form of a reply.  The command
  909.        may have an argument field such as a pathname.  if the argument
  910.        is a pathname, the command is analogous to the "list" command
  911.        except that data shall be transferred in ASCII on the TELNET
  912.        connection. If no argument is specified, the server should return
  913.        general status information about the server FTP process. This may
  914.        include service availability, the current settings for the
  915.        relevant FTP parameters (including default settings), and the
  916.        status of command execution and connections.
  917.  
  918.        Abort (ABOR) - This command indicates to the server to abort the
  919.        previous FTP service command and any associated transfer of data.
  920.        The abort command should be preceded by the TELNET SYNCH
  921.        condition (indicated by the combination of the DATA MARK and the
  922.        INS). No action is to be taken if the previous command has been
  923.        completed (including data transfer). The TELNET connections is
  924.        not to be closed by the server, but the data connection may be
  925.        closed. An appropriate reply should be sent by the server.
  926.  
  927.        Logout (BYE) - This command terminates a USER and if file
  928.        transfer is not in progress, closes the TELNET connection.  If
  929.        file transfer is in progress, the connection will remain open for
  930.        result response and will then close.  During the interim a new
  931.        USER command (and no other command) is acceptable.
  932.  
  933.        An unexpected close on TELNET connection will cause the server to
  934.        take the effective action of an abort (ABOR) and a logout (BYE).
  935.  
  936. IV.B FTP Replies
  937.  
  938.     The server sends FTP replies to user over the TELNET
  939. connections in response to FTP commands. The FTP replies constitute the
  940. acknowledgement or completion code (including errors). The FTP-server
  941. replies are formatted for human or program interpretation. The replies
  942. consist of a leading three digit numeric code followed by a space
  943. followed by a text explanation of the code. The numeric codes are
  944. assigned by groups and for ease of interpretation by programs in a
  945. manner consistent with other protocols such as the RJE protocol. The
  946. three digits of the code are to be interpredet as follows:
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.                                                                [Page 17]
  955.  
  956. The File Transfer Protocol                                  July 8, 1972
  957.  
  958.  
  959. a) The first digit specifies type of response as indicated below:
  960.  
  961.    000 These replies are purely informative and constitute
  962.        neither a positive nor a negative acknowledgement.
  963.  
  964.    1xx informative replies to status inrequiries. These constitute
  965.        a positive acknowledgment to the status command.
  966.  
  967.    2xx Positive acknowledgment of previous command or other
  968.        successful action.
  969.  
  970.    3xx Incomplete information. Activity cannot proceed without
  971.        further specification and input.
  972.  
  973.    4xx Unsuccessful reply. The request is correctly specified
  974.        but the server is unsuccessful in corretly fulfilling
  975.        it.
  976.  
  977.    5xx Incorrect or illegal command. The command or its
  978.        parameters were invalid or incomplete from a syntactic
  979.        viewpoint, or the command its inconsistent with a previous
  980.        command. The command in question has been completely
  981.        ignored.
  982.  
  983.    6xx - 9xx Reserved for future expansion.
  984.  
  985. b) The second digit specifies the general category to which
  986.    the response refers:
  987.  
  988.    x00-x29 General purpose replies, not assignable to other
  989.        categories.
  990.  
  991.    x30 Primary access. Informative replies to the "log-on"
  992.        attempt.
  993.  
  994.    x40 Secondary access. The primary server is commenting on its
  995.        ability to access a secondary service.
  996.  
  997.    x5x FTP results.
  998.  
  999.    x6x RJE resutls.
  1000.  
  1001.    x7x-x9x Reserved for future expansion.
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.                                                                [Page 18]
  1011.  
  1012. The File Transfer Protocol                                  July 8, 1972
  1013.  
  1014.  
  1015. c) the final digit specifies a particular message type. Since the code
  1016. is designed for an automaton process to interpret, it is not necessary
  1017. for every variation of a reply to have a unique number. Only the basic
  1018. meaning of replies need have unique numbers. The text of a reply can
  1019. explain the specific reason for that reply to a human user.
  1020.  
  1021.     Each TELNET line (ended by CRLF) from the server is intended
  1022. to be a complete reply message. if it is necessary to continue the text
  1023. of a reply onto following lines, then those continuation replies contain
  1024. the special reply code of three spaces. It should be noted that text of
  1025. replies are intended for a human user. Only the reply codes and in some
  1026. instances the first line of text are intended for programs.
  1027.  
  1028.     The assigned reply codes relating to FTP are:
  1029.  
  1030. 000 General information message (site, time of day, etc.)
  1031. 030 Server availibility information.
  1032. 050 FTP commentary or user information.
  1033. 100 System status reply.
  1034. 150 File status reply.
  1035. 151 Directory listing reply.
  1036. 200 Last command received correctly.
  1037. 201 An ABORT has terminated activity, as requested.
  1038. 202 Abort request ignored, no activity in progress.
  1039. 230 User is "logged in". may proceed.
  1040. 231 User is "logged out". Service terminated.
  1041. 232 Logout command noted, will complete when transfer done.
  1042. 250 FTP file transfer started correctly.
  1043. 251 FTP Restart-marker reply
  1044.           Text is: MARK yyyy  =  mmmm
  1045.           where yyyy is user's data stream marker (yours)
  1046.           and mmmm is server's equivalent marker (mine)
  1047.           (Note the spaces between the markers and '=').
  1048. 252 FTP transfer completed correctly.
  1049. 253 Rename completed.
  1050. 254 Delete completed.
  1051. 255 FTP server data socket reply
  1052.           Text is: SOCK nnnn
  1053.           where nnnn is decimal integer representing
  1054.           the server socket for data connection.
  1055. 300 Connection greeting message, awaiting input.
  1056. 301 Current command incomplete (no CRLF for long time).
  1057. 330 Enter password (may be sent with hide-your-input).
  1058. 400 This service not implemented.
  1059. 401 This service not accepting users now, goodbye.
  1060. 430 Log-on time or tries exceeded, goodbye.
  1061. 431 Log-on unsuccessful. User and/or password invalid.
  1062. 432 User not valid for this service.
  1063.  
  1064.  
  1065.  
  1066.                                                                [Page 19]
  1067.  
  1068. The File Transfer Protocol                                  July 8, 1972
  1069.  
  1070.  
  1071. 434 Log-out forced by operator action. Phone site.
  1072. 435 Log-out forced by system problem.
  1073. 436 Service shutting down, goodbye.
  1074. 450 FTP: File not found.
  1075. 451 FTP: File access denied to you.
  1076. 452 FTP: File transfer incomplete, data connection closed.
  1077. 453 FTP: File transfer incomplete, insufficient storage space.
  1078. 500 Last command line completely unrecognized.
  1079. 501 Syntax of last command in incorrect.
  1080. 502 Last command incomplete, parameters missing.
  1081. 503 Last command invalid (ignored), illegal parameter combination.
  1082. 504 Last command invalid, action not possible at this time.
  1083. 505 Last command conflicts illegally with previous command(s).
  1084. 506 Requested action not implemented by the server.
  1085.  
  1086. V. DECLARATIVE SPECIFICATIONS
  1087.  
  1088. V.A. Connections
  1089.  
  1090.     The server-FTP process at the server site shall "listen" on
  1091. Socket 3, via its server-TELNET. The user or user-FTP process at the
  1092. user site shall initiate the full-duplex TELNET connections via its
  1093. user-TELNET performing the ARPANET standard initial connection protocol
  1094. (ICP) to server socket 3. The TELNET connections shall be closed by the
  1095. user site upon completion of use.
  1096.  
  1097.     The user site shall "listen" on the specified data socket or
  1098. sockets (a send and/or a receive socket). The server site shall initiate
  1099. the data connection using the specified data socket and byte size. The
  1100. direction of data connection and the data socket used shall be
  1101. determined by the FTP service command. The server shall send a reply to
  1102. the user indicating the server data socket so that the user may ensure
  1103. the security of data transfer. This can be done at any time prior to the
  1104. first transfer of data over a data connection.
  1105.  
  1106.     The data connection shall be closed by the server site under
  1107. the conditions described is Section III.A. The server should in general
  1108. send a reply before closing the data connection to avoid problems at the
  1109. user end.
  1110.  
  1111. V.B. Commands
  1112.  
  1113.     The commands are ASCII character strings transmitted over
  1114. the TELNET connections as described in section IV.A. The command
  1115. functions and semantics are described in sections IV.A.1, IV.A.2,
  1116. IV.A,3, and IV.A.4. The command syntax is specified here.
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.                                                                [Page 20]
  1123.  
  1124. The File Transfer Protocol                                  July 8, 1972
  1125.  
  1126.  
  1127.     The commands begin with a command code followed by an
  1128. argument field. The command codes are four of less ASCII alphabetic
  1129. characters. Upper and lower case alphabetic characters are to be treated
  1130. identically. Thus any of the following may represent the retrieve
  1131. command:
  1132.  
  1133.     RETR Retr retr ReTr rETr
  1134.  
  1135. The command codes and the argument fields are separated by one or more
  1136. spaces.
  1137.  
  1138.     The argument field consists of a variable length ASCII
  1139. character string ending with the character sequence CRLF (Carriage
  1140. Return immediately followed by Line Feed). In the following section on
  1141. syntax it should be stressed that all characters in the argument field
  1142. are ASCII characters. Thus a decimal integer shall mean an ASCII
  1143. represented decimal integer.
  1144.  
  1145.     The following are all the currently defined FTP commands:
  1146.  
  1147.          USER <user name> CRLF
  1148.          PASS <password> CRLF
  1149.          BYTE <byte size> CRLF
  1150.          SOCK <HOST-socket> CRLF
  1151.          TYPE <type code> CRLF
  1152.          STRU <structure code> CRLF
  1153.          MODE <mode code> CRLF
  1154.          RETR <pathname> CRLF
  1155.          STOR <pathname> CRLF
  1156.          APPE <pathname> CRLF
  1157.          RNFR <pathname> CRLF
  1158.          RNTO <pathname> CRLF
  1159.          DELE <pathname> CRLF
  1160.          LIST <pathname> CRLF
  1161.          ALLO <decimal integer> CRLF
  1162.          REST <marker> CRLF
  1163.          STAT <pathname> CRLF
  1164.          ABOR <empty> CRLF
  1165.           Bye <empty> CRLF
  1166.  
  1167.     The syntax of the above argument fields (using BNF notation
  1168. where aplicable) is:
  1169.  
  1170.      <username> ::= <string>
  1171.      <password> ::= <string>
  1172.      <string> ::= <empty> | <char> | <char><string>
  1173.      <char> ::= any of the 128 ASCII characters except CR and LF.
  1174.      <marker> ::= <pr string>
  1175.  
  1176.  
  1177.  
  1178.                                                                [Page 21]
  1179.  
  1180. The File Transfer Protocol                                  July 8, 1972
  1181.  
  1182.  
  1183.      <pr string> ::= <empty> | <pr char> | <pr char><pr string>
  1184.      <pr char> ::= any ASCII code 33 through 126.
  1185.      <byte size> ::= any decimal integer 1 through 255.
  1186.      <HOST-socket> ::= <socket> | <HOST number>,<socket>
  1187.      <HOST number> ::= a decimal integer specifying an ARPANET HOST.
  1188.      <socket> ::= decimal integer between o and (2**32)-1
  1189.      <type code> ::= A|I|L|P|E
  1190.      <structure code> ::= F|R
  1191.      <mode code> ::= S|B|T|H
  1192.      <pathname> ::= <string>
  1193.      <decimal integer> ::= <digit> | <digit><decimal integer>
  1194.      <digit> ::= 0|1|2|3|4|5|6|7|8|9|
  1195.      <empty> ::= the null string (specifies use of default).
  1196.  
  1197. V.C Sequencing of Commands and Replies
  1198.  
  1199.     The communication between the user and server is intended to
  1200. be an alternating dialogue. As such, the user issues an FTP
  1201. command and the server responds with a prompt primary reply. The
  1202. user should wait for this initial primary success of failure
  1203. response before sending further commands.
  1204.  
  1205.     A second type of reply is sent asynchronously with respect
  1206. to user commands. These replies may for example report on the
  1207. progress or completion of file transfer and as such are secondary
  1208. replies to file transfer commands.
  1209.  
  1210.     The third class of replies are informational and spontaneous
  1211. replies which may arrive at any time. These replies are listed
  1212. below as spontaneous.
  1213.  
  1214.                COMMAND-REPLY CORRESPONDENCE TABLE
  1215.  
  1216. COMMAND             SUCCESS              FAIL
  1217.  
  1218. USER                230,330              430-432,500-505
  1219. PASS                230                  430-432,500-505
  1220. BYE                 231,232              430-432,500-505
  1221. BYTE                200                  500-506
  1222. SOCK                200                  500-506
  1223. TYPE                200                  500-506
  1224. MODE                200                  500-506
  1225. RETR                250                  450,451,500-506
  1226.   Secondary Reply   252                  452
  1227. STOR                250                  451,451,500-506
  1228.   Secondary Reply   252                  452,453
  1229. APPE                250                  451,451,500-506
  1230.   Secondary Reply   252                  452,453
  1231.  
  1232.  
  1233.  
  1234.                                                                [Page 22]
  1235.  
  1236. The File Transfer Protocol                                  July 8, 1972
  1237.  
  1238.  
  1239. RNFR                200                  450,451,500-506
  1240. RNTO                253                  450,451,500-505
  1241. DELE                254                  450,451,500-506
  1242. LIST                250                  450,453,500-506
  1243.   Secondary Reply   252                  452
  1244. ALLO                200                  500-506
  1245. STAT                100,150,151          450,451,500-506
  1246. REST                200                  500-506
  1247. ABOR                201,202              500-505
  1248.  
  1249. Spontaneous         0xx,300,301          400,401,434-436
  1250. Replies             251,255
  1251.  
  1252. V.D. Tyical FTP Scenarious
  1253.  
  1254. 1. TIP User wanting o transfer file from FOST X to local printer:
  1255.  
  1256.    a) TIP user opens TELNET connections by ICP to HOST X, socket 3.
  1257.  
  1258.    b) The following commands and replies are exchanged:
  1259.           TIP                           HOST X
  1260.  
  1261.           USER username CRLF  -------->
  1262.           <-------  330 Enter Password CRLF
  1263.  
  1264.           PASS password CRLF  -------->
  1265.           <-------  230 User logged in CRLF
  1266.  
  1267.           SOCK 65538 CRLF     -------->
  1268.           <-------  200 Command received OK CRLF
  1269.  
  1270.           RETR this.file CRLF -------->
  1271.           <-------  255 SOCK 5533 CRLF
  1272.  
  1273.           (HOST X initiates data connection to
  1274.            TIP socket 65538, i.e., PORT 1 receive)
  1275.  
  1276.           <------- 250 File transfer started
  1277.  
  1278.           BYE CRLF           ------_->
  1279.           <------- 252 File transfer completed
  1280.  
  1281.    c) HOST X closes the TELNET and data connections.
  1282.  
  1283.    Note: The TIP user should be in line mode and can thus use
  1284.          local TIP editing such as character delete.
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.                                                                [Page 23]
  1291.  
  1292. The File Transfer Protocol                                  July 8, 1972
  1293.  
  1294.  
  1295. 2. User at Host U wanting to transfer files to/from HOST S:
  1296.  
  1297.      In general the user would communicate to the server via a
  1298.    mediating user-FTP process. The following may be a typical
  1299.    scenario. The user-FTP prompts are shown in parenthesis,
  1300.    '---->' represents commands from HOST U to HOST S, and
  1301.    '<----' represents replies from HOST S to HOST U.
  1302.  
  1303. Local Commands by User                  Action Involved
  1304.  
  1305. ftp (host) multics CR         ICP to HOST S, socket 3,
  1306.                               establishing TELNET connections.
  1307. username Doe CR               USER DoeCRLF ---->
  1308.                               <---- 330 passwordCRLF
  1309. password mumble CR            PASS mumbleCRLF ---->
  1310.                               <---- 230 Doe logged in.CRLF
  1311. retrieve (local type ASCIICR
  1312. (local pathname) test 1 CR    USER-FTP open local file in ASCII.
  1313. (for. pathname) test.pl1CR    RETR test.pl1 CRLF ---->
  1314.                               <---- 255 SOCK 1233CRLF
  1315.                               Server makes data connection to (U+4).
  1316.                               <---- 250 File transfer startsCRLF
  1317.                               <---- 252 File transfer completeCRLF
  1318. type imageCR                  TYPE |CRLF ---->
  1319.                               <---- 200 Command OKCRLF
  1320. byte 36CR                     BYTE 36CRLF ---->
  1321.                               <---- 200 Command OKCRLF
  1322. store (local type) ImageCR
  1323. (local pathname) file dumpCR  User-FTP opens local file in Image.
  1324. (for. pathname) >udd>cn>fdCR  STOR >udd>cn>fdCRLF ---->
  1325.                               <---- 451 Access deniedCRLF
  1326. terminate                     BYECRLF
  1327.                               <---- 231 Doe logged outCRLF
  1328.                               Server closes all connections.
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.                                                                [Page 24]
  1347.  
  1348. The File Transfer Protocol                                  July 8, 1972
  1349.  
  1350.  
  1351. ACKNOWLEDGEMENTS
  1352.  
  1353.     The work on file transfer protocol has involved many people.
  1354. This document reports the work of a group rather than the author
  1355. alone. The author gratefully acknowledges the conributions of
  1356. the following:
  1357.  
  1358.           Bob Braden         UCLA-CCCN
  1359.           Arvola Chan        MIT-MAC
  1360.           Bill Crowther      BBN-TIP
  1361.           Eric Harslem       RAND
  1362.           John Heafner       RAND
  1363.           Chuck Holland      UCSD
  1364.           Alex McKenzie      BBN (NET)
  1365.           Bob Metcalfe       XPARC
  1366.           Jon Postel         UCLA
  1367.           Neal Ryan          MIT-MAC
  1368.           Bob Sundberg       HARVARD
  1369.           Ray Tomlinson      BBN (TENEX)
  1370.           Dick Watson        SRI-ARC
  1371.           Jim White          SRI-ARC
  1372.           Richard Winter     CCA
  1373.  
  1374.  
  1375.        [ This RFC was put into machine readable form for entry ]
  1376.        [ into the online RFC archives by Gottfried Janik 9/97  ]
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395.  
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402.                                                                [Page 25]
  1403.  
  1404.