メインコンテンツまでスキップ

方式の選択: XRSQ

XRSQ は、ユーザープログラムが XRSQ/XRCP の実装有無を調べ、特定の方式を選択し、その状態をリセットし、さらに初歩的なネゴシエーションまで行うための手段である。その形式は TYPE コマンドに似ており、次のとおりである。

XRSQ [<SP> <scheme>] <CRLF>

<scheme> = a single character. The following are defined:
R Recipients first. If not implemented, T must be.
T Text first. If this is not implemented, R must be.
? Request for preference. Must always be implemented.

No argument means a "selection" of none of the schemes (the
default).

Replies:
200 OK, we'll use specified scheme.
215 <scheme> This is the scheme I prefer.
501 I understand XRSQ but can't use that scheme.
5xx Command unrecognized or unimplemented.
See Appendix A for more about the choice of reply codes.

ここで XRSQ について指摘しておくべき点が三つある。第一に、引数なしの XRSQ は常に 200 応答を返し、方式が何も選択されていない既定の状態に戻さなければならない。それ以外の応答は、XRSQ、したがって XRCP が理解されないか、正しく実行できないことを意味する。

第二に、<scheme> として「?」を用いると、FTP サーバーに 215 応答を返すよう求めることになり、その中でサーバーは「望ましい」方式を示す。この応答の形式は単純である。

215 <SP> <scheme> [<SP> <arbitrary text>] <CRLF>

Any other reply (e.g. 4xx or 5xx) implies that XRSQ and XRCP are
not implemented, because "?" must always be implemented if XRSQ
is.

XRSQ について三つ目に重要なのは、常にすべての方式を初期状態にリセットするという副作用があることである。このリセットは、応答が 200、215、501 のいずれであっても行わなければならない。リセットに必要な動作は、各方式が実際にどう動作するかを論じる際に説明する。