What is HTTP ? Features,Version and Works

HTTP stands for ‘Hyper Text Transfer Protocol’ and is a kind of application program used to transfer different documents such as text, graphic images, video, audio, or other multimedia based files with HTML Codes on the World Wide Web(WWW). It is, to speak in more detail, a connectionless, media-independent, stateless, collaborative, and distributed TCP/IP protocol, run on the web to send and receive various requests and corresponding responses between a client( like a browser) and a server.

HTTP definition,features,version and functions.

Beginning of HTTP

Sir Tim Berner-Lee while working in a lab wanted to exchange data among a number of computers in CERN in 1991 and to turn it into a reality he proposed and developed a protocol that included some functional specifications, such as file transfer functionality, ability to request index search of a hypertext resource, format negotiation, and client-server interactions. The prototype built entailed the following details:

  • The client string must be a single ASCII character string.
  • The client’s request would be terminated by a carriage return(CRLF).
  • The server response would be an ASCII character stream.
  • The server response would be in HTML.
  • After server-client interaction, there would be termination of the connection.

Basic Features of HTTP

HTTP is a server-client based, query-response oriented, connectionless, stateless, media independent, and extensible protocol that runs over the port TCP80 by default. It is human-readable and simple though made complicated when it was updated to version 2. The basic features of HTTP are depicted below:

HTTP Is Connectionless

The HTTP client like a browser sends an HTTP request to the server and waits for a response. On receiving the request, the server responds to it by sending the required information through HTTP processing. After receiving the response, the client becomes disconnected. Here the server and the browser know each other and each one remains interconnected to the other so long as the request-response is going on and after the completion of the process, interconnection becomes disconnected.

HTTP Is Stateless

The client and server remain aware of each other during a current request only. After the end of the request-response, both of them forget each other. Owing to this stateless nature of the protocol, neither the client nor the server can collect information about requests across the world wide web. It supports only one request per connection. No connection between two requests simultaneously.

HTTP Is Media Independent

It implies that any kind of data, information, or text can be exchanged between the client and the server using HTTP as long as they can handle it properly.

HTTP Is Extensible

HTTP can be assigned new functionality by giving a simple agreement between a client and a server such as HTTP/1.0.

HTTP Is Simple

HTTP was designed to be simple and human readable though there was added extra complexity in HTTP/2 by encapsulating HTTP messages into frames.

Different Versions of HTTP

HTTP has four versions such as HTTP/0.9, HTTP/1.0, HTTP/1.1 and HTTP/2.0. When HTTP was invented by Tim- Berner Lee, it was simple in structure and later on developed and upgraded to various versions by concerned authorities as per need of time. Generally, HTTP is developed and regulated by the world wide web(www or w3) and Internet Engineering Task Force(IETF).

HTTP/0.9——-The Earlier Version of HTTP

  • It was very simple in structure, browser-server based, request-response oriented, and telnet-friendly protocol.
  • No HTTP headers, no status/code, and no URL.
  • The connection terminated immediately after the response.
  • Request nature was of a single line( method+path for requested document).
  • The supported method was only GET.
  • Response type was limited to hypertext only.
  • Nginx and Apache web servers yet support HTTP/0.9

HTTP/1.0——-The 2nd Version of HTTP

  • The protocol was a client( browser ) -server friendly.
  • It also included version information( number ).
  • Provided headers field to include both the request and response with status code and thus it made the protocol extensible and flexible to transmit metadata.
  • With the introduction of HTTP headers, and other documents( like stylesheet, media, etc. ) the plain HTML files were added.
  • Method supported: GET, POST, HEAD.
  • Connection terminated just after response.

HTTP/1.1—-The 3rd Version of HTTP

  • This version of HTTP is frequently used now on most servers.
  • It introduced many new features, such as pipelined connections, content negotiations, compression/depression, cache support, fastest response, great bandwidth, chunk transfer, and virtual hosting( a server with a single IP address provides hosting of multiple domains ).
  • The nature of the connection is long-lived.
  • The used method was: PUT, DELETE, TRACE, and OPTION( in addition to GET, HEAD, and PST ).
  • It also managed keep-alive connections by default, including characters and client cookies.

HTTP/2.0—-The 4th Version of HTTP

It is the latest version of HTTP which was developed in May 2015 as RFC 7540 though the proposal was made in March 2012. Owing to the limitations of the earlier versions( 0.9, 1.0, 1.1), the HTTP/2.0 was developed. Its features are as follows:

  • It incorporated the binary framing layer to exchange information between client and server prior to transmission of data between the two connecting devices, messages are formed in smaller frames after being encoded but HTTP semantics remains unaffected, such as headers, methods, verbs, etc.
  • All communications are performed over a single TCP connection having bidirectional streams.
  • Each stream passes a unique identifier and optional priority information to forward bidirectional messages.
  • Each message is a logical HTTP message consisting of one or more frames.
  • Frames are smaller units of communication that fetch data.
  • It uses stream prioritization and performance optimization.
  • It also provides demand-capacity oriented flow control server push, header compression, and security through Hpack.
  • Page loading faster.
  • Now in HTTP/2.0, domain sharing and asset concatenation are no longer needed.
  • Widely supported by browsers(HTTP/2.0 supporting browsers).

