What is HTTP?

Photo by Glenn Carstens-Peters on Unsplash

If you are reading this, chances are that you have HTTP in your curriculum, or you are just a curious person trying to find out more about HTTP. Whatever the reason, it is good to know the basics of something that makes the internet what it is currently. Through this article, I hope to give you a very basic idea about HTTP.

To begin with, HTTP is an acronym for Hyper-Text Transfer Protocol. This tells us that HTTP is simply a protocol. A protocol is just a set of rules that are followed by two or more communicating elements (usually a web-server and web-clients). Transfer indicates the flow of data from the web-server to the client or vice-versa. From these two words — “Transfer Protocol”, we can understand that is a communication between the server and client for transferring data. Now, let’s add onto this definition, the third word of the acronym — hypertext. If you are familiar with HTML (Hyper-Text Markup Language — which is the skeleton of webpages), you will understand that the transfer happens for a webpage (along with it’s contents — like embedded images, audio, video and also the information about the layout of the page).

We can also look at it this way — every time you type google.com and hit ‘enter’, you are sending a request to the server to let you access google, and, the server is sending you a response in the form of Google’s homepage. Also, every time you hit the “Submit” button on any registration form, you are sending data to a server to create/update a resource. In simple terms, HTTP works on a request-response model.

I have been using the words ‘server’ and ‘client’ many times. So, for clarification, a client can be any device (laptop, tablet, mobile — having access to the internet) and a server can be any hardware-software combo, which caters to client-requests on the world wide web through HTTP.

HTTP requests and responses:

An HTTP request consists of:

  1. Method — usually GET/POST ( GET is used to ‘get’ information from the server. Post is used to ‘post/submit’ information to the server/client.
  2. Path — The path (or the URL) is also included in the request.
  3. Version of the HTTP
  4. Headers conveying additional information to the servers, if necessary.
  5. Body — If the method is ‘POST’, the information that needs to be sent to the server.

An HTTP response may contain the following elements:

  1. Version of the HTTP
  2. Status code — This specifies if the request was successful. (An example of a status code is 200 — )
  3. Status message — This is just a brief explanation of the status code (An example of a status message is ‘OK’).
  4. Headers
  5. Body — If present

3 Features of HTTP:

  1. Connectionless — The connection between the server and the client is
    only present for the duration of the transfer of data. The client makes a request, and the server acknowledges the request and sends back the required data. After this, the connection is broken.
  2. Media-independent — There is no restriction on the type of data that can
    be sent as long as both the client and the server know how to handle the data in a proper way.
  3. Stateless — The information about the requests and the responses is not
    stored, hence, this protocol is stateless.

HTTP vs. HTTPS:

Now, for those of you who are wondering what HTTPS is, it is just a secure
version of HTTP
. HTTPS is an acronym for Hyper-Text Transfer Protocol Secure. It is used for secure communication over a computer network. You can check if your connection is secure by looking in the search bar where the URL (website address) is located. At the beginning of the name of the website, if you can see a symbol of a lock, that means that your connection is secure. HTTPS just adds a layer of security using TLS/SSL (Transport Layer Security/ Secure Sockets Layer). So basically, HTTPS is an encrypted and authenticated version of HTTP.

Of course, there is a lot more to explore and learn about HTTP. But it will go beyond the scope of this article. Although, I hope that this gave you a foundation upon which you can build more information in-depth.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store