Is HTTP A Network Protocol?
Chidiadi Anyanwu
OCI Certified Architect Associate | AZ-900 | HCIA-Datacom | BEng Electrical Engineering, University of Port Harcourt | Polymath
What is the difference between the web and the internet, or isn't it just two interchangeable names for the same thing? What is the difference between HTTP and HTTPS? What happens when I visit a website?
In this article, we're going to talk about:
When you type "linkedin.com" in your browser, a lot of things happen. But basically, you just sent a message to a computer (server) somewhere on the internet and asked it to give you a file (or files). When the file is sent over to you, your browser renders it and produces a beautiful webpage for you, allowing you to read my articles and be happy.
The files could be HTML files, CSS files, JSON files, images, videos, animations, or anything that is needed to render the webpage. The collection of these files in different web hosts/servers all over the world, connected to the internet, is called the world wide web, also known as the web, and the protocol used to send them over the internet is the Hypertext Transfer Protocol (HTTP).
A hypertext is any text that allows you to link to other parts of the text or other related texts using links.
History
Tim Berners-Lee, also known as TimBL, was working at CERN when he had the idea that there should be a faster and more accessible way for scientists to share and update information over already existing networks. He proposed his idea to his manager; by 1991, he had built the first web browser, built the first web server, and published his first website.
Along with that, he created the first version of HTTP which was called version 0.9. He used TCP, which was available at the time, DNS, which was also available at the time, and some other technologies. When he put them together, the world wide web was born.
The Internet Engineering Task Force (IETF) took it up from there and published the first finalized and fully documented version in 1996. HTTP /1.0. It continued that way; HTTP/1.1 in 1997, HTTP/2.0 in 2015, and HTTP/3.0 in 2022.
Working Principle
HTTP operates on the client/server model and is a stateless protocol, meaning that every interaction between the client and server ends there and none?of them remembers that interaction in the future. Whatever happened in the previous interaction does not affect the current interaction or change the state of the system.
Before there's any communication between an HTTP client and server, the client has to initiate a TCP connection with the server. They go through the TCP 3-way handshake and then the channel is open for both of them to communicate. The HTTP client then sends an HTTP Request to the server and gets an HTTP Response with the file it's looking for.
HTTP Methods
When a client sends an HTTP Request, it also has to tell the server what it wants the server to do. It achieves that using HTTP methods. HTTP has about 8 methods, but we'll talk about only 4 of them: GET, POST, PUT and DELETE, the ones that carry out the CRUD (CREATE, READ, UPDATE, DELETE) operations.
An HTTP request with a GET request method or HTTP verb is also known as a GET request. And the same goes for the other methods. The target of HTTP requests to a server is known as resources. They could be documents, images, or different types of files. The resources are identified with a URI (Uniform Resource Identifier) which could go something like this:
file:example.com/pathtofile/thefile.html
领英推荐
OR
https://example.com/pathtofile/thefile.js
Here are the four basic methods...
GET Method: The GET method is used to send a request to retrieve certain data from the server. It is a request for a representation of a particular resource on the server. It is a READ operation. For a get request, the payload of the request is carried in the URL.
POST Method: A POST request is used to add information to the server. If I have an API that handles the student records on a database, sending it a POST request would add a new student record. This corresponds to the CREATE operation.
PUT Method: The PUT method is used to change information on the server. Sending a PUT request will replace the information on the server with the data carried in the HTTP request. It is an UPDATE operation.
DELETE Method: The DELETE method is used to delete information from the server. Sending a DELETE request deletes the specified resource on the server.
HTTP Status Codes
We've talked about how the client communicates its intentions with the server. How about when the server wants to communicate with the client? Sometimes, the client may request a resource that does not exist on the server, or the request may be invalid. For the server to communicate such information with the client, we have something called status codes.
Status codes are different numbers or codes that HTTP servers use to communicate the state of things to the client. There are more than 25 of them, but we'll just deal with the most basic ones.
The codes are divided into 5 categories:
Some common codes are:
These codes tell you what is happening in the server with respect to the request. Now, HTTP has evolved over the years, and the later versions came with their own solutions and problems. In the next article, we will dive into those differences as well as explain the structure and protocol stack of the HTTP protocol. We would see what a HTTP frame looks like, see examples of HTTP request & response messages, and look at the new (but not new) protocol that caused a buzz this year.
Don't forget to subscribe to the newsletter, like the article and share it with others.
Systems Network Administrator at Aztec Microfinance Bank
2 年Great content!
Electronics and Computer Engineering Graduate| Frontend Engineer| Ex-lead Blockchain Uniport
2 年A good read, well done ????
Frontend Developer | Flutter Developer | Team Lead Go'cipe
2 年This is a very useful resource. Thank you
Brand and Product Designer | Exploring Control Engineering Innovations | Creative Problem Solver | MTN Foundation Scholar
2 年Interesting content??, worth the read
Good stuff!