I read the rfc7230 section 3.2. After removing obsolete rules, the spec about header field is:
header-field = field-name ":" OWS field-value OWS
field-name = token
field-value = *field-content
field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
field-vchar = VCHAR
VCHAR = %x21-7E; visible (printing) characters
I am confused by the definition of field-content
. It seems that it matches 1 or 2 VCHAR
s, with any amount of space in between, but it will not match another space after a field-content
match.
For example, for name:a<sp>b<sp>c
, field-name
will match name
, but field-content
will match a<sp>b
and then the next <sp>
cannot be matched by another field-content
, thus this header is invalid.
However, name:a<sp>bc<sp>d
is valid because there are two matches for field-content
, a<sp>b
and c<sp>d
.
I think this is inconsistent. Is this intended or do I misunderstood something?
I know this is an old question, but :
The updated RFC 9110 Section 5.5 still holds this ambiguity. Therefore, i would suggest sticking to the explaination described here.