In this Blog I am going write about HTTP Messages. HTTP Messages represent how data exchanged between server and client. There are two main message types in this section, They are requests and responses.
The simple description is, client’s request triggers an action in the server and returns the response for the particular request.
HTTP messages consist of textual information encoded in ASCII, which spread over several lines. Those messages were sent publicly across the link in HTTP/1.1, and earlier versions of the protocol. In HTTP/2, the message that used to be human-readable has been split into HTTP frames, enabling optimization and efficiency improvements.
HTTP request and response posses the same structure,
- Start Line – A single line with description of request to implement or its status.
- HTTP Header – Optional part, specify the request
- All meta-information
- Body – Optional part, contains data associate with request or response. Body size is initialized within the header.
HTTP Request
Start Line :
There are three main component of Start Line They are,
1. HTTP method(Verb) : simply the verb like GET,PUT,POST or noun like HEAD, OPTIONS.
2. Request Target : A URL or the path of the protocol,port and domain characterized by the request context.
3. HTTP Version : Define structure of the remaining message and acting as a guide.
Headers
Single line followed by the colon(:) and the value and content depend on header. There are many request headers are available. As General Headers, Request Headers and Entity Headers.
Body
It’s the final part of request. Possess the data needed to trigger action in server. Usually not all requests don’t need this one but some needed. And further this id classified into two as single resource bodies and Multiple resource bodies