[Next] [Previous] [Up] [Top] [Full Contents] [Search]

7. Entity

7.1 Entity Header Fields

This section specifies the format and semantics of the Entity-Header fields. Entity-Header fields define optional metainformation about the Entity-Body or, if no body is present, about the resource identified by the request.

Entity-Header	=	Allow
	|	Content-Encoding
	|	Content-Language
	|	Content-Length
	|	Content-Transfer-Encoding
	|	Content-Type
	|	Derived-From
	|	Expires
	|	Last-Modified
	|	Link
	|	Location
	|	Title
	|	URI-header
	|	Version
	|	extension-header
extension-header	=	HTTP-header
Each entity header field is explained in the subsections below. Other header fields are allowed but cannot be assumed to be recognizable by the recipient. Unknown header fields should be ignored by the recipient and forwarded by proxies.

Note
It has been proposed that any HTML metainformation element (allowed within the <HEAD> element of a document) be a valid candidate for an HTTP entity header. This document defines two header fields, Link and Title, which are both examples of this. Base will be used in future versions of HTTP.

7.1.1 Allow

The Allow header field lists the set of methods supported by the resource identified by the Request-URI. The purpose of this field is strictly to inform the recipient of valid methods associated with the resource; it must be present in a response with status code "405 Method Not Allowed".

Allow	=	"Allow" ":" 1#method
Example of use:

Allow: GET, HEAD, PUT
This does not prevent a client from trying other methods. However, it is recommended that the indications given by this field be followed. This field has no default value; if left undefined, the set of allowed methods is defined by the origin server at the time of each request.

If a response passes through a proxy which does not understand one or more of the methods indicated in the Allow header, the proxy must not modify the Allow header; the user agent may have other means of communicating with the origin server.

7.1.2 Content-Encoding

The Content-Encoding header field is used as a modifier to the media-type. When present, its value indicates what additional encoding mechanism has been applied to the resource, and thus what decoding mechanism must be applied in order to obtain the media-type referenced by the Content-Type header field. The Content-Encoding is primarily used to allow a document to be compressed without losing the identity of its underlying media type.

Content-Encoding	=	"Content-Encoding" ":" encoding-mechanism
Encoding mechanisms are defined in Section 8.4. An example of its use is

Content-Encoding: gzip
The Content-Encoding is a characteristic of the resource identified by the Request-URI. Typically, the resource is stored with this encoding and is only decoded before rendering or analogous usage.

7.1.3 Content-Language

The Content-Language field describes the natural language(s) of the intended audience for the enclosed entity. Note that this may not be equivalent to all the languages used within the entity.

Content-Language	=	"Content-Language" ":" 1#language-tag
Language tags are defined in Section 8.2. The primary purpose of Content-Language is to allow a selective consumer to identify and differentiate resources according to the consumer's own preferred language. Thus, if the body content is intended only for a Danish audience, the appropriate field is

Content-Language: dk
If no Content-Language is specified, the default is that the content is intended for all language audiences. This may mean that the sender does not consider it to be specific to any natural language, or that the sender does not know for which language it is intended.

Multiple languages may be listed for content that is intended for multiple audiences. For example, a rendition of the "Treaty of Waitangi," presented simultaneously in the original Maori and English versions, would call for

Content-Language: mi, en
However, just because multiple languages are present within an entity does not mean that it is intended for multiple linguistic audiences. An example would be a beginner's language primer, such as "A First Lesson in Latin," which is clearly intended to be used by an English audience. In this case, the Content-Language should only include "en".

Content-Language may be applied to any media type -- it should not be considered limited to textual documents.

7.1.4 Content-Length

The Content-Length header field indicates the size of the Entity-Body (in decimal number of octets) sent to the recipient or, in the case of the HEAD method, the size of the Entity-Body that would have been sent had the request been a GET.

Content-Length	=	"Content-Length" ":" 1*DIGIT
An example is

Content-Length: 3495
Although it is not required, applications are strongly encouraged to use this field to indicate the size of the Entity-Body to be transferred, regardless of the media type of the entity.

Any Content-Length greater than or equal to zero is a valid value. Section 7.2.2 describes how to determine the length of an Entity-Body if a Content-Length is not given.

Note
The meaning of this field is significantly different from the corresponding definition in MIME, where it is an optional field used within the "message/external-body" content-type. In HTTP, it should be used whenever the entity's length can be determined prior to being transferred.

7.1.5 Content-Transfer-Encoding

The Content-Transfer-Encoding (CTE) header indicates what (if any) type of transformation has been applied to the entity in order to safely transfer it between the sender and the recipient. This differs from the Content-Encoding in that the CTE is a property of the message, not of the original resource.

