To follow up my post asking Is HTTP Content Negotiation Broken as Designed?, I found a post by Ian Hickson on a related topic. In his post entitled Content-Type is dead he writes
Browsers and other user agents largely ignore the HTTP
Content-Type
header, relying on undefined sniffing heuristics to
determine what the content of a page really is.
- RSS feeds are always sniffed, regardless of their MIME type, because, to
quote a Safari engineer, "none of them have the right mime type".
- The target of
img
elements is almost always assumed to be an
image, regardless of the declared type.
- IE in particular is well known for ignoring the
Content-Type
header, despite this having been the source of security bugs in the past.
- Browsers have been forced to implement heuristics to handle
text/plain
files as binary because video files are widely served
with the wrong MIME types.
Unfortunately, we're now at a stage where browsers are continuously having to
reverse-engineer each other to determine why they are handling content
differently. A browser can't afford to render any less content than a browser
with more market share, because otherwise users won't switch, and the new
browser will not be adopted.
I think it may be time to retire the Content-Type
header,
putting to sleep the myth that it is in any way authoritative, and instead have
well-defined content-sniffing rules for Web content.
Ian is someone who's definitely been around the block when it comes
to HTTP given that he's been involved in Web standards groups for
several years and used to work on the Opera Web Browser. On the other side of the argument is Joe Gregorio who posts Content-Type is dead, for a short period of time, for new media-types, film at 11
which does an excellent job of the kind of dogmatic arguing based on
theory that I criticized in my previous post. In this case, Joe uses
the W3C Technical Architecture Groups (TAG) findings on Authoritative Metadata.
MIME types and HTTP content negotiation are good ideas in practice that
have failed to take hold on the Web. Arguing that this fact contravenes
stuff written in specs from last decade or from findings by some ivory
tower group of folks from the W3C seems like religous dogmatism and not
fodder for decent technical debate.
That said, I don't think MIME types should be retired. However I do think some Web/REST advocates need to look around and realize what's happening on the Web instead of arguing from an "ideal" or "theoretical" perspective.