Let me start by asking the question, “What do you think HTTP is?”

“HTTP is HyperText Transfer Protocol,” you might blurt out without thinking.

That’s right! I have to congratulate you: this means that you have at least 50% knowledge of HTTP and are considered “half an expert.”

But for a change of scene, suppose an interviewer asks the question instead of me.

  • What do you think of HTTP’s literal “hypertext” and “transport protocol”?
  • Can you tell us what you know about HTTP? The more, the better.
  • What are the features of HTTP? What are the advantages and disadvantages?
  • What are the protocols underlying HTTP? How does it work?

Almost every HTTP question you can ask in an interview can start with a simple “What is HTTP?” Derivation.

So, today’s topic begins with a deep answer to the question “What is HTTP?” “And, by extension, the second question” What isn’t HTTP?”

What is the HTTP

We Chinese have an idiom “Ren Ren as his name”, which means that a person’s personality and characteristics are consistent with his name.

Let’s take a look at HTTP’s name: “Hypertext Transfer Protocol”. It can be broken down into three parts: “hypertext”, “Transport” and “Protocol”. Let’s go through them one at a time, and once we understand these three words, we’ll know what HTTP is.

agreement

“Protocols” are not limited to the computer world, but can be found everywhere in real life. For example, you may sign a “tripartite agreement” when you graduate, a “rental agreement” when you look for an apartment, a “non-disclosure agreement” when you join a company, and a “license agreement” for all kinds of software you use at work.

These are all “protocols”, essentially the same as HTTP, so “protocol” features?

First, an agreement must have two or more participants, known as an agreement.

If it’s just you, then you can do what you want and play how you want without interfering with other people and other people interfering with you, and there’s no need for an “agreement.” However, once more than two participants are present, agreements naturally emerge in order to ensure the most basic communication.

For example, in order to secure your employment, there are three parties in a tripartite agreement: you, the company and the school; To ensure you move in, there are two players in the rental agreement: you and the landlord.

Secondly, agreement is a kind of behavioral agreement and norm for participants, namely “discussion”.

Agreement means that there are multiple participants to reach a common purpose and stand together, in addition to clearly communicate, but also must clearly define the “responsibility, rights and benefits” of each party, agree on what should and shouldn’t do, what to do first and then what to do, what to do wrong, whether there are remedial measures and so on. For example, the “rental agreement” on the agreement, the lease period of how many months, how much the monthly rent, how much the deposit, who will pay the utilities, how to deal with the breach of contract and so on.

Well, at this point, you should be able to understand the first layer of HTTP.

HTTP is a protocol used in the computer world. It uses a language that computers can understand to establish a specification for communication between computers, as well as related controls and error handling.

Next, let’s look at the second part of the HTTP literal: “transport.”

There are countless roles in the computer and networking world: CPU, memory, bus, disk, operating system, browser, gateway, server… The communication between these roles is bound to have various and multifarious protocols with different uses, such as broadcasting protocol, addressing protocol, routing protocol, tunnel protocol, election protocol and so on.

HTTP is A “transport protocol,” and A “Transfer” is simply moving A bunch of stuff from point A to point B, or from point B to point A, A<===>B.

Don’t underestimate this simple action, it also contains at least two important pieces of information. First, HTTP is a “two-way protocol.”

That is, there are two basic actors, A and B, starting at A and ending at B, and data flows between A and B in both directions rather than in one direction. Usually, we call A who initiates the transmission action first as the requester, and B who receives the transmission action later as the responder or responder. Take the most common Internet surfing as an example, the browser is the requestor A, and the websites such as Wangyi and Sina are the responder B. The two parties agree to use HTTP protocol to communicate, so the browser sends some data to the website, the website sends some data back to the browser, finally displayed on the screen, you can see all kinds of interesting news, video.

Second, although data is transmitted between A and B, there is no restriction on only A and B, allowing “relay” or “relay” in between.

In this way, the transmission mode is changed from “A<===>B” to “A<=>X<=>Y<=>Z<=>B”. Any number of “middlemen” can exist in the transmission process from A to B, and these middlemen also comply with the HTTP protocol, as long as they do not disturb the basic data transmission, any additional functions can be added. Such as security authentication, data compression, code conversion and so on, optimize the entire transmission process.

At this point, you should probably get the second meaning of HTTP.

HTTP is a convention and specification for transferring data between two points in the computer world.

With “protocol” and “transport” out of the way, we finally get to the third part of the HTTP literal: “hypertext.”

