What is content type header

August 6th, 2008 by admin

This is an example of content type header,

“Content-type: text/html; charset=iso-8859-1?

So what is this for? from the RFC 2616, you could get the explanation:

When an entity-body is included with a message, the data type of that
body is determined via the header fields Content-Type and Content-
Encoding. These define a two-layer, ordered encoding model:

entity-body := Content-Encoding( Content-Type( data ) )

Content-Type specifies the media type of the underlying data.
Content-Encoding may be used to indicate any additional content codings applied to the data, usually for the purpose of data compression, that are a property of the requested resource. There is no default encoding.
Any HTTP/1.1 message containing an entity-body should include a Content-Type header field defining the media type of that body.

Tags: , ,