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:
- A client’s program
- 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.
The HTTP messages are of the following two types:
- Request message
- Response message
The format of both these messages is almost the same.
It consists of a request line, headers, and body.
The request line is used for defining the request type, resource(URL), and HTTP version.
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.
- Host computer
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.
This is used by the client to provide some information to the server.
This method is used when the client wants some information about a document but not the document itself.
This is used by the client for providing a new or replacement document to be stored on the server.
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 method is used to copy a file to another location.
Move method is used for moving a file to another location.
It is used for removing a document on the server.
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 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.
It consists of a status line, a header , a blank line, and sometimes a body.
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.