AJAX - The Complete Reference

(avery) #1

B HTTP 1.1 Reference


H


ypertext Transport Protocol (HTTP) is the application layer protocol that powers
the Web. The protocol is relatively simple and defines solely how a client or user-
agent must ask for data from a server and how the server returns it. Understanding
the details of HTTP is fundamental to Ajax, as developers using the technology are required
to issue and handle HTTP requests manually. However, while HTTP knowledge is
mandatory for Ajax developers, going deeper into the network stack offers diminishing
value because the higher level HTTP protocol aims to shield us from the details of lower-
level protocols such as TCP, which provide data transport.
Currently, most user-agents implement HTTP/1.1 as defined in RFC 2616 (www.w3.org/
Protocols/rfc2616/rfc2616.html), which was finalized in 1999. This version of HTTP
contains many features that primarily address performance limitations found in HTTP/1.0
as defined by RFC 1945 (www.w3.org/Protocols/rfc1945/rfc1945), which was introduced
three years earlier.

NNOT EOTE An initial version of HTTP dubbed HTTP 0.9 existed as early as late 1991. This version
of HTTP is a subset of HTTP/1.0 and 1.1 and is rarely if ever encountered today.

HTTP Requests


Like any network protocol, HTTP requests have two primary components: headers and
a data payload. The request itself is specifically broken up into the following parts:


  • A request line indicating which HTTP method to invoke on a particular resource

  • A number of headers on individual lines, some of which may be required,
    depending on the version of HTTP, and some which are optional

  • A termination of the header section as indicated by two carriage return linefeed
    (CRLF) characters

  • An optional payload of some data in a format indicated by a MIME type value
    found in the Content-Type header


The request line is of the following format:

HTTP-Method Resource-identifier HTTP-version

587


Appendix


http://www.ebooks.org.in

Free download pdf