Can you list the existing versions of the HTTP protocol and their main differences?
sobes.tech AI
Answer from AI
Main versions of the HTTP protocol and their differences:
-
HTTP/0.9 — the very first version, supports only the GET method and returns only HTML.
-
HTTP/1.0 — added POST, HEAD methods, header support, and the ability to transmit different types of content.
-
HTTP/1.1 — improved performance through persistent connections (keep-alive), added new methods (e.g., OPTIONS, PUT, DELETE), support for chunked transfer encoding.
-
HTTP/2 — introduced a binary protocol instead of text, multiplexing requests over a single connection, header compression, request prioritization, significantly improving speed and efficiency.
-
HTTP/3 — based on the QUIC protocol over UDP, provides faster connection setup and better resilience to packet loss.
Example of using HTTP/2 in Node.js with the http2 module:
const http2 = require('http2');
const server = http2.createServer((req, res) => {
res.end('Hello over HTTP/2!');
});
server.listen(8443);