This protocol is similar to others, like file transfer protocol, in that it’s used by a client program to request files from a remote server. In the case of HTTP, a web browser requests HTML files from a web server, which then display in the browser with text, images, hyperlinks, and related assets.
History of HTTP
Tim Berners-Lee created the initial HTTP standard in the early 1990s as part of his work in defining the original World Wide Web. Three primary versions were deployed during the 1990s:
HTTP 0.9: Support of basic hypertext documents.HTTP 1.0: Extensions to support rich websites.HTTP 1.1: Developed to address performance limitations of HTTP 1.0, specified in Internet RFC 2068.
The latest version, HTTP 2.0, became an approved standard in 2015. It maintains backward compatibility with HTTP 1.1 but offers additional performance enhancements. While standard HTTP does not encrypt traffic sent over a network, the HTTPS standard adds encryption to HTTP through the use of Secure Sockets Layer or, later, Transport Layer Security.
How HTTP Works
HTTP is an application layer protocol built on top of TCP that uses a client-server communication model. HTTP clients and servers communicate through request and response messages. The three main HTTP message types are GET, POST, and HEAD.
HTTP GET: Messages sent to a server contain only a URL. Zero or more optional data parameters may be appended to the end of the URL. The server processes the optional data portion of the URL, if present, and returns the result (a web page or element of a web page) to the browser. HTTP POST: Messages place any optional data parameters in the body of the request message rather than adding them to the end of the URL. HTTP HEAD: Requests work the same as GET requests. Instead of replying with the full contents of the URL, the server sends back only the header information (contained inside the HTML section).
The browser initiates communication with an HTTP server by initiating a TCP connection to the server. Web browsing sessions use server port 80 by default, although other ports such as 8080 are sometimes used instead. After a session is established, you trigger the sending and receiving of HTTP messages by visiting the web page. HTTP is what’s called a stateless system. This means that, unlike other file transfer protocols such as FTP, the HTTP connection is dropped after the request completes. So, after your web browser sends the request and the server responds with the page, the connection closes.
Troubleshooting HTTP
Messages transmitted over HTTP may fail for several reasons:
User error.Malfunction of the web browser or web server.Errors in the creation of web pages.Temporary network glitches.
When these failures occur, the protocol captures the cause of the failure and reports an error code to the browser called an HTTP status line/code. Errors begin with a certain number to indicate what kind of error it is. For example, errors with a failure code beginning with a four indicate that the request for the page cannot be completed properly, or that the request contains the incorrect syntax. As an example, 404 errors mean that a web page cannot be found; some websites even offer fun custom 404 error pages.