Powered by OPF
OPF WIKI STATIC ARCHIVE
2,681 pages · 153 spaces · 776 tags · 4,025 history records · 96.2% of the original wiki recovered
Archived copy. This page was recovered from the Internet Archive snapshot of /display/REQ/Server MIME Type Correction taken on 2013-07-16. The original wiki at wiki.opf-labs.org is being decommissioned.

Server MIME Type Correction

Created by Andrew Jackson on Sep 29, 2011 · last edited by Andrew Jackson · on Sep 29, 2011 (view history) · 3 versions
Title MIME Type Correction Mapping TAble
Detailed description Not a full-blown solution, but an initial analysis of the problem and of how to reconcile the problematic MIME types given out by servers with the results from the file tool.
Solution Champion Andrew Jackson
Corresponding Issue(s)
Tool/code link none at present
Tool Registry Link none at present
Evaluation Any notes or links on how the solution performed

MIME Mapping

The supplied data on server MIME types contained two types of error:

Most of the problems were of the former type. In particular, I learned that 'application/force-download' was being used to make IE download a PDF instead of viewing it inline. Also, the 'image/jpg' MIME type was being supplied, when the correct form is 'image/jpeg'. The solution in these cases is to make these commonly broken MIME types to the result from the file command. 

This also works for the second case, except where the result from the 'file' command cannot be trusted. Unfortunately, the domain over which file is correct is not clear, although it does seem that plain text is problematic. See

n.b. also noticed a different where something served as text/xml is being identified as application/xml.  This is a bit more subtle, as text/xml is now deprecated due to the fact that this implies charset=us-ascii and this may (usually will!) disagree with the encoding declared in the xml file itself.

Finally, it's worth noting that the open source shared-mime-info contains commonly mis-used MIME types and may help to resolve these issues. Also, note further that there is a fast implementation of the parser for this data file here: http://www.memecode.com/libsharedmime.php