From HTTP/1.1 to HTTP/2 and Beyond: The Evolution of the Web

From HTTP/1.1 to HTTP/2 and Beyond: The Evolution of the Web

Hey I am Vishal Kumar and this article is related to “How the web Evolute : From a single request and single response to single request and Multiplexing response“ .

HTTP - HyperText Transfer Protocol

These are basically a set of rules that point to other resources (web pages, text files, images, and content).

  • HyperText - It means text with links . it is text that make connection to other pieces of text, documents, or resources.

  • Trasfer - send something

  • Protocol - set of rules

    HTTP means set of rules which trasfer HyperText*

These protocol are Human Readable . In computer lot of set of rules .

These Protocol Are Stateless

Whenever you request to server or visit on page you are a new user. No memory save of Pre Request .

without use cookies and session

  • let you request http://example.com/login and fill the fields of username and password , you successfully login and you just refresh these page 💥boom💥 page say to you again need fill the all field and login .

Session and cookie are not same meaning but work is same storing information (like : userId , email, token). Simply meaning of both is information .

session : These term is used for Server-Side-Storing temporary information.

cookie : These term is used for client side (browser) that store small peice of data (information) .

https://hashnode.com/@gokuthecoder

When we try to communicate with the server, we need to send more information to the server.

HTTP Headers - It also means is Information.

|→client (window or Android or Linux or Mac)

|→ Browser Information (e.g. chrome or firefox or edge)

|→Date Time

|→cookie to store

Request Response Model

Browser send Information or Request to server like, who i am Android, Window, Mac ..etc . What is my Browser Chrome, Firefox or another. Request time. Same Information server send to Browser .

Type of Request : [GET, POST, UPDATE, DELETE, PUT, …..]

Response Code : [200, 404, 500, ….]

  • Note: Browser requests to the server need to use verbs (GET, POST, etc.), but the server, in response, only needs to provide headers, status codes, and data (if applicable). This doesn't mean the server never uses verbs; if one server requests another server, they also need to use verbs.

  • |→ what action to perform - GET POST

  • |→ where to perform api-hitesh.ai/auth

  • |→ was it done 200, 300

    Whenever we got 404 , we got a messgae “Not Found“ who is set this always 404 status code message “Not Found“ why not other, because of Protocol (set of rules).

HTTP 1.1 -The client sends 1 request to the server, and the server sends 1 response back to the client. In response, the server can also send an image.

HTTP/2 - HTTP means HTTP/2

HTTP/1.1 is a fallback and still used in HTTP/2.

HTTP/2 introduced several new features designed to improve speed, efficiency, and reliability compared to HTTP/1.1.

FeatureHTTP/1.1HTTP/2
Request-ResponseOne at a time per connectionMultiplexing allows many at once
Header CompressionNo compressionHPACK compression reduces header size
Server PushNot supportedSupported
Protocol FormatText-basedBinary
Connection HandlingMultiple connectionsSingle connection for all requests
PrioritizationNo stream prioritizationStreams can be prioritized
EncryptionOptional (with TLS/SSL)Mandatory (must be encrypted, typically via TLS)

HTTP/2 uses the HPACK compression algorithm to compress HTTP headers, which are often repetitive and large.

  1. Reduce the size of requests and responses

  2. Saves bandwidth and speeds up communication, especially for resources with many headers (e.g., cookies, user agents).

  3. Example:

    In HTTP/1.1:

    • Each request includes full, uncompressed headers. If you're loading a webpage with 50 resources, the headers are sent 50 times.

In HTTP/2:

  • Only compressed headers are sent, and repeated header values (like cookies) are minimized.
  1. server push : If the client requests index.html, the server can also "push" associated resources like styles.css or main.js without waiting for separate requests.

  2. Multiplexing is about allowing multiple requests and responses to be sent concurrently over a single TCP(transmission control protocol e.g: ) connection. This eliminates head-of-line blocking, which was an issue in HTTP/1.1 where multiple requests would have to wait for the previous one to complete.

    • Purpose: Improves performance by enabling parallel requests without creating new connections for each request.

    • Example: If a webpage requires HTML, CSS, and JavaScript files, they can all be requested at once and sent back in parallel, rather than waiting for one to finish before requesting the next.

Encryption (https)
HTTP/1.1 could be used with or without encryption (via HTTPS).

HTTP/2 requires encryption for most modern use cases, encouraging the use of TLS.

⚠️Note: In AWS we don’t use https for internal communication . Any place where we use internal communication we not use https.

TLS (Transport Layer Security)

How TLS Works :

  • Handshake

    • When your browser (the client) wants to talk to a website (the server) securely, they first do a handshake:

      • They agree on how to encrypt the messages (choose a secret code to lock and unlock them).

      • The website shows a "certificate" to prove it's really the website it says it is.

      • They both make a secret key that they’ll use to encrypt the data during the chat.

  • Secure Communication:

    • Once the handshake is done, your browser and the website can send messages to each other. Everything they send is locked with the secret code, so no one can peek at it.
  • Session End:

    • When the chat is finished, the secret key is thrown away, so no one can use it again.

    • user-agent (Browser): The agents that send information to the server are called user-agents. Your terminal or mobile device is a user-agent, which provides information to the server.

    • TCP (Transmission Control Protocol)

      • When sending data:

        • If I am on a browser, my transmission acts as a server.

        • For a server, the client/user is the recipient of the transmission.

      • To transmit data, a protocol is required.

        • Example: If I withdraw money from an ATM, the bank ensures my neighbor doesn't access the same money. Similarly, protocols secure data transmission.
  • FTP (File Transfer Protocol)

    • File transfer also requires a protocol (e.g., FTP).
  • IP (Internet Protocol)

    • Every computer has a unique name called an IP address.

    • On the internet, a computer’s name is referred to as its IP.

  • URL (Uniform Resource Locator)

    • A URL ensures uniformity and provides the specific location of a resource on the internet.

      • Example: A URL tracks the location of a webpage, image, or file (e.g., a .mp3 file).
  • DNS (Domain Name System)

    • The DNS acts as the contact book of the internet.

    • It translates URLs into IP addresses so browsers can locate and access websites.

Header ( Pass Additional Information )

  • It is additional information like browser send request to server so that Header is origin like chrome. firefox

Payload (Actual data - email, password)

  • It is actual data .

  • Example: A driver load a Sofa in his pickup and deleiver somewhere so the

Header → driver, pickup , deleviered status

payload → Sofa is actual data

Cache

Cache is temporary storage. It's like when everyone doesn't go to the factory; instead, we store some items in a showroom. So, this showroom is the cache.

⚠️Note: Total 65535 possible port

🔌 Setup TCP Connections: TLS, Data Exchange & Response Handling 🚀

  1. setup TCP connections

  2. Exchange TLS certification send verbal + url + data + more

  3. Get the response back with status code and data (img, csv, text)

  4. TCP connections is closed (stateless)


server only read his own cookie , like Facebook server only read facebook cookie not Netflix cookie .