HTTP: HyperText Transport Protocol
A top-level view of how HTTP works:

The following is a summary of web server operations as
originally defined in the HTTP specification.
Terminology (adapted from RFC 2616)
 | Connection: A transport layer virtual circuit/connection established
between two programs for the purpose of communication. |
 | Message: The basic unit of HTTP communication, consisting of a structured
sequence of octets matching the syntax defined in section 4 and transmitted
via the connection. |
 | Request: An HTTP request message that sends information from the browser
to the server. |
 | Response: An HTTP response message containing information for the client
(usually in HTML/MIME format). |
 | Client: A program that establishes connections for the purpose of sending
requests. |
 | User agent: The client which initiates a request. These are often
browsers, editors, spiders (web-traversing robots), or other end user tools. |
 | Server: An application program that accepts connections in order to
service requests by sending back responses. Any given program may be capable
of being both a client and a server; our use of these terms refers only to
the role being performed by the program for a particular connection, rather
than to the program's capabilities in general. Likewise, any server may act
as an origin server, proxy, gateway, or tunnel, switching behavior based on
the nature of each request. |
 | Proxy: An intermediary program which acts as both a server and a client
for the purpose of making requests on behalf of other clients. Requests are
serviced internally or by passing them on, with possible translation, to
other servers. A proxy MUST implement both the client and server
requirements of this specification. A "transparent proxy" is a
proxy that does not modify the request or response beyond what is required
for proxy authentication and identification. A "non-transparent
proxy" is a proxy that modifies the request or response in order to
provide some added service to the user agent, such as group annotation
services, media type transformation, protocol reduction, or anonymity
filtering. Except where either transparent or non-transparent behavior is
explicitly stated, the HTTP proxy requirements apply to both types of
proxies. |
 | Gateway: A server which acts as an intermediary for some other server.
Unlike a proxy, a gateway receives requests as if it were the origin server
for the requested resource; the requesting client may not be aware that it
is communicating with a gateway. |
 | Cache: A program's local store of response messages and the subsystem that
controls its message storage, retrieval, and deletion. A cache stores
cacheable responses in order to reduce the response time and network
bandwidth consumption on future, equivalent requests. Any client or server
may include a cache, though a cache cannot be used by a server that is
acting as a tunnel. |
For more...
Operation of HTTP
Connection
 | The client makes a TCP-IP connection to the host using the domain name or
IP number , and the port number given in the address. |
 | If the port number is not specified, 80 is always assumed for HTTP. |
 | The server accepts the connection. |
 | Note: HTTP currently runs over TCP, but could run over any
connection-oriented service. |
Request
 | The client sends a document request consisting of a line of ASCII
characters terminated by a CR LF (carriage return, line feed) pair. A
well-behaved server will not require the carriage return character. |
 | This request consists of the word "GET", a space, the document
address , omitting the "http:, host and port parts when they are the
coordinates just used to make the connection. (If a gateway is being used,
then a full document address may be given specifying a different naming
scheme). |
 | The document address will consist of a single word (ie no spaces). If any
further words are found on the request line, they MUST either be ignored, or
else treated according to the full HTTP spec . |
 | The search functionality of the protocol lies in the ability of the
addressing syntax to describe a search on a named index . |
 | A search should only be requested by a client when the index document
itself has been described as an index using the ISINDEX tag . |
Response
 | The response to a simple GET request is a message in hypertext mark-up
language ( HTML ). This is a byte stream of ASCII characters. |
 | Lines shall be delimited by an optional carriage return followed by a
mandatory line feed character. The client should not assume that the
carriage return will be present. Lines may be of any length. Well-behaved
servers should restrict line length to 80 characters excluding the CR LF
pair. |
 | The format of the message is HTML - that is, a trimmed SGML document. Note
that this format allows for menus and hit lists to be returned as hypertext.
It also allows for plain ASCII text to be returned following the PLAINTEXT
tag . |
 | The message is terminated by the closing of the connection by the server. |
 | Well-behaved clients will read the entire document as fast as possible.
The client shall not wait for user action (output paging for example) before
reading the whole of the document. The server may impose a timeout of the
order of 15 seconds on inactivity. |
 | Error responses are supplied in human readable text in HTML syntax. There
is no way to distinguish an error response from a satisfactory response
except for the content of the text. |
Disconnection
 | The TCP-IP connection is broken by the server when the whole document has
been transferred. |
 | The client may abort the transfer by breaking the connection before this,
in which case the server shall not record any error condition. |
 | Requests are independent . The server need not store any information about
the request after disconnection. |
Client Methods
Client methods are the information sent to a web server by the client (web
browser) that determines what actions are desired. The general types of
methods include:
 | Get: requests a specific document from the server; may include output from
a script; may include a querystring with data. |
 | Head: server will respond with header information only, no entity-body. |
 | Post: send data to the server in the entity-body of the client request;
file uploads can also be accomplished under the post method. |
 | Put: store data to the server. |
 | Delete: remove data from the server. |
 | Trace: follow the path of a request through various proxy servers. |
 | Options: server returns options available for a server. |
 | Connect: enables a connection to another server, typically a secure
server. |
Server Response Codes
The following codes are returned from the server. Also included are
some of the typical responses:
 | 100-199 -- informational |
 | 200-299 -- client request successful
 | 200 -- OK |
 | 201 -- Created (new URL) |
 | 202 -- request accepted, but not immediately acted upon |
|
 | 300-399 -- client request redirected, further action necessary
 | 300 -- multiple choices |
 | 301 -- moved permanently |
 | 302 -- found |
 | 305 -- proxy used |
|
 | 400-499 -- client request incomplete
 | 400 -- bad request |
 | 401 -- unauthorized |
 | 402 -- payment required |
 | 403 -- forbidden |
 | 404 -- not found |
 | 405 -- method not found |
|
 | 500-599 -- server errors
 | 500 -- internal server error |
 | 501 -- not implemented |
 | 502 -- bad gateway |
|
|