only for RuBoard - do not distribute or recompile Previous Section Next Section

1.10 Media Types

One of the most important functions of headers is to make it possible for the recipient of the data to know what kind of data it is receiving, and thus be able to process it appropriately. If the client didn't know that the data returned by the server was a GIF image, it wouldn't know how to render it on the screen. If it didn't know that some other data was an audio snippet, it wouldn't know to call up an external helper application. For negotiating different data types, HTTP incorporated Internet Media Types, which look a lot like MIME types but are not exactly MIME types.

The client tells the server which media types it can handle, using the Accept header. The server tries to return information in one of the client's preferred media types, and declares the type of the data using the Content-type header.

The Accept header is used to specify the client's preference for media formats, or to tell the server that it can accept unusual document types. If this header is omitted, the server assumes that the client can accept any media type. The Accept header can have three general forms:

Accept: */*
Accept: type/*
Accept: type/subtype

Using the first form, */*, indicates that the client can accept an entity-body of any media type. The second form, type/*, communicates that an entity-body of a certain general class is acceptable. A client may issue an Accept: image/* to accept images, where the type of image (GIF, JPEG, or whatever) is not important. The third form indicates that an entity-body from a certain type and subtype is acceptable. For example, a browser that can only accept GIF files may use Accept: image/gif.

The client specifies multiple document types that it can accept by separating the values with commas:

Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*

Some older browsers send the same line as:

Accept: image/gif
Accept: image/x-xbitmap
Accept: image/jpeg
Accept: image/pjpeg
Accept: */*

When developing a new application, it is recommended that it conform to the newer practice of separating multiple document preferences by commas, with a single Accept header.

In the server's response, the Content-type header describes the type and subtype of the media. If the client specified an Accept header, the media type should conform to the values used in the Accept header. Clients use this information to correctly handle the media type and format of the entity-body.

A client might also use a Content-type header with the POST or PUT method. Most commonly, with many CGI applications, clients use a POST or PUT request with information in the entity-body, and supply a Content-type header to describe what data can be expected in the entity-body.

Table 1.2 lists commonly used media types, along with the filename suffixes that are recognized by most servers. These servers can be easily configured to recognize additional suffixes as well.

Table 1.2. Internet Media Types

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

only for RuBoard - do not distribute or recompile Previous Section Next Section