URLs and HTTP

URL

Web clients are browsers, like IE. Browsers send requests to web servers (like Apache). A typical request is to download a web page. A browser usually makes this request when the user clicks a link in a web page.

The requested web page is identified by its Uniform Resource Locator (URL).

The format of a URL is:

protocol://server/page

For example:

http://www.unc.edu/home.html

In this example www.unc.edu is the server's domain name address.

The page is an HTML document.

A protocol is a conversational pattern. It's like a script in a play. It specifies the type and format of a client's request as well as the type and format of the server's response.

In the example above the protocol is http, which stands for Hyper Text Transfer Protocol.

HTTP

HTTP is a simple, stateless protocol. The browser sends a request to download (GET or POST), update (UPDATE), or delete (DELETE) a web page. In the case of a download, the server responds by sending an HTML document back to the browser. Most servers disable the UPDATE and DELETE commands.

HTTP request format

REQUEST NL (HEADER NL)* NL [BODY]

REQUEST ::= METHOD URI HTTP/VERSION
METHOD ::= GET | HEAD | POST | PUT | DELETE | OPTIONS | TRACE

HEADER ::= NAME: VALUE
NAME
::= Host | User-Agent | Cookie | etc.

Example:

GET /myapp/form.html HTTP/1.0

HTTP Response format

STATUS NL (HEADER NL)* NL DOCUMENT