隐含的LWS在http中的含义是什么?

时间:2014-03-12 04:33:54

标签: http

现在我正在阅读一些关于http的RFC文档,但我能理解暗示LWS(线性空白区域)的含义吗? 隐含的LWS只是意味着LWS即使在规则的描述中,但LWS不会出现在规则的最终扩展中?它只是让我们清楚地看到令牌? 有人可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

我认为问题涉及RFC 2616, Section 2.1

中的以下内容
implied *LWS
   The grammar described by this specification is word-based. Except
   where noted otherwise, linear white space (LWS) can be included
   between any two adjacent words (token or quoted-string), and
   between adjacent words and separators, without changing the
   interpretation of a field. At least one delimiter (LWS and/or
   separators) MUST exist between any two tokens (for the definition
   of "token" below), since they would otherwise be interpreted as a
   single token.

目标似乎是通过不明确地包含空格来使语法更具可读性。但是,这条规则的实际解释是充实的。例如,可以请求

GET / HTTP/1.1
Host: example.org

实际上是以

发送的
GET   /   HTTP   /   1   .   1
Host   :   example.org

代替?实施方式各不相同

新的和改进的HTTP RFC RFC 7230取消了这一点,而是将允许的空格明确地放在语法中。 (包括BWS和#34;糟糕的空白"只允许支持遗留实现,但不得由符合要求的实现生成。)