Content-Transfer-Encoding	=	"Content-Transfer-Encoding" ":" transfer-encoding
Transfer encodings are defined in Section 8.5. Because all HTTP transactions take place on an 8-bit clean connection, the default Content-Transfer-Encoding for all messages is binary. However, HTTP may be used to transfer MIME messages which already have a defined CTE. An example is:

Content-Transfer-Encoding: quoted-printable
Many older HTTP/1.0 applications do not understand the Content-Transfer-Encoding header. However, since it may appear in any MIME message (i.e. entities retrieved via a gateway to a MIME-conformant protocol), future HTTP/1.0 applications are required to understand it upon receipt. Gateways are the only HTTP applications that would generate a CTE.

7.1.6 Content-Type

The Content-Type header field indicates the media type of the Entity-Body sent to the recipient or, in the case of the HEAD method, the media type that would have been sent had the request been a GET.

Content-Type	=	"Content-Type" ":" media-type
Media types are defined in Section 8.1. An example of the field is

Content-Type: text/html; charset=ISO-8859-4
The Content-Type header field has no default value. Further discussion of methods for identifying the media type of an entity is provided in Section 7.2.1.

7.1.7 Derived-From

The Derived-From header field can be used to indicate the version tag of the resource from which the enclosed entity was derived before modifications were made by the sender. This field is used to help manage the process of merging successive changes to a resource, particularly when such changes are being made in parallel and from multiple sources.

Derived-From	=	"Derived-From" ":" version-tag
An example use of the field is:

Derived-From: 2.1.1
A longer example of version control is included in Appendix C. The Derived-From field is required for PUT requests if the entity being put was previously retrieved from the same URI and a Version header was included with the entity when it was last retrieved.

7.1.8 Expires

The Expires field gives the date/time after which the entity should be considered stale. This allows information providers to suggest the volatility of the resource. Caching clients (including proxies) must not cache this copy of the resource beyond the date given, unless its status has been updated by a later check of the origin server. The presence of an Expires field does not imply that the original resource will change or cease to exist at, before, or after that time. However, information providers that know (or even suspect) that a resource will change by a certain date are strongly encouraged to include an Expires header with that date. The format is an absolute date and time as defined by HTTP-date in Section 3.3.

Expires	=	"Expires" ":" HTTP-date
An example of its use is

Expires: Thu, 01 Dec 1994 16:00:00 GMT
The Expires field has no default value. If the date given is equal to or earlier than the value of the Date header, the recipient must not cache the enclosed entity. If a resource is dynamic by nature, as is the case with many data-producing processes, copies of that resource should be given an appropriate Expires value which reflects that dynamism.

The Expires field cannot be used to force a user agent to refresh its display or reload a resource; its semantics apply only to caching mechanisms, and such mechanisms need only check a resource's expiration status when a new request for that resource is initiated.

Note
Applications are encouraged to be tolerant of bad or misinformed implementations of the Expires header. In particular, recipients may wish to recognize a delta-seconds value (any decimal integer) as representing the number of seconds after receipt of the message that its contents should be considered expired. Likewise, a value of zero (0) or an invalid date format may be considered equivalent to an "expires immediately." Although these values are not legitimate for HTTP/1.0, a robust implementation is always desirable.

7.1.9 Last-Modified

The Last-Modified header field indicates the date and time at which the sender believes the resource was last modified. The exact semantics of this field are defined in terms of how the receiver should interpret it: if the receiver has a copy of this resource which is older than the date given by the Last-Modified field, that copy should be considered stale.

Last-Modified	=	"Last-Modified" ":" HTTP-date
An example of its use is

Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
The exact meaning of this header field depends on the implementation of the sender and the nature of the original resource. For files, it may be just the file system last-mod date. For entities with dynamically included parts, it may be the most recent of the set of last-mod dates of its component parts. For database gateways, it may be the last-update timestamp of the record. For virtual objects, it may be the last time the internal state changed. In any case, the recipient should only know (and care) about the result -- whatever gets stuck in the Last-Modified field -- and not worry about how that result was obtained.

7.1.10 Link

The Link header provides a means for describing a relationship between the entity and some other resource. An entity may include multiple Link values. Links at the metainformation level typically indicate relationships like hierarchical structure and navigation paths. The Link field is semantically equivalent to the <LINK> element in HTML [4].

Link	=	"Link" ":" 1#("<" URI ">"
		[ ";" "rel" "=" relation ]
		[ ";" "rev" "=" relation ]
		[ ";" "title" "=" quoted-string ] )
