What is HTTP Message

Advertisements

Working of Http What is http Cookies

What is 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;

http message

HTTP messages include requests from client to server and responses from server to client which will have the following format:

Syntax

 HTTP-message   = <Request> | <Response> ; HTTP/1.1 messages

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.

Syntax

GET /path/to/file/index.html HTTP/1.0  

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.

Example

HTTP/1.0 200 OK  
or  
HTTP/1.0 404 Not Found  

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:

  • General Header: It has general applicability for both request messages and response messages.
  • Request Header: It has applicability only for the request messages.
  • Response Header: It has applicability only for the response messages.
  • 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:

Syntax

message-header = field-name ":" [ field-value ]  

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.

Syntax

message-body = entity-body  
        | <entity-body encoded as per Transfer-Encoding>

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.

Syntax

general-header = Cache-Control  

Working of Http What is http Cookies

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements