Mime types.. when will people learn?


HTTP has an incredible useful feature to supply the Content-Type HTTP header for any url. This allows HTTP clients to easily figure out what type of data they're getting.

Over and over again I see clients, not doing this and making assumptions based on the url. The extension of all things! This is some artifact inherited from ms-dos, and passed on to different operation systems when GUI's became popular.

Two clear examples I have today (and I'm sure many people will have examples like this)

  • Flash's VideoPlayer component. If there's no extension in the url, it will assume its some kind of xml file.
  • iTunes podcasts.. Files have to end with a known extension for iTunes to pick it up as a video or audio file. Even though the Mime type has to be specified in both the RSS feed and the HTTP Header!



Web mentions


  • Jim


    Shouldn't you be raving about Windows... or Mac? I am not sure about your OS, but using Linux a file with .dsakxklf will still be labeled as a video and associated with it's player as long as the video's type is correct. The issue is when there is no extension and no file type.
  • Evert


    That might be true, and that would also work for OS/X (where I'm on..). If something doesn't have that mark (on Linux or OS/X) the extension will however be used to determine a filetype..

    My rant wasn't really about the operation systems, but more about HTTP client implementors such as Apple and Adobe in this case..
  • sapphirecat


    Amen on the VideoPlayer thing. To get around that once, I had to write a URL like this: video.php?get=VIDEOID&hack=x.flv

  • Disher


    Pain in the ass!