Introduction
HTTP has two types of messages, request message and response message. Both messages consist of a start line, headers, and an optional body.
Note that, HTTP messages, as defined in HTTP/1.1 and earlier, are human-readable. In HTTP/2, these messages are embedded into a binary structure, a frame, allowing optimizations like compression of headers and multiplexing.
Request Message
Http Request message consists of the following elements:
- An HTTP method.
- The path of the resource to fetch.
- The version of the HTTP protocol.
- Optional headers.
- An optional body.
Response Message
Http Response message consists of the following elements:
- The version of the HTTP protocol.
- A status code indicating the success or failure of the request.
- A status message.
- Optional headers.
- An optional body.