In a request message, the
The remainder of this section discusses the
Entity Header Fields
The
The following line shows the format for the
Entity-Header = Allow | Content-Encoding | Content-Length | Content-Type |
Expires | Last-Modified |
The
Allow
The Allow field is used to indicate which methods are supported by the resource requested in the request message. The format of the header field is
Allow = "Allow:" 1#method
An example is Allow: GET, HEAD. This header field is used to inform the user agent of which methods are valid for the resource being requested. However, it does not specify which methods are implemented by the server. Also, the use of this field does not prevent the user agent from attempting to perform other methods upon the resource. Nevertheless, it is good practice to follow the advice of this header field.
Content-Type, Content-Encoding, and Content-Length
These header fields indicate the type of resource being returned, how it is encoded, and the size of the
Content-Type = "Content-Type:"
Content-Encoding = "Content-Encoding:"
Content-Length = "Content-Length:" 1*DIGIT
The Content-Type header indicates the media type used for the
The Content-Type field can be used by the user agent to determine how to present the resource to the user. The content types are used by Web browsers when setting up helper applications that are external applications used to display specific file types (also known as media types). For instance, a Content-Type of audio/basic represents a sound file that the typical Web browser has to present to the user through an external application.
The Content-Encoding field is a modifier to the Content-Type header and indicates whether and how a resource has been encoded before transmission. This is used when a resource has been compressed, for example. The user agent must use the encoding information in order to decode the data received before presenting it to the human user.
The Content-Length indicates the size of the
Expires
As the name of this header field indicates, the Expires entity header indicates the date after which the entity should be considered expired or invalid. This can be returned by applications that are generating real-time data, for example, to indicate the date (and time) after which the entity should be considered as old news. Caches should not retain the entity after the date specified.
The presence of an Expires header does not mean that the resource will change or no longer exist after the value specified, but simply that it will be "stale" (to use the wording from the Internet-Draft). If the value specified is 0 or is an invalid HTTP date, the resource should be considered as immediately expired and should not be cached in any way.
The format for the Expires header is
Expires = "Expires:"
Last-Modified
The Last-Modified header field indicates the date that the server believes the resource was last changed. The value is interpreted differently depending on the nature of the resource being transferred. This header can be used to determine whether a new copy of a resource should be retrieved or if the user should be notified that the resource has been changed. For a file resource, it is most likely to be the date that the file was last saved. For a database resource, this field can be used to indicate the date a record was last updated. The possibilities are endless.
The format for the Last-Modified header is
Last-Modified = "Last-Modified:"
When you write server-side applications, it is important to think about how this field should be used if the resource is time-sensitive. If you're writing a user-agent application, take care when attempting to interpret this field's value.