ietf-822
[Top] [All Lists]

Re: optional space after header field colon

2004-09-13 17:03:52

Martin Trautmann wrote:

Hi all,

is there any real rule whether to put an empty space between a field
name's colon and the field body?

It's common behavior to include one here,
but it's unclear - or even purpose (A.5.) - that none is required.

In structured fields, whitespace is significant only as a separator
between other lexical tokens (in early standards, whitespace was also
allowed within logical tokens, but that lead to unresolvable
ambiguities).

According to obsolete A.6.3 WSP is (or was, according to B.21.) even
allowed between header field and colon.

RFC 2822 requires parsing fields with whitespace between the field
name and colon, but does not permit it during generation. Early
standards even permitted multi-word (whitespace-separated) field
names.

There may be special rules for special header fields, but to my knowledge
there's none for all.

Is the leading space of a field body part of the field body or not?

As noted above, whitespace simply delimits tokens in structured
fields.  So while any whitespace immediately following the colon which
follows the field name is part of the field body of a structured field,
such whitespace carries no protocol information.

In unstructured fields, whitespace is simply part of the field body.