问题描述
我刚刚阅读了HTTP标准(更精确地为 propsed标准)第1部分,并与第3部分倒数第二段中他们认为的空白"相混淆: https://tools.ietf.org/html/rfc7230#section-3
I've just been reading HTTP standard (propsed standard to be more precise) part 1 and got confused with what they consider as "whitespace" in section 3, second to last paragraph:https://tools.ietf.org/html/rfc7230#section-3
由于返回(CRLF)终止了HTTP标头,因此唯一可能暗示的空格是 0x20
'Space'字符.Wikipedia列出了另一种空格ASCII符号,例如'Non-breaking space' 0xA0
,因此我仍然不理解这个(空格")概念.
Since returns (CRLFs) terminate HTTP header, the only whitespaces that may be implied are 0x20
'Space' characters. Wikipedia lists another kinds of whitespace ASCII symbols, like 'Non-breaking space' 0xA0
, so I still don't understand this ("whitespace") concept.
请帮我弄清楚它在本标准范围内的真正含义.
Please, help me figure out what it really means in scope of this standard.
推荐答案
RFC 7230完全定义了标头中的空白:
RFC 7230, which you linked to, defines EXACTLY what it considers to be whitespace in a header:
HTTP-message = start-line
*( header-field CRLF )
CRLF
[ message-body ]
header-field = field-name ":" OWS field-value OWS
field-name = token
field-value = *( field-content / obs-fold )
field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
field-vchar = VCHAR / obs-text
obs-fold = CRLF 1*( SP / HTAB )
; obsolete line folding
; see Section 3.2.4
obs-text = %x80-FF
OWS = *( SP / HTAB )
; optional whitespace
如您所见, SP
(空格)和 HTAB
(水平选项卡)是唯一定义的空白字符.它们在 RFC 5234附录B.1 中定义,RFC 7230链接了到:
As you can see, SP
(space) and HTAB
(horizontal tab) are the only defined whitespace characters. They are defined in RFC 5234 Appendix B.1, which RFC 7230 links to:
HTAB = %x09
; horizontal tab
SP = %x20
这篇关于在HTTP标头中被认为是空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!