Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is white space allowed betwee mime header field-name and ':' separator

Within a mime header, is white space allowed between the header field-name and ':' separator? For example, are:

Content-Type: <value>

and

Content-Type  : <value>

equivalent?

Also, can you please provide a pointer to the mime standard where this is described? I checked a few but did not find it.

Thanks

like image 573
Thiagarajan Hariharan Avatar asked Nov 08 '12 18:11

Thiagarajan Hariharan


People also ask

Are spaces allowed in headers?

No, you shouldn't, and it's just plain invalid. field-name cannot have spaces.

What are the header fields defined in s Mime?

The following headers are defined in MIME: MIME-Version. Content-Type. Content-Transfer-Encoding. Content-ID.


1 Answers

Depends on what you mean by 'allowed'. RFCs 2822 (which obsoleted the 1982 RFC822) and 5322 (which obsoleted 2822) specifically forbid the insertion of WS between the field name and the colon (these are not 'MIME' standards, BTW). Note that : is not a token, and is only referenced as part of a field name, for example:

from = "From:" mailbox-list CRLF

However, the ancient RFC822 did allow space here, and the newer RFCs state that the obsolete syntax "MUST be accepted and parsed by a conformant receiver". The obsolete From: header definition, for example, was

obs-from = "From" *WSP ":" mailbox-list CRLF

Section 4 covers the obsolete syntax. I don't actually allow obsolete syntax in my own receiver, and I've never had a problem.

like image 82
EML Avatar answered Oct 03 '22 11:10

EML