现在我正在阅读一些关于http的RFC文档,但是我不理解其中隐含的LWS(线性空格)的含义?隐含的LWS指的是即使在规则的描述中也包括LWS,但是LWS不会出现在规则的最终扩展中吗?这只是为了让我们清楚地看到标记吗?有人能帮我回答这个问题吗?
现在我正在阅读一些关于http的RFC文档,但是我不理解其中隐含的LWS(线性空格)的含义?隐含的LWS指的是即使在规则的描述中也包括LWS,但是LWS不会出现在规则的最终扩展中吗?这只是为了让我们清楚地看到标记吗?有人能帮我回答这个问题吗?
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“坏空格”,它仅允许支持旧版实现,但不得由符合规范的实现产生。)