RFC 7230 field-value syntax is weird

Viewed 19

From RFC 7230, following syntax are defined:

field-value = *( field-content / obs-fold )
field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
field-vchar = VCHAR / obs-text

VCHAR is just ASCII 21 to 7F, and obs-text is ASCII 80 to FF. So field-vchar is merely ASCII 21 to FF, which doesn't contain space or htab.
So field-content is something like 'a' or 'a a' (quote not included), and field-value is merely a repetition of field-value (I ignored obs-fold because it is not relevent in this question).

Then it means 'a ab bc c' is valid field-value but 'a b c d' is not.
Isn't this weird? Why would anyone want this kind of syntax?

Even more, request messages which google chrome sends contains a header field like following:

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36

'Mac OS X 10', which has spaces on both side of 'X', is invalid syntax for field-value.

Am I missing something? Or google chrome is not strictly conforming HTTP 1.1?

0 Answers
Related