understanding of HTTP protocol
Before talking about HTTP Protocol, let's talk about "Protocol". A protocol is a set rules to be followed to communicate with one another. Let's take two persons say A, B. Person A lives in USA and person B lives in India and he doesn't know english. Person A sent a message to B. Inorder to understand the message, B has to follow english language grammatical rules. We call these grammatical rules technically as "protocol".
HTTP protocol is designed to provide communication between two computers. It's a server and client based protocol. A server is a computer where an application is running on it on a port number(it's 80 for HTTP protocol). A client is also a computer which sends a request to the server using the HTTP protocol. Most of the users sends request to the server from the web browser of users computer. If we want to do it programmatically then we need to the HTTP modules like urllib, requests, etc. in python.
In order to understand the HTTP protocol we need to understand the HTTP request and HTTP response. In order to get a resource from the server we send a HTTP request to the server and the server responds us back with a HTTP response.
It has two parts 1.HEADERS and 2.BODY
HTTP REQUEST HEADERS: It contains the below information
- request method types "GET", "POST", "PUT", "DELETE", etc.
- request host name like "google.com", "learnbatta.com"
- request url path like "/blog/django-introduction/"
- other content headers like Content Type, Content Length, Authorization, etc.
- To know more about HTTP headers then visit the HTTP headers article on wikipedia.
- HTTP REQUEST MESSAGE BODY: It contains the data of message that is to be sent to the server.
- It also has two parts 1. HEADERS and 2.BODY
- HTTP RESPONSE HEADERS:
- It contains the information of headers like Content Type, Status Code, Cookies, etc.
- Headers will help us to understand the content that is recieved from the server.
- HTTP RESPONSE BODY: It contains the data recieved from the server.
It's just a basic explanation about HTTP protocol. we will learn more about it in the upcoming articles.