In this blog we will learn about what is HTTP , HTTP Request structure at the client side and HTTP Response structure at the server side.
HTTP (HyperText Transfer Protocol):
Data communication in the internet is done on the basis of this protocol.
Data communication starts when client sents request sent from a client and ends when a response is received from server side .
When a user writes an http:// on client side (browser : User Agent) and presses the enters key, a Data communication starts by sending a request to the server that is hosting the site with the given address.Now the server returns a response as in the form of an HTML page or any other type of document that will be diplayed at client side. The web browser is called a User Agent.
HTTP Request Structure from the Client
A Request message from a client side consists of the below mentioned components:
1- A request line to get a required resource, for example a request GET /content/page1.html is
requesting a resource called /content/page1.html from the server.
2- Headers (Example: Accept: text/plain , Accept-Charset: utf-8 .. etc).
3- An empty line : It indicates the end of the header fields.
4- A message body which is optional.
The message-body(entity body) (it exists if there is any message) of an HTTP message carry an entity-body which is associated with the respective request/response. message-body and entity-body differs from each other.
An entity is in the message. Entity represents the set of entity-headers and the entity-body (the message-body). Some message-headers describe the message and some describe an entity.
For Example:
Date, is a message-header ( this is used to describes the message) and
Content-Type is an entity-header (this is used to describes the entity).
All the lines must end with a carriage return and line feed.
Empty line must only contain carriage return and line feed without spaces.
HTTP Request Structure from the Web Server
A Response from the server side contains the below mentioned components:
1- HTTP Status Code (For example HTTP/1.1 301 It means that the current and all future requests
must be directed to the given URI).
2- Headers (Example: Content-Type: html)
3- An empty line.
4- A message body which is optional.
All the lines must end with a carriage return and line feed.
Empty line must only contain carriage return and line feed without spaces.
0 Comment(s)