Table of contents
HTTP is the foundation of the world wide web.
The main objective of HTTP is to load webpages using hyperlinks.
Origin of HTTP
Developed by Tim Berners-Lee and his team between 1989-91.
After that, HTTP has gone through many changes that have helped maintain its simplicity while shaping its flexibility.
Versions of HTTP: HTTP/0.9, HTTP/1.0, HTTP/1.1(used for 15 years), HTTP/2, HTTP/3.
whenever the web browser requests any request say image, video, etc it is called a request and when a message is sent to the server as an answer is called a response.
HTTP can also be used to fetch parts of documents to update Web pages on demand.
Basic aspects of HTTP
A typical flow over HTTP involves a client machine requesting a server, which then sends a response message.
HTTP is simple and human-readable as its messages can be read and understood by humans, easier debugging for developers.
HTTP is a connectionless protocol. when the HTTP client initiates a request and waits for a response from the server.
As the server receives the request, the server process the request and sends back the response to the HTTP client after which the client disconnects the connection.
In other words, HTTP is connectionless except during receiving a request and during receiving a response time only.
HTTP is stateless as there is no link between two requests being successively carried out on the same connection.
Methods
GET: a ‘GET’ request expects information back in return (usually in the form of a website).
-> The request method tells us what to do.
-> URI(uniform resource locator) which shows readable characters and a way to locate the resource.
POST: a 'POST' request typically indicates that the client is submitting information to the web server (such as form information, e.g. a submitted username and password).
APIs based on HTTP
The most commonly used API based on HTTP is the XMLHttpRequest API, which can be used to exchange data between a user agent and a server.
The modern Fetch_API provides the same features with a more powerful and flexible feature set.
Therefore, we can say that HTTP is an extensible protocol that is easy to use. The client-server structure, combined with the ability to add headers, allows HTTP to advance along with the extended capabilities of the Web.