跳到主要内容

方案选择: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,都必须执行这一重置。重置所需的动作将在讨论各方案的实际工作方式时说明。