HTTP and HTTPS·Lesson 2 of 13
What is HTTP?
What Is HTTP?
HTTP stands for HyperText Transfer Protocol. A is just an agreed set of rules for how two machines talk, and HTTP is the specific set of rules for the web. It defines how a browser asks for a web page and how a server sends one back. When you see http:// or https:// at the start of a web address, that is the protocol the page is using.
The core idea
HTTP is a request-response protocol: a client sends one request, and the server sends back one response. Nothing happens until a client asks. The server never starts the conversation on its own.
A Simple Conversation
Think of HTTP as a short, polite exchange. The client asks a clear question — 'please send me this page' — and the server gives one clear answer — 'here it is', or 'that does not exist'. Each exchange is one request paired with one response. Here is the cycle step by step:
The request-response cycle
- The client opens a connection to the server
- The client sends an HTTP request naming what it wants
- The server processes the request and prepares an answer
- The server sends back an HTTP response with a status and the content
- The client uses the response, and the exchange is complete
Because HTTP is written as plain text, you can actually read what a browser sends. Here is roughly what a request for a page looks like on the wire:
GET /index.html HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0
Accept: text/html
The server reads that, finds the page, and replies with a status line such as HTTP/1.1 200 OK, a few headers, and the page's HTML. The next lesson breaks down every part of both messages — for now, the key point is that it is all readable text following a fixed shape.
HTTP Is Stateless
The single most important thing to know about HTTP is that it is . This means the server treats every request as brand new and does not remember anything about your previous requests. Ask for page A and then page B, and as far as HTTP is concerned, those two requests have nothing to do with each other — even if they came from the same browser a second apart.
The clerk with no memory
Imagine a shop clerk who forgets you the instant you turn away. Every time you walk up, you must reintroduce yourself and explain what you need from scratch. That is a stateless server. It is not rude — it just keeps no memory between visits, so each request has to stand entirely on its own.
Statelessness sounds like a limitation, but it is a deliberate design choice that keeps servers simple and easy to scale — any server can handle any request without needing to share memory of who you are. Of course, real websites do need to remember you (think of a shopping cart or staying logged in). They add that memory back on top of HTTP using and , which later lessons cover in full.
Key Characteristics
A few traits define HTTP and explain why the web works the way it does. Here they are at a glance:
No memory between requests
Each request is independent. The server remembers nothing from earlier requests unless the site adds cookies or sessions.
The client always asks first
A browser sends requests; a server sends responses. The server never pushes a page unless something requested it.
Human-readable messages
In HTTP/1.1, requests and responses are plain text you can read directly, which makes the protocol easy to learn and debug.
Carries any kind of content
HTML, images, video, JSON, files — HTTP can transfer any type of data. A header tells the other side what kind it is.
Where HTTP runs
HTTP relies on TCP, a lower-level protocol that guarantees data arrives complete and in order. That is why a half-loaded page is rare — TCP handles the delivery so HTTP can focus on the request and response. Plain HTTP uses port 80.
Why It Matters
Almost every app you use talks HTTP under the hood — websites, mobile apps calling an API, even smart devices. Understanding that it is a stateless, text-based, request-response protocol is the mental model everything else in this topic builds on. When an interviewer asks you to 'explain what happens when you type a URL and hit Enter', this is where the answer starts.
“"HTTP keeps a live connection open so the server always knows who I am."”
Q:What does it mean that HTTP is stateless?
A: It means the server treats each request independently and keeps no memory of previous requests from the same client. This keeps servers simple and scalable. To remember a user across requests — for a login or shopping cart — websites layer state on top using cookies and sessions.
Quick Revision Cheat Sheet
HTTP: HyperText Transfer Protocol — the rules of the web
Model: Request-response; the client always asks first
Stateless: Server keeps no memory between requests
Text-based: HTTP/1.1 messages are readable plain text
Runs on: TCP, using port 80 for plain HTTP
Adds memory via: Cookies and sessions, layered on top