vivisun 发表于 2005-10-10 05:32:04


<P><a href="" target="_blank" >RFC</A><U>959</U> October 1985<BR>File Transfer Protocol<BR><BR>150 File status okay; about to open data connection.<BR>250 Requested file action okay, completed.<BR>257 "PATHNAME" created.<BR>350 Requested file action pending further information.<BR>450 Requested file action not taken.<BR>File unavailable (e.g., file busy).<BR>550 Requested action not taken.<BR>File unavailable (e.g., file not found, no access).<BR>451 Requested action aborted. Local error in processing.<BR>551 Requested action aborted. Page type unknown.<BR>452 Requested action not taken.<BR>Insufficient storage space in system.<BR>552 Requested file action aborted.<BR>Exceeded storage allocation (for current directory or<BR>dataset).<BR>553 Requested action not taken.<BR>File name not allowed.<BR><BR><st1:chsdate w:st="on" IsROCDate="False" IsLunarDate="False" Day="30" Month="12" Year="1899">4.2.2</st1:chsdate> Numeric Order List of Reply Codes<BR><BR>110 Restart marker reply.<BR>In this case, the text is exact and not left to the<BR>particular implementation; it must read:<BR>MARK yyyy = mmmm<BR>Where yyyy is User-process data stream marker, and mmmm<BR>server's equivalent marker (note the spaces between markers<BR>and "=").<BR>120 Service ready in nnn minutes.<BR>125 Data connection already open; transfer starting.<BR>150 File status okay; about to open data connection.<BR><BR><U><a href="" target="_blank" >RFC</A>959</U> October 1985<BR>File Transfer Protocol<BR><BR>200 Command okay.<BR>202 Command not implemented, superfluous at this site.<BR>211 System status, or system help reply.<BR>212 Directory status.<BR>213 File status.<BR>214 Help message.<BR>On how to use the server or the meaning of a particular<BR>non-standard command. This reply is useful only to the<BR>human user.<BR>215 NAME system type.<BR>Where NAME is an official system name from the list in the<BR>Assigned Numbers document.<BR>220 Service ready for new user.<BR>221 Service closing control connection.<BR>Logged out if appropriate.<BR>225 Data connection open; no transfer in progress.<BR>226 Closing data connection.<BR>Requested file action successful (for example, file<BR>transfer or file abort).<BR>227 Entering Passive Mode (h1,h2,h3,h4,p1,p2).<BR>230 User logged in, proceed.<BR>250 Requested file action okay, completed.<BR>257 "PATHNAME" created.<BR><BR>331 User name okay, need password.<BR>332 Need account for login.<BR>350 Requested file action pending further information.<BR><BR>421 Service not available, closing control connection.<BR>This may be a reply to any command if the service knows it<BR>must shut down.<BR>425 Can't open data connection.<BR>426 Connection closed; transfer aborted.<BR>450 Requested file action not taken.<BR>File unavailable (e.g., file busy).<BR>451 Requested action aborted: local error in processing.<BR>452 Requested action not taken.<BR>Insufficient storage space in system.<BR><BR><U><a href="" target="_blank" >RFC</A>959</U> October 1985<BR>File Transfer Protocol<BR><BR>500 Syntax error, command unrecognized.<BR>This may include errors such as command line too long.<BR>501 Syntax error in parameters or arguments.<BR>502 Command not implemented.<BR>503 Bad sequence of commands.<BR>504 Command not implemented for that parameter.<BR>530 Not logged in.<BR>532 Need account for storing files.<BR>550 Requested action not taken.<BR>File unavailable (e.g., file not found, no access).<BR>551 Requested action aborted: page type unknown.<BR>552 Requested file action aborted.<BR>Exceeded storage allocation (for current directory or<BR>dataset).<BR>553 Requested action not taken.<BR>File name not allowed.<BR><BR>5. DECLARATIVE SPECIFICATIONS<BR><BR>5.1. MINIMUM IMPLEMENTATION<BR><BR>In order to make <a href="" target="_blank" >FTP</A> workable without needless error messages, the<BR>following minimum implementation is required for all servers:<BR><BR>TYPE - ASCII Non-print<BR>MODE - Stream<BR>STRUCTURE - File, Record<BR>COMMANDS - USER, QUIT, PORT,<BR>TYPE, MODE, STRU,<BR>for the default values<BR>RETR, STOR,<BR>NOOP.<BR><BR>The default values for transfer parameters are:<BR><BR>TYPE - ASCII Non-print<BR>MODE - Stream<BR>STRU - File<BR><BR>All hosts must accept the above as the standard defaults.<BR><BR><U><a href="" target="_blank" >RFC</A>959</U> October 1985<BR>File Transfer Protocol<BR><BR>5.2. CONNECTIONS<BR><BR>The server protocol interpreter shall "listen" on Port L. The<BR>user or user protocol interpreter shall initiate the full-duplex<BR>control connection. Server- and user- processes should follow the<BR>conventions of the Telnet protocol as specified in the<BR>ARPA-Internet Protocol Handbook . Servers are under no<BR>obligation to provide for editing of command lines and may require<BR>that it be done in the user host. The control connection shall be<BR>closed by the server at the user's request after all transfers and<BR>replies are completed.<BR><BR>The user-DTP must "listen" on the specified data port; this may be<BR>the default user port (U) or a port specified in the PORT command.<BR ><BR ></P>

