AJAX - The Complete Reference

(avery) #1

PART IV


Appendix B: HTTP 1.1 Reference 591


Request Headers


Most request headers are optional, save the Host header, which is required to make a complete
valid HTTP/1.1 request. However, typically a user agent sends extra headers indicating the
type of device making the request (User-Agent), the type of data it prefers (Accept), what
language is in use (Accept-Language), the type of encoding it supports (Accept-Encoding),
and so on. The value of this header information should not be understated. With it server side

Header Description Examples
Trailer In the case of chunked transfers as
indicated by the Transfer-Encoding
header, this header may be used to
specify which headers are found in
trailing chunks. In the example, we
should find an Expires header after
the final chunk. Note that you may
not include Transfer-Encoding,
Content-Length, or Trailer as
trailing headers in a message.

Trailer: Expires

Transfer-
Encoding

Indicates the way the entire message
is transferred. Typically used in the
situation of chunked encoding where a
message is transferred in chunks, with a
final zero length passed to terminate the
data stream.

Transfer-Encoding: chunked

Upgrade This rarely-seen header is used by client
or server to request the other to upgrade
to an alternate protocol if possible.
Servers may respond with a 101
Upgrading Protocols response plus
this header. A client would likely send it
as part of its initial request.

Upgrade: HTTP/2.0

Via Proxies, certain server programs, and
gateways according to specification must
add data to a Via: header to indicate
they passed or even modified the
request or response. However, because
of security implications of information
leakage, some devices may not do so.

Via: HTTPZip-Appliance

Warning This header carries extra information
about the request or response that might
not be reflected in the message, such as
what would be found in a response line.
These warning messages are primarily
used by proxy caches.

Warning: 110 Response is stale

TABLE B-3 General HTTP 1.1 Headers (continued)
Free download pdf