We will see the structure of HTTP messages. Messages can be requests and responses.
Messages are texts. Usually, web developers won't craft these messages, and web browsers do it.
The first line in the message is called 'Start line' and is always a single line.
Then set of HTTP headers like key: value pairs.
Empty line denoting the end of metadata.
After an empty line, then the body comes. It consists of request or response data.
The start-line and HTTP headers of the HTTP message are collectively known as the head of the requests, whereas its payload is known as the body.
Contains HTTP methods like verb GET, POST, PUT, or a noun like (HEAD and OPTIONS).
Start line [http method] [target/url] [http version]
It follows the structure of key-value pairs.
There are many headers which we will see later.
It can be single resource bodies based on content-type and content-length headers or multi-resource bodies in the case of Html forms.
Here start line is called the 'Status line'.It contains
Status line [http version] [status code] [status text] HTTP/1.1 404 Not found
The same structure of request messages applies to headers and body here.
By connection here, I mean TCP connection.
If there is a new TCP connection established on every request-response cycle - It is called a Short-lived connection.
Many request-response cycles with the same TCP connection - Persistent connection.
Sending successive http requests without waiting for corresponding responses in the same TCP connection - Pipelining.
By default, Http 1.1 uses a persistent connection by default.
Today, every HTTP/1.1-compliant proxy and server should support pipelining, though many have limitations in practice: a significant reason no modern browser activates this feature by default.