Internet Media Type

from Wikipedia, the free encyclopedia

The Internet Media Type , also MIME-Type (according to the Multipurpose Internet Mail Extensions specification ) or Content-Type (according to the name of the field), classifies the data in the body of a message on the Internet . As explained in the MIME standard, z. For example, in the case of an HTTP transmission, a browser is informed of which data the web server is sending - whether it is, for example, a plain text document, an HTML document or a PNG image. The "Content-Type" header field is also used in e-mails to classify the various data.

Media types

The Internet Media Type consists of two parts: specifying a media type and specifying a sub-type. Both entries are separated from each other by a slash, example image / jpeg .

  • application - for uninterpreted binary data, mixed formats (e.g. text documents with embedded non-textual data) or information that is to be processed by a specific program
  • audio - for audio data
  • example - sample media type for documentation
  • image - for graphics
  • message - for messages, for example message / rfc822
  • model - for data representing multi-dimensional structures
  • multipart - for multipart data
  • text - for text
  • video - for video material
  • chemical - for z. E.g .: molecules (unofficial)

Over 130 subtypes are currently defined, and each generation of computers also integrates a large number of its own media types. The media types are managed by the Internet Assigned Numbers Authority .

Naming

A media type consists of a type and a sub-type that are structured as a tree . A media type can optionally also contain a suffix and parameters :

Typ "/" [Baum "."] Subtyp ["+" Suffix] *[";" Parameter]

Common examples

  • application/graphql
  • application/javascript
  • application/json
  • application/ld+json
  • application/msword (.doc)
  • application/pdf
  • application/sql
  • application/vnd.api+json
  • application/vnd.ms-excel (.xls)
  • application/vnd.ms-powerpoint (.ppt)
  • application/vnd.oasis.opendocument.text (.odt)
  • application/vnd.openxmlformats-officedocument.presentationml.presentation (.pptx)
  • application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (.xlsx)
  • application/vnd.openxmlformats-officedocument.wordprocessingml.document (.docx)
  • application/x-www-form-urlencoded
  • application/xml
  • application/zip
  • application/zstd (.zst)
  • audio/mpeg
  • audio/ogg
  • image/gif
  • image/jpeg
  • image/png
  • multipart/form-data
  • text/css
  • text/csv
  • text/html
  • text/php
  • text/plain
  • text/xml

MIME sniffing

If the MIME type is not specified, MIME sniffing should recognize the MIME type. First the first bytes of the document are read. Images in JPEG or PNG format can be easily distinguished by their header ( magic number ). If the analysis fails, the file extension is used. Then either a standard display is attempted, for example playback as an HTML file, or playback is aborted with an error message.

The order of the analysis is specified in protocol documents. The HTTP1.1 document demands that the specified content type is always used. MIME sniffing is only allowed to guess the type if it is missing.

See also

Web links