Hypertext Transfer Protocol Explained

Everything You Need to Know About HTTP

Word http: carved in blocks
Tetra Images / Getty Images

HTTP (Hypertext Transfer Protocol) provides a network protocol standard that web browsers and servers use to communicate. It's easy to recognize this when visiting a website because it's written right in the URL (e.g. http://www.lifewire.com).

This protocol is similar to others like FTP in that it's used by a client program to request files from a remote server. In the case of HTTP, it's usually a web browser that requests HTML files from a web server, which are then displayed in the browser with text, images, hyperlinks, etc.

HTTP is what's called a "stateless system." What this means is that unlike other file transfer protocols such as FTP, the HTTP connection is dropped once the request has been made. So, once your web browser sends the request and the server responds with the page, the connection is closed.

Since most web browser default to HTTP, you can type just the domain name and have the browser auto-fill the "http://" portion.

History of HTTP

Tim Berners-Lee created the initial HTTP in the early 1990s as part of his work in defining the original World Wide Web.  Three primary versions were widely deployed during the 1990s:

  • HTTP 0.9 (for support of basic hypertext documents)
  • HTTP 1.0 (extensions to support rich websites and scalability)
  • 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 was developed to add encryption to HTTP via the use of (originally) Secure Sockets Layer (SSL) or (later) Transport Layer Security (TLS).

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 via HTTP 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 request works 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.

Once a session is established, the user triggers the sending and receiving of HTTP messages by visiting the web page.

Issues With HTTP

Messages transmitted over HTTP can fail to be delivered successfully 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 (if possible) and reports an error code back 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, 4xx errors indicate that the request for the page can not be completed properly or that the request contains incorrect syntax. As an example, 404 errors means that the page can not be found; some websites even have some fun custom 404 error pages.