Is there an up to date list of all common content types returned from web servers?
For intance, text/html, audio/mpeg, etc? Can I saf开发者_高级运维ely assume that anything that is text based will actually have text/??? as its content type in the header when the server returns the document?
The IANA acts as a central registry for official types. They provide a directory of content types and subtypes that is work a look.
When serving static content, the Apache web server uses a file called mime.types
to map a file's extension to an appropriate content type. This can be taken from a fresh download of httpd itself, or from the Apache project's SVN server.
No, you can't assume that. There's types like 'application/xml' (which is exactly the same thing as 'text/xml', so I have no idea why they came up with that one).
精彩评论