The past and present of HTTP protocol

Time:2020-2-22

The full name of HTTP protocol is hypertext transfer protocol, which needs to understand three aspects: hypertext, transmission and protocol. Let’s start from the history of HTTP protocol.

In the 1960s, ARPA was established by the advanced research program of the United States Department of Defense (ARPA). It has four nodes distributed around the world and is regarded as the ancestor of the Internet.

In the 1970s, based on the practice and thinking of ARPA network, researchers invented the famous TCP / IP protocol, and entered the UNIX kernel in the mid-1980s, enabling more computers to access the Internet.

HTTP was born

The past and present of HTTP protocol

The master is Tim Berners Lee, the founder of the world wide web, or simply the founder of the modern Internet.

In 1989, he published a paper and proposed the idea of building a hyperlink document system on the Internet. In this paper, he established three key technologies:

  • Uri: uniform resource identifier, as the unique identification of resources on the Internet
  • HTML: hypertext markup language, describing hypertext documents
  • Http: Hypertext Transfer Protocol, used to transfer hypertext

These three technologies directly lay the foundation of our technology in today’s web world, which Tim calls the world wide web.

So in 1989, HTTP was born.

HTTP/0.9

In the early 1990s, the Internet world was still a desert, with low computer processing capacity, small storage capacity and slow network speed. Most resources on the network are plain text resources, so HTTP protocol is also plain text format.

In order to facilitate the processing of the server and the client, the documents in Tim’s original system are read-only, so only users are allowed to get HTML documents from the server through get requests, and the connection is closed immediately after the response, with very limited functions.

Although this version of HTTP protocol is very simple, as a prototype, it fully verifies the feasibility of Web services.

HTTP/1.0

In 1993, the National Supercomputing Application Center (NCSA) of the United States developed mosaic, which is the first browser that can mix graphics and text. Then in 1995, it developed Apache, a server software, which simplifies the construction of HTTP services.

At the same time, JPEG image format was invented in 1992 and MP3 music format was invented in 1995.

With the emergence of these new technologies, HTTP protocol began to add various features, which promoted the development of HTTP protocol from the perspective of user needs.

After a series of drafts, http / 1.0 was officially released in 1996. The following parts are added:

  • New methods such as head / post are added
  • Added response status code
  • Version number added
  • Added the concept of header header
  • IncreasedContent-Type, transfer data is no longer limited to text

But http / 1.0 is not a standard. It is just a reference document to record existing practices and patterns. It has no actual binding force and is equivalent to a memo.

HTTP/1.1

In 1999, http / 1.1 released the RFC document with the number of 2616. From the version number, we can see that http / 1.1 is a small correction to http / 1.0. But an important difference is that it is a formal standard, not a reference document. However, http / 1.1 is not accurate for minor correction. The main changes are as follows:

  • New methods such as put / delete / options are added
  • Increased cache control and management Cache Control
  • Clear connection management, allowing persistent connectionsKeepalive
  • Allow response data to be partitioned to facilitate the transfer of large files (chunked)
  • Mandatory host header

All of our world-famous websites were founded around this time point. It can be said that with HTTP / 1.1, the era of Web 1.0 and Web 2.0 was created.

However, because http / 1.1 is too large and complex, another revision was made in 2014, which was split into six smaller documents, 7230 / 7231 / 7232 / 7233 / 7234 / 7235

These six documents add two major requirements:

  • Increase the security of HTTP, such as using TLS protocol
  • HTTP can support more applications. At present, it supports four kinds of network protocols:

    • Traditional short connection
    • Long connection model of reusable TCP
    • Server push model
    • Websocket model

HTTP/2

Http / 1.1 has two problems:

  1. The connection is slow, the request is serial, and the order needs to be guaranteed. For example, there may be multiple resources in a web page
  2. The performance is poor. Http / 1.1 reduces the network bandwidth in the form of text and zip compression of CPU, but consumes the CPU of front-end and back-end

In 2010, Google launched a new spdy protocol and applied it to its own servers. Http / 2 is based on spdy. Its features are as follows:

  • Use binary transfer, no longer plain text
  • Multiple HTTP requests can be concurrent in a TCP connection, removing the serial request in http / 1.1
  • Use hpack algorithm to compress the head
  • Allow server to actively push data to client
  • Enhanced security based on TLS protocol

HTTP/3

The main problem of HTTP / 2 is the blocking of the queue head. That is to say, several HTTP requests are reusing a TCP connection. In case of packet loss, the problem is that all requests must wait for the lost packet to be retransmitted, even if the packet is not my HTTP request.

Based on this, Google invented quick (quick UDP Internet connections) protocol, which is based on UDP. Therefore, it solves the following problems:

  • UDP is unordered, so there is no queue head blocking problem
  • Quic has its own protocol for packet loss retransmission and congestion control
  • HTTPS handshake usually requires six network interactions. Quic directly combines TLS and TCP into three handshakes

The past and present of HTTP protocol

Therefore, quic is a pseudo TCP + TLS + http / 2 multiplexing protocol over UDP. In the future, when quic protocol matures, it is possible to replace TCP protocol.

Pay attention to the official account and receive twenty sets of technical atlas.

The past and present of HTTP protocol

Recommended Today

Build HTTP service with C + + Mongoose

Mongoose source code address:https://github.com/cesanta/mo… Mongoose user manual:https://www.cesanta.com/devel… Mngoose set up HTTP service #include <string> #include “mongoose.h” using namespace std; static const char *s_http_port = “8000”; static void ev_handler(mg_connection *nc, int ev, void *ev_data) { struct http_message *hm = (struct http_message *) ev_data; if (ev == MG_EV_HTTP_REQUEST) { std::string uri; if (hm->uri.p && hm->uri.p[0] == ‘/’) […]