HTTP stands for Hypertext Transfer Protocol. Http is mainly used to access data on www (World Wide Web).This protocol transfers data in the form of plain text, hypertext, audio, video, etc. The function of HTTP is almost like a combination of FTP and SMTP. It uses the service of TCP. It is used only on TCP connection (port 80). The Transferring data in HTTP is almost similar to the SMTP protocol. the format of the messages is controlled by M I M E like headers.
It is initially Developed by CERN, IETF, W3C in 1991.

Principle of HTTP operation

The principles of HTTP is simple. A client sends a request to the server. the server sends a response to the client. the request and response message carry data in the form of a letter with a mime like a format.

Working of HTTP

As a matter of fact, HTTP is the web’s application layer protocol. Actually, it is the heart of the web.
Basically , HTTP socket can be implemented in the following two programs:

  1. A client’s program
  2. A server’s program

Http defines how web clients such as browsers request web pages from a web server and how servers transfer web pages to clients.

HTTP uses TCP as its underlying transport protocol (rather than using UDP).

The HTTP client in the browser establishes a TCP connection with the server.

After establishing a connection, the browser, and the server process access TCP through their socket interface.TCP provides a reliable data transfer service to HTTP.

HTTP Messages

The HTTP messages are of the following two types:

  1. Request message
  2. Response message

The format of both these messages is almost the same.

Request message

It consists of a request line, headers, and body.

Request line

The request line is used for defining the request type, resource(URL), and HTTP version.

Request Type

Several request types are defined.

Uniform resource locator(URL)

For accessing a web page by the client an address needed. The HyperText Transfer Protocol (HTTP) uses the URL to facilitate access to any document distribution over the world.

The URL defines four things.

  1. Method
  2. Host computer
  3. Port
  4. Path

Methods(Request Type)

Get

This method is used when the client wants to receive a document from the server. The address from where this document is to be obtained is defined in the URL.

Post

This is used by the client to provide some information to the server.

Head

This method is used when the client wants some information about a document but not the document itself.

Put

This is used by the client for providing a new or replacement document to be stored on the server.

Patch

This is similar to PUT. But there is no one change. The request contains a list of differences that should be implemented in the existing file.

Copy

Copy method is used to copy a file to another location.

Move

Move method is used for moving a file to another location.

Delete

It is used for removing a document on the server.

Link

It is used for creating a link or a link from a document and another location. The location of the file is specified in the URL request line and the location of the destination is specified in the entity-header.

Unlink

unlink method is used for deleting the links created by the link method. Option: It is used by the client to ask the server about various available options.

Response Message

It consists of a status line, a header , a blank line, and sometimes a body.

Status line

Basically, the status line is used for defining the status of the response message. It consists of the HTTP version, status, status code, and status phrases with spaces in between.

Leave a Reply

Your email address will not be published. Required fields are marked *