HTTP Protocol

From 118wiki

Jump to: navigation, search

HTTP - The HyperText Transfer Protocol

HTTP is the protocol used between web servers and web browsers, but can be used for many other purposes. It is typical of a protocol used in a client server architecture, where the server waits for client(s) to connect and request something from the server. HTTP uses things such as URIs (Uniform Resource Identifier), URLs, and URNs (Uniform Resource Name) to identify objects, which can be web pages, images, and other media objects. The full protocol for HTTP is specified in several RFCs (Request for Comments documents), for instance RFC 2616.

The key points about HTTP, as opposed to other networking protocols, are:

  1. It is a client-server protocol. This means the behavior of the client (in the protocol) is different from the server's behavior. Also, it means that the client initiates things, by connecting to the server, rather than the other way around.
  2. The protocol is based on structured streams of bytes, where each stream starts with a header, and the header has well-defined syntax (in human-readable, text form).
  3. HTTP is neither specifically for Web pages (HTML), nor is it strictly targeted only for Internet (TCP) at lower layers.
  4. HTTP headers include some support for metadata about the content of the client request or server response. The metadata is useful for performance tuning, security, and administrative tasks.
  5. An HTTP server is a stateless server, and this has important consequences for application architecture (as opposed to stateful servers).

The details of HTTP get complicated by cache-update rules, proxy servers, secure HTTP (https), the "keep-alive connection" and pipelining of request facilities, and HTTP Cookies. Fortunately, a simple demonstration of HTTP is even possible at the command line in a unix shell using the telnet command (see HTTP Examples).

It's also very easy to create an HTTP server in Python using modules available in the standard library, and also simple to build your own user agent that communicates with an HTTP server, again using standard Python modules.

Personal tools