AJAX - The Complete Reference

(avery) #1

590 Part IV: Appendixes


General Headers


General headers are, as their name indicates, very general. These headers provide the most
basic information about a request or response. All of the general headers are detailed in
Table B-3; while some like Date are quite common, others like Upgrade or Trailer will
rarely be seen.

Entity Headers


Another class of headers, entity headers, are related to the actual message payload of an
HTTP request or response. Since most requests, except POST or PUT method requests, do
not send data to a server, these headers are often seen more in responses. Table B-4 presents
a brief overview of this class of headers.

Header Description Examples
Cache-
Control

Passes cache control information to
server or client. There are many options
for the header, and this header may need
to be accompanied by other headers
such as date/time indications, a unique
payload header like ETag or Pragma
headers in order to completely control
caching.

Cache-control: max-age=6666989

Cache-control: private

Connection Used by the user-agent or server to
specify how the connection should be
handled. Typically, the value of close
is used to tell a server to close the
connection after the response. The
server may also respond with the
header, and it will often set it to a value
of keep-alive to indicate to the client
that the connection should be persistent.
However, by default without a close value
a persistent connection is generally
implied by HTTP/1.1.

Connection: close

Connection: keep-alive

Date Indicates the date and time that a
request or response was made in
Greenwich Mean Time (GMT). GMT time
is mandatory for time consistency, given
the worldwide nature of the Web.

Date: Sun, 11 Aug 2001
13:24:52 GMT

Pragma Passes control information. For example,
this header can be used to inform a
caching proxy server to fetch a fresh
copy of a page. It is also used in
responses for cache control.

Pragma: no-cache

TABLE B-3 General HTTP 1.1 Headers
Free download pdf