HTTP
HTTP
Hitesh Mohapatra
Associate Professor
Internet
WWW
How HTTP works?
HTTP Protocol Overview
Imagine the internet is a giant restaurant, and the HTTP protocol is the
waiter.
1.Client (You) Arrives: You walk into the restaurant (open your browser) and
sit at a table (type in a URL).
2.Making a Request: You call the waiter (HTTP) and ask for a menu (send a
request to the server). The waiter nods and goes to the kitchen (server).
3.Fetching the Menu: The waiter comes back with the menu (the server
sends back the requested web page).
4.Ordering Food: You decide you want a burger (click on a link). The waiter
takes your order (another HTTP request) and heads back to the kitchen.
5.Bringing the Food: The waiter returns with your burger (the server sends
back the requested content).
6.Asking for More: You realize you also want fries (click another link). The
waiter takes another trip to the kitchen and brings back fries (another
HTTP request and response).
Persistent vs. Non-Persistent Connections
Now, imagine you’re at a fancy restaurant. You sit down, and the waiter stays
with you the whole time. You order fries, and the waiter brings them. You
order a burger, and the waiter brings it. You order a drink, and the waiter
brings it. This is how persistent connections work. The connection stays
open, allowing multiple requests and responses without the need to
reconnect each time.
Pros:
• More efficient, as the connection stays open.
• Reduces overhead and latency.
Cons:
• Requires more resources to keep the connection open.
• Potentially more complex to manage.
Technically
Figure 10.11 shows the same scenario as in Example 10.4, but using a
persistent connection.
• Only one connection establishment and connection termination is
used, but the request for the image is sent separately.
Figure 10.11
Example 10.5
Differences