Behind the scene of HTTP Requests
It is used daily, by people all over the world every time we visit a website. It is the first four letters of a web address, even if we don't see it in the search bar, it is an integral part of the internet, without which, we would not be able to transfer data over the web. I am talking about HTTP. But what does HTTP really mean? Why is it at the beginning of a web address, and why is it so important? I am going to focus on the key components of HTTP in order to express a better general understanding of what is going on when we hit enter on the keyboard after entering a website into the URL search bar.
What does HTTP stand for?
Search for HTTP on any search engine, and the first thing that will come up, is what the acronym HTTP actually stands for, and you’ll find it stands for “Hypertext Transfer Protocol”. Essentially, this is the golden standard for how every client/server interaction is configured, it is a protocol for how we transfer hypertext markup language (HTML).
What does HTTP do?
When you search for an address from your computer at home, you are searching for a server’s web location, known as the URL. There are two parties here interacting. You searching on your computer at home, known as the client. The server of the web address you are looking for, simply known as the server. When a client wants something from a server, it is a request. The server is listening for requests to come in, and once it receives a request, it interprets what needs to be done (usually with backend functionality systems, such as Rails or Node.js), and then it sends the client what it wants, in a response. This request-response cycle is what makes the internet function, and it is the main job of HTTP.
How does HTTP work?
When an HTTP request is sent to a URL, a connection is established between the client and server through a TCP(Transmission Control Protocol) channel. While this channel is open the client sends the server its request, The request has a method, which defines what kind of request is being sent, and a path, which points to the specific location of the requested content. The most common type of method is a GET request, which tells the server to render and show the requested information. Other types of common methods are POST, PATCH, PUT, and DELETE. These different methods are what allow us to interact with webpages in different ways. A POST request, for example, tells the server that new information is being created and should be added to the database. When creating a new account on a website, you are sending a post request that will store your account information in that website’s server database.
So when you enter www.medium.com, you are sending a request to the Medium’s IP address, if the address is verified, the TCP channel can be established. Then the client (your computer) sends the HTTP GET request which tells the server to render and display the webpage data that is located at the path medium.com. The server sends this data back to the client in its response and the TCP channel is closed.