If HTTP is a “transport protocol,” what exactly is the “hypertext” it transmits? Let me explain it further with two points.

Text means that HTTP is not a jumble of datagrams shred in low-level protocols like TCP/UDP, but full, meaningful data that can be processed by upper-level applications like browsers and servers.

In the early days of the Internet, “text” was simply a character text, but today, the meaning of “text” has been greatly expanded, images, audio, video, and even compressed packages can be considered as “text” in the eyes of HTTP.

The so-called “hypertext” is “text beyond ordinary text”, it is a mixture of text, pictures, audio and video, etc., the most important is that it contains “hyperlinks”, which can jump from one “hypertext” to another “hypertext”, forming complex nonlinear, mesh structure relations.

For “hypertext”, we are most familiar with HTML, which is just a pure text file, but it uses many tags to define links to pictures, audio and video, etc. After the interpretation of the browser, we are presented with a page containing a variety of audio-visual information.

OK, after a detailed explanation of the three nouns in HTTP, next time when you are faced with the interviewer, you can give more than “hypertext transfer protocol” these seven words more accurately and more have technical content of the answer: “HTTP is a specialized in computer world transport between two points in hypertext data such as text, images, audio, video, conventions and norms”.

What HTTP is not

Now your answer to the question “What is HTTP? It should be clear that the next question is “What is HTTP not?” The equivalent question is “What can’T HTTP do?” . Think about it, can you answer it?

Because HTTP is a protocol and a specification for communication between computers, it does not exist as a “separate entity.” It is not an application like browser or mobile phone APP, nor an operating system like Windows or Linux, nor a Web server like Apache, Nginx or Tomcat.

However, HTTP is closely related to applications, operating systems and Web servers. It exists in the communication process between them, and it is a “dynamic existence”. It is a “dynamic process” that occurs when the network is connected and hypertext data is transmitted.

HTTP is not the Internet.

The Internet (Internet) is a huge international network which is connected by many networks all over the world. It stores all kinds of resources and also corresponds to all kinds of protocols, such as HTTP for hypertext resources, FTP for common files, SMTP and POP3 for E-mail, etc.

But there’s no question that HTTP is an important piece of the puzzle in building the Internet, and it’s the biggest piece.

HTTP is not a programming language.

Programming language is the language that people use to communicate with computers, and HTTP is the language that computers use to communicate with computers. We cannot use HTTP to program, but we can use programming language to realize HTTP, and tell computers how to use HTTP to communicate with the outside world.

Many popular programming languages support writing HTTP related services or applications, such as Web services in Tomcat using Java, page template rendering in PHP at the back end, and dynamic page updates in JavaScript at the front end. Do you know one or two of these?

HTTP is not HTML, and it’s important to note that HTTP should never be confused with HTML, although the two often go together.

HTML is the carrier of hypertext and a markup language. It uses various tags to describe text, images, hyperlinks and other resources, and can embed CSS, JavaScript and other technologies to achieve complex dynamic effects. In terms of the number of times HTTP transfers the most over the Internet is probably HTML, but in terms of the amount of data, HTML is probably a bit behind, and images, audio, video, and other types of resources are obviously bigger.

HTTP is not an isolated protocol.

As the saying goes, “One man helps three men,” and HTTP is no different.

In the Internet world, HTTP usually runs on top of TCP/IP protocol stack, relying on IP protocol for addressing and routing, TCP protocol for reliable data transmission, DNS protocol for domain name lookup, SSL/TLS protocol for secure communication. In addition, there are some protocols that rely on HTTP, such as WebSocket, HTTPDNS, and so on. These protocols are intertwined to form a network of protocols, with HTTP at the center.

summary

  • HTTP is a protocol used in the computer world. It establishes a standard for communication between computers, as well as various controls and error handling methods.
  • HTTP is designed to transfer data between two points and cannot be used for broadcasting, addressing, or routing.
  • HTTP transmits hypertext data such as text, image, audio, and video.
  • HTTP is the fundamental technology that builds the Internet. It has no entity and relies on many other technologies to implement it, but many of them also rely on it.

Putting all this together, using recursive abbreviations (modeled after PHP), we can define HTTP as “the sum of all application-layer technologies associated with the HTTP protocol.”

Here I’ve drawn a mind map, a kind of knowledge map for this column series.

Homework after class

  • There is a popular saying that “HTTP is a protocol for transferring hypertext from an Internet server to a local browser.” Do you think this is true? What is right and what is wrong?
  • Can you say a few more “what HTTP is not”?

This article originated from Geek Time perspective HTTP Protocol