vivisun 发表于 2005-10-10 05:32:44

The server shall initiate the data connection from his own default<BR>data port (L-1) using the specified user data port. The direction<BR>of the transfer and the port used will be determined by the <a href="" target="_blank" >FTP</A><BR>service command.<BR><BR>Note that all <a href="" target="_blank" >FTP</A> implementation must support data transfer using<BR>the default port, and that only the USER-PI may initiate the use<BR>of non-default ports.<BR><BR>When data is to be transferred between two servers, A and B (refer<BR>to Figure 2), the user-PI, C, sets up control connections with<BR>both server-PI's. One of the servers, say A, is then sent a PASV<BR>command telling him to "listen" on his data port rather than<BR>initiate a connection when he receives a transfer service command.<BR>When the user-PI receives an acknowledgment to the PASV command,<BR>which includes the identity of the host and port being listened<BR>on, the user-PI then sends A's port, a, to B in a PORT command; a<BR>reply is returned. The user-PI may then send the corresponding<BR>service commands to A and B. Server B initiates the connection<BR>and the transfer proceeds. The command-reply sequence is listed<BR>below where the messages are vertically synchronous but<BR>horizontally asynchronous:<BR><BR><U><a href="" target="_blank" >RFC</A>959</U> October 1985<BR>File Transfer Protocol<BR><BR>User-PI - Server A User-PI - Server B<BR>------------------ ------------------<BR><BR>C-&gt;A : Connect C-&gt;B : Connect<BR>C-&gt;A : PASV<BR>A-&gt;C : 227 Entering Passive Mode. A1,A2,A3,A4,a1,a<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="2" UnitName="C">2<BR></st1:chmetcnv>C-&gt;B : PORT A1,A2,A3,A4,a1,a2<BR>B-&gt;C : 200 Okay<BR>C-&gt;A : STOR C-&gt;B : RETR<BR>B-&gt;A : Connect to HOST-A, PORT-a<BR><BR>Figure 3<BR><BR>The data connection shall be closed by the server under the<BR>conditions described in the Section on Establishing Data<BR>Connections. If the data connection is to be closed following a<BR>data transfer where closing the connection is not required to<BR>indicate the end-of-file, the server must do so immediately.<BR>Waiting until after a new transfer command is not permitted<BR>because the user-process will have already tested the data<BR>connection to see if it needs to do a "listen"; (remember that the<BR>user must "listen" on a closed data port BEFORE sending the<BR>transfer request). To prevent a race condition here, the server<BR>sends a reply (226) after closing the data connection (or if the<BR>connection is left open, a "file transfer completed" reply (250)<BR>and the user-PI should wait for one of these replies before<BR>issuing a new transfer command).<BR><BR>Any time either the user or server see that the connection is<BR>being closed by the other side, it should promptly read any<BR>remaining data queued on the connection and issue the close on its<BR>own side.<BR><BR>5.3. COMMANDS<BR><BR>The commands are Telnet character strings transmitted over the<BR>control connections as described in the Section on <a href="" target="_blank" >FTP</A> Commands.<BR>The command functions and semantics are described in the Section<BR>on Access Control Commands, Transfer Parameter Commands, <a href="" target="_blank" >FTP</A><BR>Service Commands, and Miscellaneous Commands. The command syntax<BR>is specified here.<BR><BR>The commands begin with a command code followed by an argument<BR>field. The command codes are four or fewer alphabetic characters.<BR>Upper and lower case alphabetic characters are to be treated<BR>identically. Thus, any of the following may represent the<BR>retrieve command:<BR><BR><U><a href="" target="_blank" >RFC</A>959</U> October 1985<BR>File Transfer Protocol<BR><BR>RETR Retr retr ReTr rETr<BR><BR>This also applies to any symbols representing parameter values,<BR>such as A or a for ASCII TYPE. The command codes and the argument<BR>fields are separated by one or more spaces.<BR><BR>The argument field consists of a variable length character string<BR>ending with the character sequence &lt;CRLF&gt; (Carriage Return, Line<BR>Feed) for NVT-ASCII representation; for other negotiated languages<BR>a different end of line character might be used. It should be<BR>noted that the server is to take no action until the end of line<BR>code is received.<BR><BR>The syntax is specified below in NVT-ASCII. All characters in the<BR>argument field are ASCII characters including any ASCII<BR>represented decimal integers. Square brackets denote an optional<BR>argument field. If the option is not taken, the appropriate<BR>default is implied.<BR><BR><U><a href="" target="_blank" >RFC</A>959</U> October 1985<BR>File Transfer Protocol<BR><BR>5.3.1. <a href="" target="_blank" >FTP</A> COMMANDS<BR><BR>The following are the <a href="" target="_blank" >FTP</A> commands:<BR><BR>USER &lt;SP&gt; &lt;username&gt; &lt;CRLF&gt;<BR>PASS &lt;SP&gt; &lt;password&gt; &lt;CRLF&gt;<BR>ACCT &lt;SP&gt; &lt;account-information&gt; &lt;CRLF&gt;<BR>CWD &lt;SP&gt; &lt;pathname&gt; &lt;CRLF&gt;<BR>CDUP &lt;CRLF&gt;<BR>SMNT &lt;SP&gt; &lt;pathname&gt; &lt;CRLF&gt;<BR>QUIT &lt;CRLF&gt;<BR>REIN &lt;CRLF&gt;<BR>PORT &lt;SP&gt; &lt;host-port&gt; &lt;CRLF&gt;<BR>PASV &lt;CRLF&gt;<BR>TYPE &lt;SP&gt; &lt;type-code&gt; &lt;CRLF&gt;<BR>STRU &lt;SP&gt; &lt;structure-code&gt; &lt;CRLF&gt;<BR>MODE &lt;SP&gt; &lt;mode-code&gt; &lt;CRLF&gt;<BR>RETR &lt;SP&gt; &lt;pathname&gt; &lt;CRLF&gt;<BR>STOR &lt;SP&gt; &lt;pathname&gt; &lt;CRLF&gt;<BR>STOU &lt;CRLF&gt;<BR>APPE &lt;SP&gt; &lt;pathname&gt; &lt;CRLF&gt;<BR>ALLO &lt;SP&gt; &lt;decimal-integer&gt;<BR>[&lt;SP&gt; R &lt;SP&gt; &lt;decimal-integer&gt;] &lt;CRLF&gt;<BR>REST &lt;SP&gt; &lt;marker&gt; &lt;CRLF&gt;<BR>RNFR &lt;SP&gt; &lt;pathname&gt; &lt;CRLF&gt;<BR>RNTO &lt;SP&gt; &lt;pathname&gt; &lt;CRLF&gt;<BR>ABOR &lt;CRLF&gt;<BR>DELE &lt;SP&gt; &lt;pathname&gt; &lt;CRLF&gt;<BR>RMD &lt;SP&gt; &lt;pathname&gt; &lt;CRLF&gt;<BR>MKD &lt;SP&gt; &lt;pathname&gt; &lt;CRLF&gt;<BR>PWD &lt;CRLF&gt;<BR>LIST [&lt;SP&gt; &lt;pathname&gt;] &lt;CRLF&gt;<BR>NLST [&lt;SP&gt; &lt;pathname&gt;] &lt;CRLF&gt;<BR>SITE &lt;SP&gt; &lt;string&gt; &lt;CRLF&gt;<BR>SYST &lt;CRLF&gt;<BR>STAT [&lt;SP&gt; &lt;pathname&gt;] &lt;CRLF&gt;<BR>HELP [&lt;SP&gt; &lt;string&gt;] &lt;CRLF&gt;<BR>NOOP &lt;CRLF&gt;

