How HTTP works

Hypertext Transfer Protocol (HTTP) provides a network protocol standard that web browsers and servers use to communicate. You see HTTP every day because when you visit a website, the protocol is written right in the URL.

Hypertext Transfer Protocol (HTTP) provides a network protocol standard that web browsers and servers use to communicate. You see HTTP every day because when you visit a website, the protocol is written right in the URL.

This protocol is similar to the file transfer protocol in that it is used by the client program to request files from the remote server. In the case of HTTP, usually a web browser requests HTML files from the web server, then displays in the browser with text, images, hyperlinks and related assets.

Because browsers by default communicate using HTTP, you can usually remove the protocol from the URL when typing in the browser's address bar.

To learn more, please refer to the article: What is HTTP?

How HTTP works

HTTP is an application layer protocol built on TCP, using a communication model between the client and the server. Client and HTTP server communicate via request and response messages. The three main types of HTTP notifications are GET, POST and HEAD.

  1. HTTP GET - The message sent to the server contains only one URL. No or more optional data parameters can be appended to the end of the URL. The server processes the optional data portion of the URL, if any, and returns the result (a web page or web page element) to the browser.
  2. HTTP POST - The message places any optional data parameters in the body of the request message, instead of appending them to the end of the URL.
  3. HTTP HEAD - Requests act the same as GET. Instead of replying with the full text of the URL, the server only sends header information (included in the HTML section).
Picture 1 of How HTTP works
How HTTP works

The browser starts communicating with the HTTP server by starting 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 the session is established, you enable sending and receiving HTTP messages by visiting the website.

HTTP is a stateless system. This means that unlike other file transfer protocols such as FTP, the HTTP connection is canceled after the request is completed. Therefore, after the web browser sends the request and the server responds to the page, the connection will be closed.

Troubleshooting HTTP

Messages transmitted over HTTP failed for a number of reasons:

  1. User error
  2. Malfunction of web browser or web server
  3. Error creating site
  4. Temporary network problem

When these errors occur, the protocol that captures the cause of the error and reports the error code back to the browser is called the HTTP status line / code. The error begins with a certain number to indicate what kind of error it is.

For example, errors with error codes starting with 4 indicate that the request for the page could not be completed properly or the request contained incorrect syntax. For example, a 404 error means that the page cannot be found. Some sites even offer interesting custom 404 error pages.

Update 30 January 2020
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile