现在我正在阅读一些关于http的rfc文档,但是我可以理解隐含的lws(线性空白)的含义?
隐含的lws仅仅是指规则描述中的lws,但在规则的最终扩展中不会出现lws?它只是让我们看清了标记?
有人能帮我解决这个问题吗?

最佳答案

我认为这个问题与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 rfcRFC 7230解决了这个问题,而是将允许的空白显式地放在语法中。(包括bws“bad whitespace”,它只允许用于支持遗留实现,但不能由一致的实现生成。)

10-06 02:08