HTTP (or Hypertext Transfer Protocol according to abbreviationfinder) is a protocol used during the communication between a web client (usually a web browser) and a web server. The protocol is not only used on the Internet, but also on local networks (we are then talking about an intranet).
The HTTP protocol specifies the requests (English: requests) that a client, for example a web browser, can make to the server as well as the responses (English: responses ) that a web server can send back. Each request contains a URL that points to the web component or a static object such as a web page being requested.
HTTP requests
An HTTP request consists of a method, the URL, header fields and finally the content. An overview of the HTTP request methods:
- GET – Receives the document specified by the URL.
- HEAD – Receive only the headers of the requested document.
- POST – Send data to the server.
- PUT – Replace the document on the server with the transmitted data.
- DELETE – Delete the document.
- OPTIONS – Requests the possible options that the web server supports.
A complete request, with header fields, typically looks like this:
GET /wiki/Home Page HTTP/1.1Host: af.wikipedia.org Connection: close User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3Accept: text/xml,text/html,text/plain,image/png,image/jpeg,image/gif Accept-Charset: ISO-8859-1,utf-8Keep-Alive: 300
HTTP responses
An HTTP response consists of a result code, header fields and a message. The result code consists of three digits, of which the first digit is the most important:
- 1xx: an informal message from the web server that will be followed by more data
- 2xx: a message from the server indicating that the requested action was completed successfully
- 3xx: a redirect to another URL
- 4xx: an error message caused by the client (typically a web browser), such as an incorrect URL type.
- 5xx: an error message caused by the web server, such as an error in a CGI script
- 6xx: A proxy error occurred
The most commonly used result codes are:
- 200 OK – The requested document was forwarded successfully.
- 304 Not Modified – Compared to the cached version, the page has not been modified.
- 403 Forbidden – The requested document may not be viewed.
- 404 Not Found – The requested document does not exist.
- 405 Not Allowed – The user is not entitled to view the document.
- 500 Internal Server Error – The web server could not perform the requested action.
An answer to the above query could possibly look like this:
HTTP/1.0 200 OK Date: Word, 08 Apr 2004 18:24:33 GMT Server: Apache/1.3.29 (Unix) PHP/4.3.4X-Powered-By: PHP/4.3.4Content-Language: af Content-Type: text/html; charset=iso-8859-1X-Cache: MISS from wikipedia.org Connection: close Content Type: TEXT/HTML Content Length: 3’127 bytes (received)— The HTML Code —
History
The original HTTP version, version HTTP 1.0 initially did very well, but with the explosion in popularity of the Internet, a number of shortcomings came to light. These shortcomings are addressed in the next version, version HTTP 1.1. From around 1997, the standard on the World Wide Web is also shifting from HTTP 1.0 to HTTP 1.1.
One of the major limitations of HTTP 1.0 was that each IP address could host only 1 domain. Due to the enormous growth in the number of WWW domains, this would soon lead to a shortage of IP addresses. HTTP 1.1 supports hosting more than 1 domain on the same IP address. Other important additions in HTTP 1.1 that aim to increase speed and performance:
- support of a greenhouse ( cache)
- the connection is not necessarily broken after each response, as in HTTP 1.0 (so-called persistent connections)
- the possibility to partially send (dynamically generated) pages. This allows the sending of the first part to start before the entire page has been generated, even before it is known how long the page will end up being.
The technical details of the HTTP protocol are recorded in various RFCs. HTTP version 1.0 is documented in RFC 1945, while version 1.1 of the protocol is described in RFC 2616. These specifications can be downloaded from http://www.rfc-editor.org/rfc.html .