Architecture of HTTP

HTTP is an essential application protocol underlying the communications through the world wide web(www) that is request/response-oriented and founded on client/server-based architecture where search engines, crawlers, robots, browsers, etc. work like HTTP clients and webservers perform the functions of servers.

The Architecture Diagram of HTTP

What is HTTP ? Features,Version and Works

Web Client/Client: Here the web client or simply the client may be any web browser, search engine, robot, or similar program or application that can send requests to the server over the world wide web or Internet using a TCP/IP connection. The request may be sent in the form of a request method, URI, and protocol version followed by a MIME-like message which contains request modifiers, client information, and body content.

Web Server: Here in the protocol diagram, the server sends back a response including a status line, message protocol version, success or error code followed by a MIME-like message containing server information, entity meta information, and entity-body content. The server-side script is a kind of language used to build a server. It may be ASP.NET, PHP, Perl, Ruby, Python, etc. A database is a reservoir of data that is connected to the server that responds to the client against an inquiry or request.

                                                         

     

                            

How Does HTTP Work?

HTTP being an application-level communication protocol using TCP over the world wide web works on request/response mode through client-server mutual corresponding interaction. When you search a keyword or term on a search engine, the input is sent to the webserver through HTTP which once served, the corresponding response is sent back to the concerned browser. Once the entire cycle of request /response accomplished, the connection becomes detached. To have a good grasp as to how HTTP works go through the following points.

What Is an HTTP Request?

What is HTTP ? Features,Version and Works

An HTTP request can be defined as a packet of information carried by a browser to the targeted webserver so that the latter can forward a specific message or response to the former using a TCP connection. Each HTTP request that you make through your browser carries a packet of encoded data having different types of information. An ideal HTTP request contains the following units:

  • HTTP version( protocol version ).
  • Client information.
  • A URL.
  • HTTP request headers.
  • An HTTP method.
  • An optional message body.

What Is an HTTP Method?

An HTTP method may be defined as an HTTP Verb that indicates an action that an HTTP request expects from the targeted server. When you submit a post on the server i.e., on a website, the method you require is ‘PUT’. It is performed by the given ‘URI’. The method is always written in Upper case and it is case-sensitive.

List of HTTP Methods: The HTTP methods are described below.

  • GET: This method is used to retrieve data from a given server using the given URI. It has no other effect on data except data retrieval.
  • POST: The post method is used to submit, send or upload text, document, file, or similar resource to the targetted server.
  • HEAD: It is used as GET but transfers the status line and header section.
  • PUT: The PUT method is used to replace the current representations of the target resource with the uploaded content.
  • DELETE: The DELETE method is used to remove all the current representations of the target resource given by a URI.
  • CONNECT: The CONNECT method is used to establish a tunnel to the server which is given by a URI.
  • OPTIONS: The OPTIONS method describes the communication options for the target resource.
  • TRACE: The TRACE method is used to perform a message loop-back test along the path to the target resource.
  • PATCH: The TRACE method is used to perform partial modification to a resource.

What Are HTTP Request Headers?

HTTP request headers are part of HTTP headers that are encoded in clear and plain text. They are built to enable both the browser and the server to send and receive meta data about the connection to be established. When you enter a URL in the address bar of your browser, you send a particular kind of HTTP command to the server to fetch a specific kind of message. Here the HTTP headers contain the same information, such as HTTP version, browser type, what kind of information the browser fetches, etc. Headers are case-sensitive.

What Is an HTTP Request Body?

An HTTP Request Body is the main part of the HTTP request itself that contains and carries a single payload. The request body sends additional information to the server to process and send information back to the browser or client.

What Is an HTTP Response?

What is HTTP ? Features,Version and Works

An HTTP Response may be defined as a kind of answer sent by an internet server to a web browser in response to an HTTP Request being made to the server. It contains the following information :

  • HTTP Response Headers.
  • Optional HTTP Body.
  • An HTTP Status Code.

What Are HTTP Response Headers?

HTTP Response Headers are part of HTTP Headers that contain information about the response such as its location, date, type, and size of the file the server sends as well as the data about the server itself. There are many HTTP Headers enlisted with RFC4229 and also registered with IANA.

What Is an HTTP Response Body?

HTTP Response Body is the main part of HTTP Response that may contain HTML documents as well as a payload that contains information in response to requested HTTP Commands sent to the server by the browser/web client.

What Is an HTTP Status Code?

HTTP Status Code(Return Code) is a part of the HTTP request-response working system that indicates whether a message is successful or not. The Status Code is returned to the browser by the server. HTTP Status Code is composed of 3 digits where the first one indicates one of the five classes of response and the last two digits don’t play any role in classification or categorization. The Status Codes are defined in section 10 of the RFC2616 OF IETF.

Status Codes are grouped into the following five blocks:

