Skip to Main Content
Webmaster in a Nutshell, Third Edition
book

Webmaster in a Nutshell, Third Edition

by Robert Eckstein, Stephen Spainhour
December 2002
Intermediate to advanced content levelIntermediate to advanced
576 pages
32h
English
O'Reilly Media, Inc.
Content preview from Webmaster in a Nutshell, Third Edition

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Webmaster in a Nutshell, Second Edition

Webmaster in a Nutshell, Second Edition

Stephen Spainhour, Robert Eckstein

Publisher Resources

ISBN: 0596003579Purchase bookErrata Page