vivisun 发表于 2005-10-10 05:33:15

<a href="" target="_blank" >RFC</A><U>959</U> October 1985<BR>File Transfer Protocol<BR><BR>5.3.2. <a href="" target="_blank" >FTP</A> COMMAND ARGUMENTS<BR><BR>The syntax of the above argument fields (using BNF notation<BR>where applicable) is:<BR><BR>&lt;username&gt; ::= &lt;string&gt;<BR>&lt;password&gt; ::= &lt;string&gt;<BR>&lt;account-information&gt; ::= &lt;string&gt;<BR>&lt;string&gt; ::= &lt;char&gt; | &lt;char&gt;&lt;string&gt;<BR>&lt;char&gt; ::= any of the 128 ASCII characters except &lt;CR&gt; and<BR>&lt;LF&gt;<BR>&lt;marker&gt; ::= &lt;pr-string&gt;<BR>&lt;pr-string&gt; ::= &lt;pr-char&gt; | &lt;pr-char&gt;&lt;pr-string&gt;<BR>&lt;pr-char&gt; ::= printable characters, any<BR>ASCII code 33 through 126<BR>&lt;byte-size&gt; ::= &lt;number&gt;<BR>&lt;host-port&gt; ::= &lt;host-number&gt;,&lt;port-number&gt;<BR>&lt;host-number&gt; ::= &lt;number&gt;,&lt;number&gt;,&lt;number&gt;,&lt;number&gt;<BR>&lt;port-number&gt; ::= &lt;number&gt;,&lt;number&gt;<BR>&lt;number&gt; ::= any decimal integer 1 through 255<BR>&lt;form-code&gt; ::= N | T | C<BR>&lt;type-code&gt; ::= A [&lt;sp&gt; &lt;form-code&gt;]<BR>| E [&lt;sp&gt; &lt;form-code&gt;]<BR>| I<BR>| L &lt;sp&gt; &lt;byte-size&gt;<BR>&lt;structure-code&gt; ::= F | R | P<BR>&lt;mode-code&gt; ::= S | B | C<BR>&lt;pathname&gt; ::= &lt;string&gt;<BR>&lt;decimal-integer&gt; ::= any decimal integer<BR><BR><U><a href="" target="_blank" >RFC</A>959</U> October 1985<BR>File Transfer Protocol<BR><BR>5.4. SEQUENCING OF COMMANDS AND REPLIES<BR><BR>The communication between the user and server is intended to be an<BR>alternating dialogue. As such, the user issues an <a href="" target="_blank" >FTP</A> command and<BR>the server responds with a prompt primary reply. The user should<BR>wait for this initial primary success or failure response before<BR>sending further commands.<BR><BR>Certain commands require a second reply for which the user should<BR>also wait. These replies may, for example, report on the progress<BR>or completion of file transfer or the closing of the data<BR>connection. They are secondary replies to file transfer commands.<BR><BR>One important group of informational replies is the connection<BR>greetings. Under normal circumstances, a server will send a 220<BR>reply, "awaiting input", when the connection is completed. The<BR>user should wait for this greeting message before sending any<BR>commands. If the server is unable to accept input right away, a<BR>120 "expected delay" reply should be sent immediately and a 220<BR>reply when ready. The user will then know not to hang up if there<BR>is a delay.<BR><BR>Spontaneous Replies<BR><BR>Sometimes "the system" spontaneously has a message to be sent<BR>to a user (usually all users). For example, "System going down<BR>in 15 minutes". There is no provision in <a href="" target="_blank" >FTP</A> for such<BR>spontaneous information to be sent from the server to the user.<BR>It is recommended that such information be queued in the<BR>server-PI and delivered to the user-PI in the next reply<BR>(possibly making it a multi-line reply).<BR><BR>The table below lists alternative success and failure replies for<BR>each command. These must be strictly adhered to; a server may<BR>substitute text in the replies, but the meaning and action implied<BR>by the code numbers and by the specific command reply sequence<BR>cannot be altered.<BR><BR>Command-Reply Sequences<BR><BR>In this section, the command-reply sequence is presented. Each<BR>command is listed with its possible replies; command groups are<BR>listed together. Preliminary replies are listed first (with<BR>their succeeding replies indented and under them), then<BR>positive and negative completion, and finally intermediary<BR><BR><U><a href="" target="_blank" >RFC</A>959</U> October 1985<BR>File Transfer Protocol<BR><BR>replies with the remaining commands from the sequence<BR>following. This listing forms the basis for the state<BR>diagrams, which will be presented separately.<BR><BR>Connection Establishment<BR>120<BR>220<BR>220<BR>421<BR>Login<BR>USER<BR>230<BR>530<BR>500, 501, 421<BR>331, 332<BR>PASS<BR>230<BR>202<BR>530<BR>500, 501, 503, 421<BR>332<BR>ACCT<BR>230<BR>202<BR>530<BR>500, 501, 503, 421<BR>CWD<BR>250<BR>500, 501, 502, 421, 530, 550<BR>CDUP<BR>200<BR>500, 501, 502, 421, 530, 550<BR>SMNT<BR>202, 250<BR>500, 501, 502, 421, 530, 550<BR>Logout<BR>REIN<BR>120<BR>220<BR>220<BR>421<BR>500, 502<BR>QUIT<BR>221<BR>500<BR><BR><U><a href="" target="_blank" >RFC</A>959</U> October 1985<BR>File Transfer Protocol<BR><BR>Transfer parameters<BR>PORT<BR>200<BR>500, 501, 421, 530<BR>PASV<BR>227<BR>500, 501, 502, 421, 530<BR>MODE<BR>200<BR>500, 501, 504, 421, 530<BR>TYPE<BR>200<BR>500, 501, 504, 421, 530<BR>STRU<BR>200<BR>500, 501, 504, 421, 530<BR>File action commands<BR>ALLO<BR>200<BR>202<BR>500, 501, 504, 421, 530<BR>REST<BR>500, 501, 502, 421, 530<BR>350<BR>STOR<BR>125, 150<BR>(110)<BR>226, 250<BR>425, 426, 451, 551, 552<BR>532, 450, 452, 553<BR>500, 501, 421, 530<BR>STOU<BR>125, 150<BR>(110)<BR>226, 250<BR>425, 426, 451, 551, 552<BR>532, 450, 452, 553<BR>500, 501, 421, 530<BR>RETR<BR>125, 150<BR>(110)<BR>226, 250<BR>425, 426, 451<BR>450, 550<BR>500, 501, 421, 530
页: [1]
查看完整版本: rfcp4050