relation	=	sgml-name
sgml-name	=	ALPHA *( ALPHA | DIGIT | "." | "-" )
Relation values are not case-sensitive and may be extended within the constraints of the sgmlname syntax. There are no predefined link relationship values for HTTP/1.0. The title parameter may be used to label the destination of a link such that it can be used as identification within a human-readable menu. Examples of usage include:

Link: <http://www.cern.ch/TheBook/chapter2>; rel="Previous"
Link: <mailto:timbl@w3.org>; rev="Made"; title="Tim Berners-Lee"
The first example indicates that the entity is previous to chapter2 in a logical navigation path. The second indicates that the publisher of the resource is identified by the given e-mail address.

7.1.11 Location

The Location header field is an earlier form of the URI-header and is considered obsolete. However, HTTP/1.0 applications should continue to support the Location header in order to properly interface with older applications. The purpose of Location is identical to that of the URI-header, except that no variants can be specified and only one absolute location URL is allowed.

Location	=	"Location" ":" URI
An example is

Location: http://info.cern.ch/hypertext/WWW/NewLocation.html

7.1.12 Title

The Title header field indicates the title of the entity

Title	=	"Title" ":" *text
An example of the field is

Title: Hypertext Transfer Protocol -- HTTP/1.0
This field is to be considered isomorphic with the <TITLE> element in HTML [4].

7.1.13 URI

The URI-header field may contain one or more Universal Resource Identifiers (URIs) by which the resource origin of the entity can be identified. There is no guarantee that the resource can be accessed using the URI(s) specified. This field is required for the 201, 301, and 302 response messages, and may be included in any message that contains resource metainformation.

URI-header	=	"URI" ":" 1#( "<" URI ">" [ ";" vary ] )
vary	=	"vary" "=" <"> 1#vary-dimension <">
vary-dimension	=	"type" | "language" | "version" | "encoding"
	|	"charset" | "user-agent" | extension-vary
extension-vary	=	token
Any URI specified in this field can be either absolute or relative to the URI given in the RequestLine. The URI-header improves upon the Location header field described in Section 7.1.11. For backwards compatibility with older clients, servers are encouraged to include both header fields in 301 and 302 responses.

The URI-header may also be used by a client performing a POST request to suggest a URI for the new entity. Whether or not the suggested URI is used is entirely up to the server to decide. In any case, the server's response must include the actual URI(s) of the new resource if one is successfully created (status 201).

If a URI refers to a set of variants, then the dimensions of that variance must be given with a vary parameter. One example is:

URI: <http://info.cern.ch/hypertext/WWW/TheProject.multi>;
     vary="type,language"
which indicates that the URI covers a group of entities that vary in media type and natural language. A request for that URI will result in a response that depends upon the client's request headers for Accept and Accept-Language. Similar dimensions exist for the Accept-Encoding, Accept-Charset, Version, and User-Agent header fields, as demonstrated in the following example.

URI: <TheProject.ps>;vary="encoding,version",
     <TheProject.html>;vary="user-agent,charset,version"
The vary parameter has an important effect on cache management, particularly for caching proxies which service a diverse set of user agents. Since the response to one user agent may differ from the response to a second user agent if the two agents have differing request profiles, a caching proxy must keep track of the content metainformation for resources with varying dimensions. Thus, the vary parameter tells the caching proxy what entity headers must be part of the key for caching that URI. When the caching proxy gets a request for that URI, it must forward the request toward the origin server if the request profile includes a variant dimension that has not already been cached.

7.1.14 Version

The Version field defines the version tag associated with a rendition of an evolving entity. Together with the Derived-From field described in Section 7.1.7, it allows a group of people to work simultaneously on the creation of a work as an iterative process. The field should be used to allow evolution of a particular work along a single path. It should not be used to indicate derived works or renditions in different representations.

Version	=	"Version" ":" version-tag
version-tag	=	token | quoted-string
Examples of the Version field include:

Version: 2.1.2
Version: "Fred 19950116-12:26:48"
Version: 2.5a4-omega7
The version tag should be considered opaque to all parties but the origin server. A user agent can request a particular version of an entity by including its tag in a Version header as part of the request. Similarly, a user agent may suggest a value for the version of an entity transferred via a PUT or POST request. However, only the origin server can reliably assign or increment the version tag of an entity.


T. Berners-Lee, R. T. Fielding, H. Frystyk Nielsen - 12 MAR 95

[Next] [Previous] [Up] [Top] [Full Contents] [Search]

Generated with CERN WebMaker