[whatwg] [mimesniff] Review request: Parsing a MIME type
poccil14 at gmail.com
Fri May 31 20:50:03 PDT 2013
> * Another important point to notice is the fact that this algorithm
> allows parameter names to appear without values. This is useful in
> situations such as the "base64" option in data: URLs that use the mere
> presence or absence of a parameter to set its boolean value.
Since you mention data URLs I should note that data URLs can be percent
encoded, which HTTP
and MIME headers can't be. This raises additional considerations when
parsing a data URL's MIME type correctly;
see reference  for test cases. In particular:
* A data URL that begins with "data:," or "data:;base64," (with no MIME
type) is assumed to have the MIME type
"text/plain;charset=us-ascii" under RFC2397.
* A data URL that begins with "data:;" (with no type or subtype, but with
parameters) is assumed to have the MIME type
"text/plain" under RFC2397.
* The word "base64" can only appear at the end of the MIME type, so that a
data URL like
"data:application/example;base64;foo=bar,AA==" will not be encoded in
base64, strictly speaking. A parameter name (base64 or otherwise)
cannot otherwise appear without a parameter value.
More information about the whatwg