MIME

From Fernseher
Revision as of 11:01, 13 January 2009 by 129.42.161.36 (talk)
Jump to navigationJump to search

Need to describe MIME headers and body types here, and what types of MIME bodies can be in multiparts/treed stuff, etc. This is really Entity, probably. Need to be able to distinguish between HTTP and MIME (mail) type entities. Also, an indicator as to whether the entity is currently encoded or decoded. Functions to encode/decode (to MIME transport spec, gzip, compress, etc). When the entity is encoded, it probably shouldn't be writable.

HTTP-Message -> HTTP-Request -> request-line  CRLF  entity
HTTP-Message -> HTTP-Response -> status-line  CRLF  entity
MIME-Message -> entity
entity -> headers  CRLF  (body | entity | multipart)
multipart -> leader  (CRLF boundary  entity)+  boundary-end  trailer
headers -> header*
header -> header-name  ':'  header-value  CRLF
header-value -> values
values -> (value-exp  ',')*  value-exp
value-exp -> real-value  (';'  property-exp)*
property-exp -> property-key  ['='  property-value]
  • Header comments are in '(' ')' and should not be kept except in the raw header value.
  • Line folding can happen (header line followed by CRLF LWSP extra line).
  • Be careful with cookies.
  • Header contents can have double quoted strings for atoms.