IV.B FTP 応答
サーバは、ユーザの FTP コマンドに対して、TELNET 接続を介して FTP 応答を送ります。FTP 応答は、確認応答または完了コード(エラーを含む)を構成します。FTP サーバの応答は、人間またはプログラムが解釈できるように整形されています。1 行の応答は、先頭の 3 桁の数字コード、スペース、そのコードの 1 行のテキスト説明から成ります。複数行のテキストを含む応答では、最初の行は先頭の 3 桁の数字コードに続けてすぐに ASCII 文字「-」(ハイフン、コード 55(8 進))が置かれ、場合によってはテキストが続きます。最後の行を除くすべての後続の継続行は、3 桁の数字で始まってはならず、最後の行は最初の行の数字コードを繰り返し、直後にスペースが続かなければなりません。
例:
100-First Line
Continuation Line
Another Line
100 Last Line
数字コードは、プログラムによる解釈を容易にするため、RJE プロトコルなど他のプロトコルと整合する方法で、グループごとに割り当てられています。コードの 3 桁は次のように解釈されます。
a) 最初の桁は、次に示す応答の種類を指定します。
000 These replies are purely informative and constitute neither a
positive nor a negative acknowledgment.
1xx Informative replies to status inquiries. These constitute a
positive acknowledgment to the status command.
2xx Positive acknowledgment of previous command or other success-
ful action.
3xx Incomplete information. Activity cannot proceed without
further specification and input.
4xx Unsuccessful reply. The request is correctly specified but
the server is unsuccessful in correctly fulfilling it.
5xx Incorrect or illegal command. The command or its parameters
were invalid or incomplete from a syntactic viewpoint, or the
command is inconsistent with a previous command. The command
in question has been completely ignored.
6xx-9xx Reserved for future expansion.
すなわち、000 は純粋に情報提供であり、肯定とも否定ともつかない応答。1xx は状態問い合わせへの情報提供の応答で、状態コマンドに対する肯定応答となる。2xx は直前のコマンドまたはその他の成功した動作に対する肯定応答。3xx は情報が不完全で、さらなる指定と入力なしには処理を進められない。4xx は不成功の応答で、要求は正しく指定されているが、サーバが正しく満たせなかった。5xx は不正または不当なコマンドで、コマンドまたはそのパラメータが構文上無効または不完全であるか、直前のコマンドと矛盾しており、該当コマンドは完全に無視された。6xx-9xx は将来の拡張用に予約されています。
b) 2 桁目は、応答が属する一般的なカテゴリを指定します。
x00-x29 General purpose replies, not assignable to other
categories.
x30 Primary access. Informative replies to the "log-on" attempt.
x40 Secondary access. The primary server is commenting on its
ability to access a secondary service.
x5x FTP results
x6x RJE results.
x7x-x9x Reserved for future expansion.
すなわち、x00-x29 は他のカテゴリに割り当てられない汎用の応答。x30 は一次アクセスで、「ログオン」の試みに対する情報提供の応答。x40 は二次アクセスで、一次サーバが二次サービスへアクセスする能力についてコメントしている。x5x は FTP の結果。x6x は RJE の結果。x7x-x9x は将来の拡張用に予約されています。
c) 最後の桁は、特定のメッセージタイプを指定します。このコードは自動処理プロセスが解釈するよう設計されているため、応答のあらゆるバリエーションに固有の番号を付ける必要はありません。応答の基本的な意味にのみ固有の番号が必要です。応答のテキストは、その応答の具体的な理由を人間のユーザに説明できます。
サーバが送る、数字コードと CRLF で区切られた各 TELNET 行(またはコード付き行で挟まれたテキスト行の集まり)は、完結した応答メッセージとなることを意図しています。応答のテキストは人間のユーザ向けであることに注意してください。プログラム向けなのは、応答コードと、場合によっては最初のテキスト行だけです。
FTP に関して割り当てられている応答コードは次のとおりです。
000 General information message (site, time of day, etc.).
010 Message from system operator.
030 Server availability information.
050 FTP commentary or user information.
100 System status reply.
110 System busy doing...
150 File status reply
151 Directory listing reply.
200 Last command received correctly.
201 An ABORT has terminated activity, as requested.
202 Abort request ignored, no activity in progress.
230 User is "logged in". May proceed.
231 User is "logged out". Service terminated.
232 Logout command noted, will complete when transfer done.
233 User is "logged out". Parameters reinitialized.
250 FTP file transfer started correctly.
251 FTP Restart-marker reply.
Text is : MARK yyyy = mmmm
where yyyy is user's data stream marker (yours)
and mmmm is server's equivalent marker (mine)
(Note the spaces between the markers and '=')
252 FTP transfer completed correctly.
253 Rename completed.
254 Delete completed.
255 FTP server data socket reply
Text is: SOCK nnnn
where nnnn is a decimal integer representing
the server socket for data connection
256 Mail completed.
300 Connection greeting message, awaiting input.
301 Current command incompleted (no CRLF for long time).
330 Enter password
331 Enter account (if account required as part of login
sequence).
350 Enter mail, terminate by a line with only a '.'
400 This service not implemented.
401 This service not accepting user now, goodbye.
430 Log-on time or tries exceeded, goodbye.
431 Log-on unsuccessful. Usre and/or password invalid.
432 User not valid for this service.
433 Cannot transfer files without valid account. Enter account.
434 Log-out forced by operator action. Phone site.
435 Log-out forced by system problem.
436 Service shutting down, goodbye.
450 FTP: File not found.
451 FTP: File access denied to you.
452 FTP: File transfer incomplete, data connection closed.
453 FTP: File transfer incomplete, insufficient storage space.
454 FTP: Cannot connect to your data socket.
455 FTP: File system error not covered by other reply codes.
456 FTP: Name duplication rename failed.
457 FTP: Transfer parameters in error.
500 Last command line completely unrecognized.
501 Syntax of last command is incorrect.
502 Last command incomplete, parameters missing.
123456789012345678901234567890123456789012345678901234567890123456789012
503 Last command invalid (ignored), illegal parameter combination.
504 Last command invalid, action not possible at this time.
505 Last command conflicts illegally with previous command(s).
506 Requested action not implemented by the server.
507 Catchall error reply.
550 Bad pathname specification (e.g., syntax error).