HTTP or Hypertext transfer protocol is a TCP/IP based, application layer communication protocol, that is principally used to access and transfer data on the World Wide Web. HTTP is the foundation of any data communication on the web. Secure form of HTTP protocol is HTTPS which stands for Hypertext Transfer Protocol Secure. By default, HTTP uses port 80.
What is HTTP protocol? – Further explained
It is a protocol for distributive, collaborative information systems and allows the exchange of hypermedia documents. These hypermedia documents can contain hypertext, along with graphics, audio, video, etc in the form of HTML (Hypertext Markup Language).
Hypertext is a structured text that contains links, known as hyperlinks to other documents or information.
It is a generic, stateless and connectionless protocol.
HTTP uses the default standard port 80 for establishing connections, but you can use other ports as well.
Now, as you have learnt about http, lets discuss how this protocol works behind the Internet.
How HTTP Protocol makes the Internet work?
Nowadays, we all are well aware of the Internet and related terms such as webpage, browser, etc. But the question is, have you ever thought of knowing how a particular webpage gets loaded into a web browser?
You type the address, press enter and in a matter of a second, the webpage shows on the screen. But what happens internally is quite complicated.
When you open your browser in search of particular content, you are indirectly making use of the Hypertext transfer protocol.
This important protocol is used for communication over the World Wide Web. When you request a web page by typing its address into the search bar of your web browser, that request is sent to the web server using HTTP. In turn, web server sends the page that a requestor is looking for.
History of HTTP
Ted Nelson coined the term hypertext that is transmitted using HTTP. In 1990, HTTP was first introduced by Tim Berners Lee at the CERN laboratories. It was developed along with HTML, having only a single method, GET, which would request a page from a server and the response generated from the server was always an HTML page.
In 1991, HTTP O.9, the first documented version of HTTP, was created. It was a simple protocol for raw data transfer across the Internet.
After that, HTTP 1.0 was founded by RFC 1945, which was an improved version of the earlier one as it allowed messages to be in the format of MIME (Multipurpose Internet Mail Extensions)-like headers.
The most commonly used version of HTTP, i.e., HTTP 1.1 was first defined by RFC 2068. In 2015, the latest version, HTTP/2 got standardized as RFC 7540. Now, various web servers and browsers support HTTP/2 over TLS.
Characteristics of HTTP
By now, you know that HTTP is the fundamental protocol for data communication on the Internet. But some features have helped in making HTTP a robust protocol in comparison to other communication protocols, and they have been explained in the below-mentioned points.
Although with each newer version, more complexity has been added, such as encapsulation of HTTP messages into frames in the latest HTTP/2.
HTTP messages are simple in format and can be easily read and comprehended by humans. Thus, it provides easier developer testing, and reduced complexity for any new person.
When an HTTP client, usually a web browser tries to establish a connection with the server, it disconnects itself automatically from the server after sending the request and waits for a response.
The server after accepting and processing the request re-establishes the connection with the client to post a response back in the form of a response message.
Although HTTP uses the services of TCP, it is a stateless protocol, i.e., there is no linkage between two or more requests being carried out one after another on the same connection.
The server and client have the knowledge of each other only when an instruction is provided by the client to connect. After that, the link between both of them disappears.
Because of this, the server sends the requested data without retaining any session or state information about the client. Each request is executed independently without having any association with the previous ones.
HTTP is an extensible protocol. HTTP headers defined in HTTP 1.0 version made this protocol easy to extend and experiment further.
Due to its extensibility, it is also possible to add new functionalities by merely creating an agreement between a client and a server regarding a new header’s semantics.
HTTP is media-independent as it supports the transmission of hypermedia documents. Hypermedia is an extension to hypertext that also includes multimedia, i.e., graphics, audio, video, animation, etc. as links to other contents. Any form of data can be communicated using HTTP if both the browser and the web server know how to manage the data content.
Architecture of HTTP
HTTP follows the client-server architecture, and it operates in the form of request and response. The underlying architecture of HTTP has the following components:-
A client, or the User-agent
The client, also known as user-agent is a platform that works on behalf of the user. Mostly, a web browser acts as the client but sometimes mobile applications, web crawlers, etc. can also function as the HTTP client.
The primary role of a user-agent is to launch a connection to a server after identifying what the user is searching for and initiate single or multiple HTTP requests to the server accordingly.
The server is a computer program which serves HTTP requests after accepting the connection, as requested by the client. Application software running on a computer that is hosting the website may act as the web server, for example, Apache web server.
The primary role of a web server is to respond to the request made by the HTTP client.
Though virtually it might look that a server is a single machine, it might be that the same device hosts several other servers, i.e., a collection of servers.
In the middle of the request and response messages between the web browser and the web server, there are various other machines and devices, collectively termed as proxies, which perform functions like relaying HTTP messages, caching, authentication, filtering, etc.
Working of HTTP
Now, we will be discussing the working of HTTP in details. When you try to access any web page, you are supposed to include HTTP in front of the URL of that page that informs the browser to communicate over HTTP.
HTTP defines a set of rules relating to how messages and other data should be formatted and reciprocated between web servers and browsers.
HTTP follows a classical client-server architecture where the web browser acts as an HTTP client and establishes communication with the web server that hosts the website, termed as HTTP server to retrieve the webpage requested by a user.
The client opens a connection to make a request and waits until it receives a response from the server.
The client and the server communicate in the form of messages, and not any stream of data. The command transmitted from the client to the server is known as a request.
The contents of the requested file, webpage or other information sent by the server to the client are called response message.
The basic format of the request and response messages is similar. An HTTP request message consists of a request line, one or more header, and sometimes a message body. The request line contains request methods, uniform resource identifiers, and the protocol version.
A response message comprises a status line, and all other fields are the same as in the request message. A status line contains the protocol version, numeric status codes and the related phrase in text form.
Abbreviation for Hypertext Transfer Protocol Secure, HTTPS is an extension of HTTP protocol employed for secure data communication over a computer network and which uses HTTP on a connection encrypted by transport layer security (TLS).
It has made the exchange of information extremely secure on the Internet.
Earlier, it was used majorly by banking websites, payment gateways, emails where data that is sent and received needs to be highly secured. But now, it is widely used in general instead of the original HTTP as it is not much secure.
It provides authentication support through secure data communication, and helps in maintaining privacy. It protects the integrity of the data and also prevents the data from the man in the middle attacks, eavesdropping, tampering, etc.
Unlike HTTP, HTTPS uses default port 443 for communication.
The hypertext transfer protocol is an easy to use protocol and has evolved rapidly over time. Though its prime function is to make communication between web browsers and web servers, it is also employed for other purposes, such as name servers and distributed object management systems, by extending its request methods, error codes, and headers.
Nowadays, it is not necessary to include HTTP in the front of the address of the web page, as it is added automatically being considered to be the default protocol for communication on the web.