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.

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).
How HTTP works Picture 1
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.

5 ★ | 4 Vote

May be interested

  • 5 ways to improve website speed with HTTP / 25 ways to improve website speed with HTTP / 2
    hypertext transfer protocol version 2 (hypertext transfer protocol version 2) or http / 2 is the latest http standard. updates to this protocol will improve the speed, performance and security of web traffic.
  • Encrypt status in HTTPEncrypt status in HTTP
    the status-code element is a 3-character integer, in which the first character of the status encoding defines the response type and the last two characters do not have any sorting role. there are 5 values ​​of the first character.
  • Full list of HTTP status codes, HTTP Status CodeFull list of HTTP status codes, HTTP Status Code
    the http status line is the term given to the http status code (real code) when accompanied by the 'http reason phrase' - the term for the reason (short description).
  • MQTT and HTTP: Which protocol is better in the IoT era?MQTT and HTTP: Which protocol is better in the IoT era?
    the hypertext transfer protocol (http) has always been the most popular communication tool between client and web server. but is it still suitable for the internet of things era?
  • Example of Message in HTTPExample of Message in HTTP
    some examples of message in http make it easier for users to visualize.
  • What is HTTP Authentication? 5 Stages of HTTP AuthenticationWhat is HTTP Authentication? 5 Stages of HTTP Authentication
    http authentication is a security mechanism that helps verify the identity of users when they access web resources.
  • How to Execute HTTP POST Requests in AndroidHow to Execute HTTP POST Requests in Android
    http post is part of a deprecated http classes like org.apache.http and androidhttpclient as of android 5.1.https://developer.android.com/about/versions/android-5.1.html#http migrate your code to the httpurlconnection classes which...
  • How to use Fiddler to collect HTTP / HTTPS sessions for debuggingHow to use Fiddler to collect HTTP / HTTPS sessions for debugging
    fiddler is a free web debugging proxy that records all http / https traffic between your web application and the internet. collecting session data with fiddler can be useful for troubleshooting situations
  • What's the difference between HTTP and HTTPS?What's the difference between HTTP and HTTPS?
    you probably already know https as an enhanced form of http . however, do you already know the difference between http and https ? if not, let's find out with tipsmake.com!
  • URL encoding in HTTPURL encoding in HTTP
    http urls can only be sent via the internet by using ascii character sets, which often contain characters outside the ascii character set. therefore unsafe characters must be swapped with a% followed by two hexadecimal digits.