Book HomeWebmaster in a Nutshell, 3rd EditionSearch this book

17.5. Media Types and Subtypes

Media types are used to communicate the format of the content in HTTP transactions. Clients use media types in their Accept headers to indicate what formats they prefer to receive data in. Servers use media types in their Content-Type headers to tell the client what format the accompanying entity is in—i.e., whether the enclosed text is HTML that needs to be formatted, GIF or JPEG to be rendered, or PDF that requires opening an external viewer or using a plug-in.

Internet media types used by HTTP closely resemble MIME types. MIME (Multipurpose Internet Mail Extension) was designed as a method for sending attachments in email over the Internet. Like MIME, media types follow the format type/subtype. Asterisks (*) represent a wildcard. For example, the following client header means that documents of all formats are accepted:

Accept: */*

The following client header means that all text format types are accepted, regardless of the subtype:

Accept: text/*

Servers and CGI programs are expected to examine the format types reported by the Accept header and return data of an acceptable type when possible. Most servers determine the format of a document from its filename suffix—for example, a file ending with .htm or .html is assumed to be HTML format, so the server sends the document with a Content-Type of text/html. When calling a CGI program, servers cannot know the format of the data being returned, so the CGI program is responsible for reporting the content type itself. For that reason, every CGI program needs to include a Content-Type header such as:

Content-Type: text/html

Table 17-1 lists commonly used media types, along with the filename suffixes recognized by most servers. The current IANA-approved list can be found at http://www.isi.edu/in-notes/iana/assignments/media-types/media-types. Servers can be easily configured to recognize additional suffixes as well.

Table 17-1. Media types and subtypes

Type/subtype

Usual extension

application/activemessage

 

application/andrew-inset

 

application/applefile

 

application/atomicmail

 

application/cals-1840

 

application/commonground

 

application/cybercash

 

application/dca-rft

 

application/dec-dx

 

application/EDI-Consent

 

application/EDIFACT

 

application/EDI-X12

 

application/eshop

 

application/hyperstudio

 

application/iges

 

application/mac-binhex40

 

application/macwriteii

 

application/marc

 

application/mathematica

 

application/msword

doc

application/news-message-id

 

application/news-transmission

 

application/octet-stream

bin

application/oda

oda

application/pdf

pdf

application/pgp-encrypted

 

application/pgp-signature

 

application/pgp-keys

 

application/pkcs7-mime

 

application/pkcs7-signature

 

application/pkcs10

 

application/postscript

ai, eps, ps

application/prs.alvestrand.titrax-sheet

 

application/prs.cww

 

application/prs.nprend

 

application/remote-printing

 

application/riscos

 

application/rtf

rtf

application/set-payment-initiation

 

application/set-payment

 

application/set-registration-initiation

 

application/set-registration

 

application/sgml

sgm, sgml, gml, dtd

application/sgml-open-catalog

soc, cat

application/slate

 

application/vemmi

 

application/vnd.$commerce_battelle

 

application/vnd.3M.Post-it-Notes

 

application/vnd.acucobol

 

application/vnd.anser-web-funds-transfer-initiation

 

application/vnd.anser-web-certificate-issue-initiation

 

application/vnd.audiograph

 

application/vnd.businessobjects

 

application/vnd.claymore

 

application/vnd.comsocaller

 

application/vnd.dna

 

application/vnd.dxr

 

application/vnd.ecdis-update

 

application/vnd.ecowin.chart

 

application/vnd.ecowin.filerequest

 

application/vnd.ecowin.fileupdate

 

application/vnd.ecowin.series

 

application/vnd.ecowin.seriesrequest

 

application/vnd.ecowin.seriesupdate

 

application/vnd.enliven

 

application/vnd.epson.salt

 

application/vnd.fdf

 

application/vnd.ffsns

 

application/vnd.FloGraphIt

 

application/vnd.framemaker

 

application/vnd.fujitsu.oasys

 

application/vnd.fujitsu.oasys2

 

application/vnd.fujitsu.oasys3

 

application/vnd.fujitsu.oasysprs

 

application/vnd.fujitsu.oasysgp

 

application/vnd.fujixerox.docuworks

 

application/vnd.hp-hps

 

application/vnd.hp-HPGL

 

application/vnd.hp-PCL

 

application/vnd.hp-PCLXL

 

application/vnd.ibm.MiniPay

 

application/vnd.ibm.modcap

 

application/vnd.intercon.formnet

 

application/vnd.intertrust.digibox

 

application/vnd.intertrust.nncp

 

application/vnd.is-xpr

 

application/vnd.japannet-directory-service

 

application/vnd.japannet-jpnstore-wakeup

 

application/vnd.japannet-payment-wakeup

 

application/vnd.japannet-registration

 

application/vnd.japannet-registration-wakeup

 

application/vnd.japannet-setstore-wakeup

 

application/vnd.japannet-verification

 

application/vnd.japannet-verification-wakeup

 

application/vnd.koan

 

application/vnd.lotus-wordpro

 

application/vnd.lotus-approach

 

application/vnd.lotus-1-2-3

 

application/vnd.lotus-organizer

 

application/vnd.lotus-screencam

 

application/vnd.lotus-freelance

 

application/vnd.meridian-slingshot

 

application/vnd.mif

 

application/vnd.minisoft-hp3000-save

 

application/vnd.mitsubishi.misty-guard.trustweb

 

application/vnd.ms-artgalry

 

application/vnd.ms-asf

 

application/vnd.ms-excel

 

application/vnd.ms-powerpoint

 

application/vnd.ms-project

 

application/vnd.ms-tnef

 

application/vnd.ms-works

 

application/vnd.music-niff

 

application/vnd.musician

 

application/vnd.netfpx

 

application/vnd.noblenet-web

 

application/vnd.noblenet-sealer

 

application/vnd.noblenet-directory

 

application/vnd.novadigm.EDM

 

application/vnd.novadigm.EDX

 

application/vnd.novadigm.EXT

 

application/vnd.osa.netdeploy

 

application/vnd.powerbuilder6

 

application/vnd.powerbuilder6-s

 

application/vnd.rapid

 

application/vnd.seemail

 

application/vnd.shana.informed.formtemplate

 

application/vnd.shana.informed.formdata

 

application/vnd.shana.informed.package

 

application/vnd.shana.informed.interchange

 

application/vnd.street-stream

 

application/vnd.svd

 

application/vnd.swiftview-ics

 

application/vnd.truedoc

 

application/vnd.visio

 

application/vnd.webturbo

 

application/vnd.wrq-hp3000-labelled

 

application/vnd.wt.stf

 

application/vnd.xara

 

application/vnd.yellowriver-custom-menu

 

application/wita

 

application/wordperfect5.1

 

application/x-bcpio

bcpio

application/x-cpio

cpio

application/x-csh

csh

application/x-dvi

dvi

application/x-gtar

gtar

application/x-hdf

hdf

application/x-latex

latex

application/x-mif

mif

application/x-netcdf

nc, cdf

application/x-sh

sh

application/x-shar

shar

application/x-sv4cpio

sv4cpio

application/x-sv4crc

sv4crc

application/x-tar

tar

application/x-tcl

tcl

application/x-tex

tex

application/x-texinfo

texinfo, texi

application/x-troff-man

man

application/x-troff-me

me

application/x-troff-ms

ms

application/x-troff

t, tr, roff

application/x-ustar

ustar

application/x-wais-source

src

application/xml

xml, dtd

application/x400-bp

 

application/zip

zip

audio/32kadpcm

 

audio/32kadpcm

 

audio/basic

au, snd

audio/vnd.qcelp

wav

audio/x-aiff

aif, aiff, aifc

audio/x-wav

wav

image/cgm

cgm

image/g3fax

 

image/gif

gif

image/ief

ief

image/jpeg

jpeg, jpg, jpe

image/naplps

 

image/png

png

image/tiff

tiff, tif

image/vnd.dwg

 

image/vnd.dxf

 

image/vnd.fpx

 

image/vnd.net-fpx

 

image/vnd.svf

 

image/vnd.xiff

 

image/x-cmu-raster

ras

image/x-portable-anymap

rpnm

image/x-portable-bitmap

pbm

image/x-portable-graymap

pgm

image/x-portable-pixmap

ppm

image/x-rgb

rgb

image/x-xbitmap

xbm

image/x-xpixmap

xpm

image/x-xwindowdump

xwd

message/external-body

 

message/http

 

message/news

 

message/partial

 

message/rfc822

 

model/iges

 

model/mesh

 

model/vnd.dwf

 

model/vrml

 

multipart/alternative

 

multipart/appledouble

 

multipart/digest

 

multipart/form-data

 

multipart/header-set

 

multipart/mixed

 

multipart/parallel

 

multipart/related

 

multipart/report

 

multipart/voice-message

 

text/enriched

 

text/html

html, htm

text/plain

txt

text/richtext

rtx

text/sgml

sgm, sgml, gml, dtd

text/tab-separated-values

tsv

text/xml

xml, dtd

text/x-setext

etx

video/mpeg

mpeg, mpg, mpe

video/quicktime

qt, mov

video/vnd.vivo

 

video/vnd.motorola.video

 

video/vnd.motorola.videop

 

video/x-msvideo

qvi

video/x-sgi-movie

movie



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.