跳到主要内容

规则: 记住 DONT/WONT 请求

一份 TELNET 实现必须记住它发起了一个 DONT/WONT 协商.

讨论:

从 RFC 854 中无法看清 TELNET 是否必须记住开始了一个 DONT/WONT 协商. 似乎没有理由去记住发起一个 DONT/WONT 协商: 1. 记住 DO/WILL 协商的理由 (即"正在协商启用"这一状态对数据流而言与"已启用该选项"状态含义不同) 在这里并不适用. 2. 对于 DONT/WONT, 另一方在回应时没有选择余地; 该选项最终都会被禁用. 3. 如果我们干脆立即禁用该选项并忘掉正在协商, 那么由于该选项已禁用, 我们会忽略 WONT/DONT 回应.

不幸的是, 这个结论是错误的. 考虑下面两方 ("我们"与"他") 之间的一段 TELNET 对话. (本 RFC 的读者可能希望把各步骤按时间顺序重新排序, 以获得另一种视角.)

循环示例 1

         Both sides know that the option is on.

On his side:
1 He decides to disable. He sends DONT and disables the option.
2 He decides to reenable. He sends DO and remembers he is
negotiating.
5 He receives WONT and gives up on negotiation.
6 He decides to try once again to reenable. He sends DO and
remembers he is negotiating.
7 He receives WONT and gives up on negotiation.
For whatever reason, he decides to agree with future requests.
10 He receives WILL and agrees. He responds DO and enables the
option.
11 He receives WONT and sighs. He responds DONT and disables the
option.
(repeat 10 and then 11, forever)

On our side:
3 We receive DONT and sigh. We respond WONT and disable the
option.
4 We receive DO but disagree. We respond WONT.
8 We receive DO and decide to agree. We respond WILL and enable
the option.
9 We decide to disable. We send WONT and disable the option.
For whatever reason, we decide to agree with future requests.
12 We receive DO and agree. We send WILL and enable the option.
13 We receive DONT and sigh. We send WONT and disable the option.
(repeat 12 and then 13, forever)

双方都遵循了 RFC 854; 但最终陷入了一个选项协商循环: DONT DO DO 之后 DO DONT 永久地朝一个方向在网络中往返, 而 WONT WONT 之后 WILL WONT 永久地朝另一个方向在网络中往返. 步骤 1 和 9 中的行为是这个循环的成因. 因此有了本节的规则. 下文第 6 节讨论了是需要为"协商禁用"和"协商启用"设置独立的状态, 还是单个"协商"状态就足够.