HTTP (or, Hypertext Transfer Protocol) is a network protocol used for transferring files on the internet. It is a stateless protocol which can be used to send not just files but resources (like dynamically generated query results, output of CGI script and other data) also. HTTP resources are identified and located on the internet by Uniform resource Identifiers (or, URIs) or Uniform Resource Locators (or, URL).
HTTP/1.1 the current version of HTTP is a revision to the original HTTP. HTTP/1.1 allows content streaming on persistent connections. HTTP pipelining reduces lag time, allows multiple requests from clients and services the requests accordingly.
According to World Wide Web Consortium RFC, Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems.
HTTP facilitates communication between various types of hosts and clients from a complex set of mixed network configurations. Communication between host and client occur via request/response. The client sends a HTTP Request message which is served by HTTP Response.
The web browser is the HTTP Client as it sends requests to the HTTP Server (or web server), which then responds back to the browser with the required resource.
A HTTP client before making a request establishes a Transmission Control Protocol (or, TCP) connection to a particular port on a server (usually Port: 80 get used). The HTTP Server waits for the client message on the pre-defined port. The request is served by a status line and a message. The body of the message is returned as the requested resource, otherwise an error message or other information may also be returned.
A client uses a request method to send a request message to an HTTP Server. HTTP protocol specified request methods are as follows:
The first line of HTTP Response is called the status line. The status line includes a numeric status code and a reason phrase. The status code helps the clients to interpret response received from the server. Some of the most popular status codes starting with numbers 1,2,3,4 and 5 are listed below. The numbers 1,2,3,4 and 5 could be followed by other combinations represented by 'N'.
Introduced in HTTP/1.1 this class of code are provisional.
This code informs a client that the request was successfully processed.
It informs the client to take additional actions. Some of the codes are:
These codes are used by the server when it thinks there is a fault due to invalid resource requests or bad requests. Some of the codes are:
These codes are used when the server fails to process a request. Some of them are:
According to HTTP specifications, the request or response message has a specific structure. The generic structure looks like:
New lines must be placed between message headers and body. There can be one or more http headers like:
Few headers are shared by both request and response messages.
Entity headers provide meta-information about message body. The header looks like:
Although HTTP supports custom header it only looks for Request and Response header. Their formats are described in the following section.
The request message has a generic structure. The request line differs only and looks like the following:
A typical request message looks like
The response format structure is similar to request message. The status line and the headers are only different from request message. The status line structure is as follows:
A status line for a successful message looks like:
The full set response headers looks like
HTTP Debugger is an advanced HTTP Protocol Analyzer for developers and provides all in depth information for debugging websites and Internet applications.