HyperText Transfer Protocol
The HyperText Transfer Protocol (HTTP) is a TCP/IP protocol that transports hypertext documents across the Internet or an intranet. HTTP has been in use since 1990. The first version of HTTP, referred to as HTTP/0.9, was a simple protocol that allowed for binary data transfer across the Internet. HTTP/1.0 improved the protocol by allowing messages to be in MIME format, which increased the speed and the efficiency of the protocol.
HTTP is used for communication between the HTTP client and HTTP server. An HTTP client can connect to an HTTP server located half way around the world. The only difference is that the download of data may take longer. HTTP, like other TCP/IP protocols, is based on a client/server relationship.
Client/Server relationship
The HTTP client starts the process by connecting to an HTTP server. The HTTP client sends a request to the HTTP server. The request includes a request method.
Request methods
The two main request methods are the following:
GETRetrieves all the data located at a specific URL.
HEADPerforms the same function as a GET; however, the server will not return HTML files in the response. The HEAD method is often used to test a URL.
Note
These methods are case-sensitive and are always uppercase.
Server response
When the server receives the request from the client, it sends back a response. A response can be in one of two forms, a simple response or a full response. A simple response is the Entity Body, which is all the data located at the site. For example, if an HTML file named index.html is located at a given site, this file will be returned.
A full response contains more data including a status code. The status code is a three digit number that specifies the result. The following list shows some status code values and the meaning:
200the HTTP server accepts the request and returns OK
301the HHTP server informs the client that the site has moved permanently
400the HTTP server informs the client that a bad request was sent
401the HTTP server informs the client that it is unauthorized to access the site
403the HTTP server informs the client that it is forbidden to access the site
404the HTTP server informs the client that the specified site was not found
Note
A full response is used only in HTTP/1.0. A simple response is only sent in response to an HTTP/0.9 simple request.