Hey!! there reader, Today in this blog we will explore What is HTTP? , Explore HTTP .If you don’t know anything or want to revise this blog will help a lot.
Introduction
HTTP (Hypertext transfer protocol) is one of the many protocol which is used to communicate on the application layer of the TCP/IP model over the internet and between different computers . It is a set of rules and format that is used as a standard set of practices while communicating. HTTP have statelessness which is it does not remember the previous request or persists and data during communication. It follows the client-server architecture which is when user requests a resource, the response is provided in specified format by the server. The request and response should contain headers which provide metadata about the provided body and a body which is the actual data sent by the client or requested by the client. The HTTP contains specified set of OPERATION names known as HTTP methods which are used to specify the server about the type of request.
Also server uses codes which are known as HTTP Status codes to specify the type or state of the response. Let’s start from the HTTP headers.
HTTP Headers
The headers are the metadata that contains the information about the data, like requested source, destination, user-agent , tokens , e-tags , date-times , status codes. These headers are created and often used on the client side or the server side to validate authorize or permit specific tasks from the user. There are different types of headers.
- Request Header : Sent by the client to the server.
- Response Header : Sent by the server to the client.
- Representation Header : Decides the format of the response or the request body to be sent.
- Payload Header: This are the custom headers used by the server or client to authenticate and authorize or for any different task used by the developer for specific tasks or requirements.
Covering all the headers then we think how the HTTP communicate and be able to do basic CRUD operations. We understand HTTP methods.
HTTP Methods
The HTTP Methods are the basic set of operations format that helps the server understand the type of the request like for example, If it is creating , updating or deleting a resource. These methods are used such operation each having a specific work.These is mostly invoked from the client side to request some resources and can be found in the request headers.
The HTTP Methods are:
- GET : Used to retrieve a source from the server.
- POST: Used to add new data to the server.
- PATCH: Partially updates the data without removing them. In other words add more data to the already existing data.
- PUT: Completely replaces the old data to the new data sent.
- DELETE: Delete a resource from the server.
These are the most commonly used methods in the modern development and use case. But there are some other methods which are not most frequently used.
Those are:
- HEAD: Used to only see the headers no body.
- OPTIONS: Provides the available methods for the specific endpoint.
- TRACE: Loopback test provides the same data again to check if it is working properly.
The most common HTTP methods among them are GET and POST which are most frequently used in any application to give and take data.
Then comes the HTTP status code which is sent by the server on the response headers.
HTTP Status Codes
These codes have specific meaning to each of the response codes and have different range for what the response provided by the server upon your request. It is standard practice to maintain the response with a status code specific to the response.The Range starts from 100 to 599
The Ranges specify what type of information is shared.
- 100 - 199 : Informational response
- 200 - 299 : Success response
- 300 - 399 : Redirection response
- 400 - 499 : Client side error
- 500 - 599 : Server side error
The status code each represents a specific response type and among the most commonly used status code are:
- 100 : Continue
- 102 : Processing
- 200 : OK
- 201 : Created
- 202 : Accepted
- 307 : Temporary redirect
- 308 : Permanent redirect
- 400 : Bad request
- 401 : Unauthorized
- 402 : Payment required
- 404 : Not found
- 500 : Internal server error
- 504 : Gateway timeout
These are the most commonly used status codes across all the ranges and most of the work is done in these only.
Conclusion
These are most of the cover ups of HTTP basics , although you maybe wondering “But nowadays we are using HTTPS not HTTP then what is the diffrence between two if they work in the same way”, There is a big diffrence not in the form of communication but in the way of communication.
The S in HTTPS stands for secure so it is Hypertext transfer protocol secure , In normal works it means the data packets that were sent over the network are secured , Now lets understand the process of how it gets secure.
Previously on HTTP the data packets were shared over the network raw so anybody that interprets the network can access it and change the data and this was one of the core reason why the TSL and and later SSL were introduced. These are the extra layer that were used to encrypt the data and when they are being transported from the server to the client and can only be decoded from the client side which have they key to decrypt the message usign the specified salt and key value.
Understanding the TLS and SSL are a completely diffrent topics and cannot be covered in this blog. And thus using these layers we can convert HTTP to HTTPS, Which is highly recommended in today’s time.
This is the conclusion for the HTTP Basics I have tried to cover almost everything that is required for basic knowledge and understanding. If left anything please provide feedback on how the blog was. Thank you for reading.
Top comments (0)