Author Marko Krstic
What does HTTP stand for, and what is it?
Bob: Hey Alice, you are working with computers and building web applications, right?
Alice: Hey Bob, yes, that's true.
Bob: Cool. I have been using the internet for a long time and noticed that HTTP is everywhere, but I've no idea what it is. Could you please explain it to me?
Alice: Sure. HTTP is Hypertext Transfer Protocol.
Bob: Ummm, sorry?
Alice: Hypertext Transfer Protocol is a protocol for distributed information systems that allows different parties to communicate and exchange data on the Web.
Bob: I am not quite sure I understood you.
Alice: Alright, let's imagine the following scenario: You meet your good friend on the street; what would you say in that situation?
Bob: I'd probably say something like: Hey bro, what's up? All good? You have time to grab a beer?
Alice: Yes, and he would respond like, Hey man, long time no see. Sure, let's have a beer.
Bob: Yes, probably
Alice: Would you repeat the same sentence to an unknown lady who is supposed to interview you for a new job?
Bob:: Absolutely not.
Alice:: Why not?
Bob:: Because it's not a proper way to greet an unknown person; It can also be rude. I wouldn't talk with two different persons the same way.
Alice: : Correct. Depending on who you talk to, different rules of the conversation apply. Defined rules of a conversation are usually called a protocol. So, there would be one protocol (the way) for talking to your friend and another for an unknown person.
Bob: Yes, I get it. Basically, the protocol is a set of rules on how to talk to someone. One protocol is used for talking to a friend, another to an unknown person, the third one in some other case, etc.
Alice: That's right. Let's go back to our problem. Do you know that computers can talk to each other?
Alice: Well, not like humans do, but in some way, yes. Let's say you want to visit one website. You normally type the URL in your favorite browser and press the enter key. In the background, your computer "talks" to the website you would like to visit. Your computer sends a message to the website asking for the desired page. Then the website (to be more precise, a server where the website sits, but for the sake of simplicity, we will say the website) responds with a message. Then your browser knows how to read and present the message. Now you can see the website in your browser. Sometimes we refer to these messages and call them data. Is it clear so far?
Bob: Yes, it's clear. That means my computer is asking something, and the website is responding to it with an answer. Like humans, two parties are involved in the communication, in this case, my computer and the website, exchanging messages or data.
Alice: A good catch, Bob. Two parties are involved in the communication, your computer and the website. Your computer initiates a conversation and asks to see the website, and the website responds and allows you to see it. Since your browser and the website are not sitting on the same computer, the communication between these two parties must happen over the network. Your browser sits on your private computer, and the website is on the Web. That's why you must have internet access to communicate with the desired website. Because they don't sit on the same machine, we also say they are distributed systems.
Bob: So far, so good, but I still don't get what HTTP is.
Alice:: OK, let me repeat the definition of HTTP: HTTP is a protocol for distributed information systems that allows different parties to communicate and exchange data on the Web. Is it maybe clear now?
Bob: Ah, I see now. HTTP is a set of rules that two parties use to communicate over the Web. Does that mean the questions and answers always need to be sent in a standard pre-defined form?
Alice: Yes. By the way, the questions and answers are called HTTP requests and HTTP responses, respectively. So when your computer sends a message to the website, it sends an HTTP Request. When the website responds, it sends an HTTP Response. So these are just messages or data that these two parties, or distributed systems, exchange. These requests and responses are well-predefined messages and need to be sent within the correct form.
Bob: So, does that mean that the HTTP protocol defines what these two messages should look like? I mean on HTTP Request and HTTP Response.
Alice: Yes, and that's the point of the HTTP. It is a protocol that defines communication between two distributed systems that exchange well-defined messages. If any of these two messages (HTTP request or HTTP response) is not compliant with the HTTP protocol, the website wouldn't know how to respond, and you will get an error. Hopefully, we don't need to worry about that since our computer creates the HTTP request on our behalf. Can you repeat the definition once again?
Bob: HTTP is a protocol for distributed information systems that allows different parties to communicate and exchange data on the Web.
Alice: Is it more clear now what HTTP is?
Bob: Yes, it is. Thanks a lot Alice :)
Alice: You are welcome Bob!