From AutomationWiki
Jump to: navigation, search


HTTP i.e. Hyper Text Transfer Protocol is a client-server network protocol which has been in use by the World-Wide Web global information initiative since 1990. Whenever we surf the web, our browser sends HTTP request messages for HTML pages, images, scripts and styles sheets. These requests are handled by returning response messages which contain the requested resource.

HTTP Features[edit]

  1. It is an application-level protocol for distributed, collaborative, hypermedia information systems.
  2. The first version of HTTP, known as HTTP/0.9, was a simple protocol for raw data transfer across the Internet.
  3. The HTTP protocol is a request/response protocol.
  4. Most HTTP communication is initiated by a user agent and consists of a request to be applied to a resource on some origin server. This can be accomplished simply via a single connection between the user agent and the origin server.
  5. HTTP communication typically takes place over TCP/IP connections. The default port is TCP 80 [19], but other ports can be used. This does not prohibit HTTP from being implemented on top of any other protocol on the Internet, or on other networks.
  6. HTTP only presumes a reliable transport hence any protocol providing such guarantees can be used.
  7. HTTP is designed to be simple and outstandingly fast.

Request/Response protocol[edit]

HTTP is a request/response standard of a client and a server. A client is the end-user and the server is the web site. The client making a HTTP request using a web browser, spider, or other end-user tool is known as the user agent and the responding server which stores or creates resources such as HTML files and images is called the origin server. A client sends a request to the server in the form of a request method, URI, and protocol version, followed by a MIME-like message containing request modifiers, client information, and possible body content over a connection with a server. The server responds with a status line, including the message's protocol version and a success or error code, followed by a MIME-like message containing server information, entity metainformation, and possible entity-body content.

HTTP Request Message[edit]

It has a simple text based structure. The request message consists of the following:

  1. Request line, For example: GET /images/logo.gif HTTP/1.1 which means a resource called /images/logo.gif is requested from server
  2. Headers like Accept-Language: en
  3. An empty line
  4. An optional message body

The request line and headers must all end with <CR><LF> i.e. a carriage return followed by a line feed. The empty line must consist of only <CR><LF> and no other whitespace. In the HTTP/1.1 protocol, all headers except Host are optional.

The web server's response message has a similar structure, but is followed by the contents of the HTML page.

Request methods[edit]

HTTP defines following eight methods for indicating the preferred action to be performed on the identified resource

  1. HEAD: This method asks for the response identical to the one that would correspond to a GET request, but without the response body. This method is useful for retrieving meta-information written in response headers, without transporting the entire content.
  2. GET: This method is used for requesting a representation of the specified resource. GET should not be used for operations that cause side-effects, such as using it for taking actions in web applications.
  3. POST: It submits data to be processed to the identified resource. The data is included in the body of the request. This may result in the creation of a new resource or the updates of existing resources or both.
  4. PUT: Used for uploading a representation of the specified resource.
  5. DELETE: It is used for deleting the specified resource.
  6. TRACE: Use of this method echoes back the received request, so that a client can see what intermediate servers are adding or changing in the request.
  7. OPTIONS: This request method returns the HTTP methods supported by the server for specified URL. This can be used to check the functionality of a web server by requesting '*' instead of a specific resource.
  8. CONNECT: It converts the request connection to a transparent TCP/IP tunnel, generally to facilitate SSL-encrypted communication (HTTPS) through an unencrypted HTTP proxy.

HTTP servers are required to implement at least the GET and HEAD methods and, whenever possible, also the OPTIONS method.


HTTP Watch