|
楼主 |
发表于 2005-10-8 23:40:41
|
显示全部楼层
<FONT size=2>LIST (LIST)<BR><BR>This command causes a list to be sent from the server to the<BR>passive DTP. If the pathname specifies a directory or other<BR>group of files, the server should transfer a list of files<BR>in the specified directory. If the pathname specifies a<BR>file then the server should send current information on the<BR>file. A null argument implies the user's current working or<BR>default directory. The data transfer is over the data<BR>connection in type ASCII or type EBCDIC. (The user must<BR><BR></FONT><U><a href="http://www.cnpaf.net/class/RfcAll/" target="_blank" ><FONT size=2>RFC</FONT></A><FONT size=2>959</FONT></U><FONT size=2> October 1985<BR>File Transfer Protocol<BR><BR>ensure that the TYPE is appropriately ASCII or EBCDIC).<BR>Since the information on a file may vary widely from system<BR>to system, this information may be hard to use automatically<BR>in a program, but may be quite useful to a human user.<BR><BR>NAME LIST (NLST)<BR><BR>This command causes a directory listing to be sent from<BR>server to user site. The pathname should specify a<BR>directory or other system-specific file group descriptor; a<BR>null argument implies the current directory. The server<BR>will return a stream of names of files and no other<BR>information. The data will be transferred in ASCII or<BR>EBCDIC type over the data connection as valid pathname<BR>strings separated by <CRLF> or <NL>. (Again the user must<BR>ensure that the TYPE is correct.) This command is intended<BR>to return information that can be used by a program to<BR>further process the files automatically. For example, in<BR>the implementation of a "multiple get" function.<BR><BR>SITE PARAMETERS (SITE)<BR><BR>This command is used by the server to provide services<BR>specific to his system that are essential to file transfer<BR>but not sufficiently universal to be included as commands in<BR>the protocol. The nature of these services and the<BR>specification of their syntax can be stated in a reply to<BR>the HELP SITE command.<BR><BR>SYSTEM (SYST)<BR><BR>This command is used to find out the type of operating<BR>system at the server. The reply shall have as its first<BR>word one of the system names listed in the current version<BR>of the Assigned Numbers document [4].<BR><BR>STATUS (STAT)<BR><BR>This command shall cause a status response to be sent over<BR>the control connection in the form of a reply. The command<BR>may be sent during a file transfer (along with the Telnet IP<BR>and Synch signals--see the Section on </FONT><a href="http://www.cnpaf.net/class/ftp/" target="_blank" ><FONT size=2>FTP</FONT></A><FONT size=2> Commands) in which<BR>case the server will respond with the status of the<BR>operation in progress, or it may be sent between file<BR>transfers. In the latter case, the command may have an<BR>argument field. If the argument is a pathname, the command<BR>is analogous to the "list" command except that data shall be<BR><BR></FONT><U><a href="http://www.cnpaf.net/class/RfcAll/" target="_blank" ><FONT size=2>RFC</FONT></A><FONT size=2>959</FONT></U><FONT size=2> October 1985<BR>File Transfer Protocol<BR><BR>transferred over the control connection. If a partial<BR>pathname is given, the server may respond with a list of<BR>file names or attributes associated with that specification.<BR>If no argument is given, the server should return general<BR>status information about the server </FONT><a href="http://www.cnpaf.net/class/ftp/" target="_blank" ><FONT size=2>FTP</FONT></A><FONT size=2> process. This<BR>should include current values of all transfer parameters and<BR>the status of connections.<BR><BR>HELP (HELP)<BR><BR>This command shall cause the server to send helpful<BR>information regarding its implementation status over the<BR>control connection to the user. The command may take an<BR>argument (e.g., any command name) and return more specific<BR>information as a response. The reply is type 211 or 214.<BR>It is suggested that HELP be allowed before entering a USER<BR>command. The server may use this reply to specify<BR>site-dependent parameters, e.g., in response to HELP SITE.<BR><BR>NOOP (NOOP)<BR><BR>This command does not affect any parameters or previously<BR>entered commands. It specifies no action other than that the<BR>server send an OK reply.<BR><BR>The File Transfer Protocol follows the specifications of the Telnet<BR>protocol for all communications over the control connection. Since<BR>the language used for Telnet communication may be a negotiated<BR>option, all references in the next two sections will be to the<BR>"Telnet language" and the corresponding "Telnet end-of-line code".<BR>Currently, one may take these to mean NVT-ASCII and <CRLF>. No other<BR>specifications of the Telnet protocol will be cited.<BR><BR></FONT><a href="http://www.cnpaf.net/class/ftp/" target="_blank" ><FONT size=2>FTP</FONT></A><FONT size=2> commands are "Telnet strings" terminated by the "Telnet end of<BR>line code". The command codes themselves are alphabetic characters<BR>terminated by the character <SP> (Space) if parameters follow and<BR>Telnet-EOL otherwise. The command codes and the semantics of<BR>commands are described in this section; the detailed syntax of<BR>commands is specified in the Section on Commands, the reply sequences<BR>are discussed in the Section on Sequencing of Commands and Replies,<BR>and scenarios illustrating the use of commands are provided in the<BR>Section on Typical </FONT><a href="http://www.cnpaf.net/class/ftp/" target="_blank" ><FONT size=2>FTP</FONT></A><FONT size=2> Scenarios.<BR><BR></FONT><a href="http://www.cnpaf.net/class/ftp/" target="_blank" ><FONT size=2>FTP</FONT></A><FONT size=2> commands may be partitioned as those specifying access-control<BR>identifiers, data transfer parameters, or </FONT><a href="http://www.cnpaf.net/class/ftp/" target="_blank" ><FONT size=2>FTP</FONT></A><FONT size=2> service requests.<BR>Certain commands (such as ABOR, STAT, QUIT) may be sent over the<BR>control connection while a data transfer is in progress. Some<BR><BR></FONT><U><a href="http://www.cnpaf.net/class/RfcAll/" target="_blank" ><FONT size=2>RFC</FONT></A><FONT size=2>959</FONT></U><FONT size=2> October 1985<BR>File Transfer Protocol<BR><BR>servers may not be able to monitor the control and data connections<BR>simultaneously, in which case some special action will be necessary<BR>to get the server's attention. The following ordered format is<BR>tentatively recommended:<BR><BR>1. User system inserts the Telnet "Interrupt Process" (IP) signal<BR>in the Telnet stream.<BR><BR>2. User system sends the Telnet "Synch" signal.<BR><BR>3. User system inserts the command (e.g., ABOR) in the Telnet<BR>stream.<BR><BR>4. Server PI, after receiving "IP", scans the Telnet stream for<BR>EXACTLY ONE </FONT><a href="http://www.cnpaf.net/class/ftp/" target="_blank" ><FONT size=2>FTP</FONT></A><FONT size=2> command.<BR><BR>(For other servers this may not be necessary but the actions listed<BR>above should have no unusual effect.)<BR><BR>4.2. </FONT><a href="http://www.cnpaf.net/class/ftp/" target="_blank" ><FONT size=2>FTP</FONT></A><FONT size=2> REPLIES<BR><BR>Replies to File Transfer Protocol commands are devised to ensure<BR>the synchronization of requests and actions in the process of file<BR>transfer, and to guarantee that the user process always knows the<BR>state of the Server. Every command must generate at least one<BR>reply, although there may be more than one; in the latter case,<BR>the multiple replies must be easily distinguished. In addition,<BR>some commands occur in sequential groups, such as USER, PASS and<BR>ACCT, or RNFR and RNTO. The replies show the existence of an<BR>intermediate state if all preceding commands have been successful.<BR>A failure at any point in the sequence necessitates the repetition<BR>of the entire sequence from the beginning.<BR><BR>The details of the command-reply sequence are made explicit in<BR>a set of state diagrams below.<BR><BR>An </FONT><a href="http://www.cnpaf.net/class/ftp/" target="_blank" ><FONT size=2>FTP</FONT></A><FONT size=2> reply consists of a three digit number (transmitted as<BR>three alphanumeric characters) followed by some text. The number<BR>is intended for use by automata to determine what state to enter<BR>next; the text is intended for the human user. It is intended<BR>that the three digits contain enough encoded information that the<BR>user-process (the User-PI) will not need to examine the text and<BR>may either discard it or pass it on to the user, as appropriate.<BR>In particular, the text may be server-dependent, so there are<BR>likely to be varying texts for each reply code.<BR><BR>A reply is defined to contain the 3-digit code, followed by Space<BR><BR></FONT><U><a href="http://www.cnpaf.net/class/RfcAll/" target="_blank" ><FONT size=2>RFC</FONT></A><FONT size=2>959</FONT></U><FONT size=2> October 1985<BR>File Transfer Protocol<BR><BR><SP>, followed by one line of text (where some maximum line length<BR>has been specified), and terminated by the Telnet end-of-line<BR>code. There will be cases however, where the text is longer than<BR>a single line. In these cases the complete text must be bracketed<BR>so the User-process knows when it may stop reading the reply (i.e.<BR>stop processing input on the control connection) and go do other<BR>things. This requires a special format on the first line to<BR>indicate that more than one line is coming, and another on the<BR>last line to designate it as the last. At least one of these must<BR>contain the appropriate reply code to indicate the state of the<BR>transaction. To satisfy all factions, it was decided that both<BR>the first and last line codes should be the same.<BR><BR>Thus the format for multi-line replies is that the first line<BR>will begin with the exact required reply code, followed<BR>immediately by a Hyphen, "-" (also known as Minus), followed by<BR>text. The last line will begin with the same code, followed<BR>immediately by Space <SP>, optionally some text, and the Telnet<BR>end-of-line code.<BR><BR>For example:<BR>123-First line<BR>Second line<BR><st1:chmetcnv w:st="on" UnitName="a" SourceValue="234" HasSpace="True" Negative="False" NumberType="1" TCSC="0">234 A</st1:chmetcnv> line beginning with numbers<BR>123 The last line<BR><BR>The user-process then simply needs to search for the second<BR>occurrence of the same reply code, followed by <SP> (Space), at<BR>the beginning of a line, and ignore all intermediary lines. If<BR>an intermediary line begins with a 3-digit number, the Server<BR>must pad the front to avoid confusion.<BR><BR>This scheme allows standard system routines to be used for<BR>reply information (such as for the STAT reply), with<BR>"artificial" first and last lines tacked on. In rare cases<BR>where these routines are able to generate three digits and a<BR>Space at the beginning of any line, the beginning of each<BR>text line should be offset by some neutral text, like Space.<BR><BR>This scheme assumes that multi-line replies may not be nested.<BR><BR>The three digits of the reply each have a special significance.<BR>This is intended to allow a range of very simple to very<BR>sophisticated responses by the user-process. The first digit<BR>denotes whether the response is good, bad or incomplete.<BR>(Referring to the state diagram), an unsophisticated user-process<BR>will be able to determine its next action (proceed as planned,<BR><BR></FONT><U><a href="http://www.cnpaf.net/class/RfcAll/" target="_blank" ><FONT size=2>RFC</FONT></A><FONT size=2>959</FONT></U><FONT size=2> October 1985<BR>File Transfer Protocol<BR><BR>redo, retrench, etc.) by simply examining this first digit. A<BR>user-process that wants to know approximately what kind of error<BR>occurred (e.g. file system error, command syntax error) may<BR>examine the second digit, reserving the third digit for the finest<BR>gradation of information (e.g., RNTO command without a preceding<BR>RNFR).<BR><BR>There are five values for the first digit of the reply code:<BR><BR>1yz Positive Preliminary reply<BR><BR>The requested action is being initiated; expect another<BR>reply before proceeding with a new command. (The<BR>user-process sending another command before the<BR>completion reply would be in violation of protocol; but<BR>server-</FONT><a href="http://www.cnpaf.net/class/ftp/" target="_blank" ><FONT size=2>FTP</FONT></A><FONT size=2> processes should queue any commands that<BR>arrive while a preceding command is in progress.) This<BR>type of reply can be used to indicate that the command<BR>was accepted and the user-process may now pay attention<BR>to the data connections, for implementations where<BR>simultaneous monitoring is difficult. The server-</FONT><a href="http://www.cnpaf.net/class/ftp/" target="_blank" ><FONT size=2>FTP</FONT></A><BR><FONT size=2>process may send at most, one 1yz reply per command.<BR><BR>2yz Positive Completion reply<BR><BR>The requested action has been successfully completed. A<BR>new request may be initiated.<BR><BR>3yz Positive Intermediate reply<BR><BR>The command has been accepted, but the requested action<BR>is being held in abeyance, pending receipt of further<BR>information. The user should send another command<BR>specifying this information. This reply is used in<BR>command sequence groups.<BR><BR>4yz Transient Negative Completion reply<BR><BR>The command was not accepted and the requested action did<BR>not take place, but the error condition is temporary and<BR>the action may be requested again. The user should<BR>return to the beginning of the command sequence, if any.<BR>It is difficult to assign a meaning to "transient",<BR>particularly when two distinct sites (Server- and<BR>User-processes) have to agree on the interpretation.<BR>Each reply in the 4yz category might have a slightly<BR>different time value, but the intent is that the<BR><BR></FONT><U><a href="http://www.cnpaf.net/class/RfcAll/" target="_blank" ><FONT size=2>RFC</FONT></A><FONT size=2>959</FONT></U><FONT size=2> October 1985<BR>File Transfer Protocol<BR><BR></FONT> |
|