Home » HTTP Message

HTTP Message

HTTP Message is used to show how data is exchanged between the client and the server. It is based on client-server architecture. An HTTP client is a program that establishes a connection to a server to send one or more HTTP request messages. An HTTP server is a program that accepts connections to serve HTTP requests by sending an HTTP response messages.

The HTTP Messages can be classified as follows:

Message Type

HTTP message consists of an initial request line and an initial response line.


1) Initial Request Line

The initial line is different for the request and for the response. A request-line consists of three parts: a method name, requested resource’s local path, and the HTTP version being used. All these parts are separated by spaces.



  • GET is the most common HTTP method.
  • The path shows the part of the URL after the host name. It is also called a request URI.
  • The version of HTTP always takes the form “HTTP/x.x”, uppercase.

HTTP Message

2) Initial Response Line

The initial Response line is also known as the status line. It also has three parts: the HTTP version, a response status code that gives the result of the request, and the English reason phrase describing the status code.



The HTTP version of the response line and request line are the same as “HTTP/x.x”.

HTTP Message

Message Headers

The Message header provides information about the request and response. It also provides information about the object which is sent in the message body. Message Headers are of four types:

  1. General Header: It has general applicability for both request messages and response messages.
  2. Request Header: It has applicability only for the request messages.
  3. Response Header: It has applicability only for the response messages.
  4. Entity Header: It defines meta-information about the entity-body, and about the resource identified by request.

All the above headers follow the same generic format. Each of the header fields consists of a name followed by a colon and the field values as follows:

Message Body

The message body of an HTTP message is used to carry the entire body associated with the request and response. The message-body differs from the entire-body only when a transfer-coding has been applied, as indicated by the Transfer-Encoding header field.


Transfer-Encoding MUST be used to indicate any transfer-codings which is applied by an application to ensure safe and proper transfer of the message. Transfer-Encoding is a property of the message.

Message Length

The transfer-length of a message is the length of the message-body, and it appears in the message.

In a message, when a message body is allowed, and Content-Length is given, its field value MUST exactly match the number of OCTETs in the message-body. When an invalid length is received and detected, the HTTP/1.1 user agents MUST notify the user.

General Header Fields

Some header fields have the applicability for both the request and response messages. These header fields apply only when the message is transmitted.


Next TopicHTTP Request

You may also like