S.N.CodeDescriptionRange
1.1 xx :InformationalIt means that the request has been
received and the process is continuing.
(100-199)
2.2 xx: Success It denotes that the action has been successfully received, understood, and accepted.(200-299)
3.3 xx : RedirectionIt implies that further action is to be taken in order to complete the request.(300-399)
4.4 xx: Client ErrorIt means that the request is incorrect in syntax or can’t be fulfilled.(400-499)
5.5 xx: Server ErrorThe server is unable to fulfill an apparently valid request.(500-599)
The Group of Status Codes

Now let’s go through the following Status Codes to understand the various messages displayed by the client-server interactions.

100 Continue: So far everything is ok, request has been received by the server with its initial part, however, the client should wait until the request has been fully received and acted upon as indicated by the server’s response.

101 Switching Protocol: This means that the server responds to an upgrade request header from the client and is switching to this protocol.

102 Processing (web dav) : This code denotes that the server has received and is processing the request but till now no response available.

103 Early Hints: This code is meant to be used with the link header and lets the user agent start preloading resources while the server prepares a response.

Successful Responses are described below:

200 OK: The code indicates that the request has succeeded.

201 Created: The code indicates that the request has been successful and as a result, a new resource has been created. It is generally found after POST/PUT request.

202 Accepted: It indicates that the request has been received and the process has not been initiated. It also denotes that another server or process handles the request.

203 Non-Authoritative Information: The response indicates that the sent meta-information has been collected from a local/third-party copy and not from an original server.

204 No Content: There is no content/entity to be sent as a response except the header.

205 Reset Content: Orders the user-agent/browser to clear the form or document for this transaction input.

206 Partial Content: This response code indicates that the range header has been sent from the client to fetch a part of the resource.

300 Multiple Choice: The request contains more than one possible response. It holds a link list.

301 Moved Permanently: The code indicates that the requested page has moved to a new URL.

302 Found: The requested page has moved to a new URL temporarily.

303 See Other: The Status Code is sent by the server to the client to indicate that the requested web resource is to be found with another URI with the GET method.

304 Not Modified: This is used for coaching purposes. It reports to the client that the response hasn’t been modified, so the browser can continue to use the same cached version of the response.

305 Use Proxy: The request response must be accessed by a proxy.

306 Unused: Though used in the previous version, no longer used now yet it is reserved now.

307 Temporary Redirect: The code sent to the client by the server indicates that the requested resource can be found at another URI with the same HTTP method as was used in the previous request.

308 Permanent Redirect: The server sends this response to the client to tell them that the requested resource has been moved permanently to a new URI.

4 XX: Client Error

400 Bad Request: The server couldn’t understand the request.

401 Unauthorised: To access the target resource the user-agent must use a username and a password. Actually, it authenticates the user before having access to the target resource.

402 Payment Required: The code is reserved for future use for digital transactions.

403 Forbidden: The targetted resource will not be given access to, the user-agent, though the client’s identity is known to the server.

404 Not Found: The code is sent by the server to the client to indicate that the requested web page/resource is not available or it doesn’t exist. It also means that the URL(targetted) is not recognized. It is most frequently used on the world wide web.

405 Method Not Allowed: It means that the method specified in the request is not allowed.

406 Not Acceptable: The code states that the response generated by the server is not acceptable to the client.

407 Proxy Authentication: The code implies that the user-agent while trying to access a server must be authenticated by a proxy before access to the original server.

408 Request Timeout: Very often the connection between the server and the client is shut down due to a longer response time. To indicate this the code is displayed.

409 Conflict: The request can’t be completed owing to the conflict in the server’s current state.

410 Gone: The requested page is not available now.

411 Length Required: The content length is not defined without which the server will not accept the request.

412 Precondition Failed: The code indicates that the precondition given in one or more of the request header files is false when tested on the server and access to the target resource is denied subsequently.

413 Request Entity Too Large: The server will not accept the request from the client as it is too large.

414 Request URL Too Long: This type of return code is sent to the client when the server doesn’t accept the request URL for being too long.

415 Unsupported Media Type: The code denotes that the client’s request will not be accepted by the server as the media type is not supported.

416 Requested Range Not Satisfiable: The code points out that the requested byte range is not available as it is out of bounds.

423 Locked( Web Dav ): The web resource targeted to be accessed is locked.

500 Internal Server Error: The code is sent in such a condition that the server encounters an unexpected situation and can’t handle it.

Example of 500 Internal Server Error that the server encounters when it is unable to process a request.

501 Not Implemented: The server doesn’t accept the requested method and so doesn’t handle it. The server doesn’t support the functionality required.

502 Bad Gateway: The error response indicates that the server received an invalid response and hence can’t handle the request.

503 Service Unavailable: This type of code is displayed by the server when it is temporarily overloading or down owing to maintenance.

504 Gateway Timeout: This error code is given while the server working as a gateway and can’t respond in time.

505 HTTP Version Not Supported: The code indicates that the interacting server doesn’t support the involved “HTTP Version “.