In the last article, we concluded that HTTP is the foundation protocol(Set of rules) for sending and receiving messages on the web. It gives you a prescribed format for client requests and server responses. These requests/responses sit over TCP that ensures correct data is received.
Evolution of HTTP:
Why do we need hypertext?
Think of hypertext as a link to the document. The document contains information, and information is passed as data. This whole idea of hypertext is to replicate books like dictionaries, encyclopedias, etc., on a machine. If you have an encyclopedia, say you want to read about geography. You will search geography in the table of content and go to the corresponding page number. What if we want the same in computers? There must be some link between geography(text) and the content of geography(page). This linking is enabled by hypertext on a computer. In this case, text 'geography' becomes hypertext that links to its content.
Building Blocks of Web:
There may be many texts in the same encyclopedia from A-Z. These texts should be converted into hypertext. There must be some format to arrange these texts as hypertexts. This format is called HTML. It is Hyper Text Markup Language. It is markup because it needs to replicate a page(in this case index page of the encyclopedia) like header, layout, content, and footer.
Markup means to structure in a specific way.
A protocol to exchange HTML on the web. That's where HTTP comes from.
Client to display the HTML document(parsed to human readable) called a web browser.
The Server gives access to the document.
Stages of HTTP
At first, it has only the functionality of getting the HTML documents. Only the get requests and response is a simple HTML document if the HTML document is not available separate html document to display the unavailability message.
request: get encyclopedia.html response: <html>encyclopedia.....</html>
Here only the html files could be transmitted. There are no headers or status codes from the response.
Later, http started versioning like below. The response includes a status code and status message on the first line. Documents other than html can be transmitted with the help of content-type in headers. This stage adds meta-data about requests and response using HTTP headers.
request: get encyclopedia.html HTTP/1.0 User-Agent: chrome/windows 10 - to identify the browser and OS of origin of the request response: 200 Ok Date: date and time of response server: Whatever the server, you send requests on the web Content-Type: text/html <html>encyclopedia.....</html>
HTTP - 1.1
It is the first standardized version of HTTP.
It includes Pipelining.HTTP 1.0 needs a brand new TCP connection for every request and response. Say you use Facebook, it has texts, audio, and images. The images and audios are to be fetched from different requests because Content-type is different. This means the page is not fully displayed; hence, we need a new TCP connection to bring images. This reduces the waiting period.
Pipelining in HTTP 1.1 allowed a second request to be sent before the answer to the first one was fully transmitted.
Host header: The server can have many applications in it. The server has a single IP address. The server doesn't know where the requests are destined(i.e., which application). This host header tells which application.
Then HTTP 2.0 evolves. The evolution of HTTP is basically to improve reliability, security, safety, encryption, and extended functionalities to cater to the needs of the modern web. Have this in mind. You can read more about it in MDN docs.