Open In App

Difference between HTTP/2 and HTTP/1.1

Last Updated : 28 Mar, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

HTTP stands for hypertext transfer protocol & it is used in client-server communication. By using HTTP user sends the request to the server & the server sends the response to the user. There are several stages of development of HTTP but we will focus mainly on HTTP/1.1 which was created in 1997 & the new one is HTTP/2 which was created in 2015.

HTTP/1.1: For better understanding, let’s assume the situation when you make a request to the server for the geeksforgeeks.html page & server responds to you as a resource geeksforgeeks.html page. before sending the request and the response there is a TCP connection established between client & server. again you make a request to the server for image img.jpg & the server gives a response as an image img.jpg. the connection was not lost here after the first request because we add a keep-alive header which is the part of the request so there is an open connection between the server & client. there is a persistent connection which means several requests & responses are merged in a single connection. These are the drawbacks that lead to the creation of HTTP/2: The first problem is HTTP/1.1 transfer all the requests & responses in the plain text message form. The second one is head of line blocking in which TCP connection is blocked all other requests until the response does not receive. all the information related to the header file is repeated in every request.

HTTP/2: HTTP/2 was developed over the SPDY protocol. HTTP/2 works on the binary framing layer instead of textual that converts all the messages in binary format. it works on fully multiplexed that is one TCP connection is used for multiple requests. HTTP/2 uses HPACK which is used to split data from header. it compresses the header. The server sends all the other files like CSS & JS without the request of the client using the PUSH frame.

Difference between HTTP/1.1 and HTTP/2 are:

HTTP/1.1

HTTP/2

It works on the textual format. It works on the binary protocol.
There is head of line blocking that blocks all the requests behind it until it doesn’t get its all resources. It allows multiplexing so one TCP connection is required for multiple requests.
It uses requests resource Inlining for use getting multiple pages It uses PUSH frame by server that collects all multiple pages 
It compresses data by itself. It uses HPACK for data compression.

Similar Reads

Difference and Similarities between PHP and C
PHP is a server-side scripting language designed specifically for web development. It can be easily embedded in HTML files and HTML codes can also be written in a PHP file. The thing that differentiates PHP from a client-side language like HTML is, PHP codes are executed on the server whereas HTML codes are directly rendered on the browser. C is a
3 min read
Difference between PUT and POST HTTP Request in Express and Postman
Both PUT and POST are request methods used in the HTTP protocol. In this article, we will introduce the HTTP methods such as PUT and POST in detail, and we will also discuss in detail when to use PUT and when to use POST. Table of Content PUT methodPOST MethodDifference between PUT and POST methodConclusionPUT methodPUT is one of the HTTP request m
6 min read
Difference between Node require and ES6 import and export
Node.js uses the CommonJS module system to organize code. This means when you want to use code from other files, you use methods like 'require'. Additionally, Node.js also supports 'ES6 import and export' for this purpose. Let us understand in detail. Table of Content Require:ES6 Import & ExportDifference between node.js require and ES6 import
3 min read
Difference between Bootstrap and AngularJS
Bootstrap is a free and open source front-end web development framework. It is a giant collection of HTML, CSS, and JavaScript code that is designed to help build user interface components. It is a free collection of tools for creating websites and web applications. It is used by many developers and according to the official Bootstrap site: It is t
5 min read
Difference Between HTML and ASP
HTML and ASP are two very common aspects in the web programming world. HTML stands for HyperText Markup Language used to develop web pages and specifically web design. Primarily written using HTML elements, they consist of tags, an opening, and a closing tag. The data between these tags is usually the content. The main objective of HTML is to allow
2 min read
Difference between PERN and MERN stack
What is a stack, if you are familiar with full-stack development you might have come across the terms MEAN, MERN, MEVN, etc. These are web stacks consisting of a collection of software and frameworks used for building a web application from the front-end and back-end. You can learn any of these stacks to become a Full-stack developer. A stack usual
3 min read
Difference between ASP and ASP.NET
ASP stands for Active Server Pages. It is a development framework used for building web pages. ASP was introduced in 1998 by Microsoft as its first server-side scripting language. The file extension of ASP pages are .asp and are normally written in VBScript. It is an old but still powerful tool for making dynamic web pages. ASP is a technology (muc
2 min read
What is the Difference between Website and Web Portal
What is most confusing to people starting off their web journey is the difference between a website and a web portal. When asked people who had layman knowledge on the subject, some were unable to hit the point, most of them said there was, however, no difference and there were some who had a very confused opinion on the subject. What we realized w
8 min read
Difference between Web Scraping and Web Crawling
1. Web Scraping : Web Scraping is a technique used to extract a large amount of data from websites and then saving it to the local machine in the form of XML, excel or SQL. The tools used for web scraping are known as web scrapers. On the basis of the requirements given, they can extract the data from any website in a fraction of time. This automat
2 min read
Difference between JavaScript and PHP
In this article, we will know about Javascript & PHP, along with understanding their significant differences. A long time before, most people used to think PHP is a server-side language and Javascript as client-side language as it was only executed in web browsers. But after V8, Node and other frameworks came, Javascript is capable of doing a l
4 min read