+3 votes
158 views
in Technical issues by (242k points)
reopened
What is HTTP?

1 Answer

+4 votes
by (1.6m points)
edited
 
Best answer

What does HTTP mean?
What is the role of HTTP?
How does HTTP work?
What is HTTP used for?
What versions of HTTP are there?
The first version: HTTP / 1
The first official standard: HTTP / 1.1
A much needed update: HTTP / 2
The future: HTTP / 3

image

What is HTTP?

All addresses on the Internet begin with http: // (or https: // ). These acronyms refer to the HTTP protocol, which is the one used by the browser to access a web page. What is HTTP, how are the different versions different, and what other concepts are related to the protocol?

Index
  1. What does HTTP mean?
  2. What is the role of HTTP?
  3. How does HTTP work?
  4. What is HTTP used for?
  5. What versions of HTTP are there?
    1. The first version: HTTP / 1
    2. The first official standard: HTTP / 1.1
    3. A much needed update: HTTP / 2
    4. The future: HTTP / 3

What does HTTP mean?

HTTP is the acronym for Hypertext Transfer Protocol , that is, Hypertext Transfer Protocol . This concept is one of those that Tim Berners-Lee developed at CERN (Switzerland) and formed the basis of the World Wide Web: the other two are HTML and URI. While HTML (Hypertext Markup Language) defines the structure of web pages, the URL (Uniform Resource Locator), a form derived from the URI, defines how a resource (e.g. a web page) is located on the Internet . The HTTP protocol, on the other hand, regulates how the server sends this resource to the client..

But what does hypertext mean , that term that is part of the acronym HTTP and HTML? It is a concept that we all really know: the link to other files, such as hyperlinks that are used on web pages to redirect to other pages.

What is the role of HTTP?

When you type a web address in your browser and the page you want opens, it is because your browser has communicated with the web server over HTTP. In other words, the HTTP protocol is the code or language in which the browser tells the server which page it wants to view..

How does HTTP work?

The easiest way to explain how HTTP works is by describing how a web page opens:

  1. In the browser's address bar, the user types example.com .
  2. The browser sends that request, that is, the  HTTP request , to the web server managing the example.com domain . Typically the client request says something like? Send me this file ?, but it can also just be? Do you have this file ?.
  3. The web server receives the HTTP request, finds the file in question (in our example, the home page of example.com , which corresponds to the index.html file ), and sends a header first . This header communicates to the client, by means of a status code, the search result. For more details about status codes, don't miss our article about them.
  4. If the requested file has been found and the client has requested to receive it (and not only to know if it exists), the server sends, after the header , the message body or body of the message, that is, the requested content: in our example, the index.html file .
  5. The browser receives the file and opens it as a web page.
image
Schematic representation of the communication process based on the HTTP protocol

What is HTTP used for?

When it was created, the HTTP protocol was only used to request HTML documents from a web server. Today, instead, it is used for a variety of purposes:

  • Browsers use HTTP to request any type of file common to modern websites: text, video, programming code, etc.
  • The application programs use HTTP to upload files and updates to remote servers.
  • The REST-based API  is a solution that uses HTTP to control web services.
  • Another technology that is based on HTTP is WebDAV .
  • In machine-to-machine communication, HTTP is used as the communication protocol between web services.
  • Media players also use HTTP.
  • Database access operations on the web, and therefore also CRUD operations, can also be performed using HTTP.

What versions of HTTP are there?

The first version: HTTP / 1

The history of HTTP began in 1989, when Tim Berners-Lee and his team at CERN (Switzerland) began to develop the World Wide Web. The initial version of HTTP was baptized with the version number 0.9 , it consisted of single line and only allowed to request one HTML file from the server at a time.

  GET /dummy.html  

The server then did nothing more than transfer the requested file, so this version of the protocol could only handle HTML files..

In 1996, the Internet Engineering Task Force (IETF) described, in memorandum RFC1945, the HTTP / 1 version as a simple proposal. This version included a header with which you could specify both the client's request and the server's response. Among other things, the header field called Content-Type was introduced , which allowed to transfer other types of files that were not HTML. In summary, this new version of the HTTP protocol had the following characteristics:

  • Ephemeral connection : the client establishes a connection with the server, sends its request and the server responds: once it has done so, the connection is terminated. To make a new request, the customer has to re-establish a connection, which is costly because web pages are often made up of many files that must be collected through one-to-one requests.
  • Stateless : Both parties to the communication, the client and the server, quickly forget about each other. Thus, when the client contacts the server again, it does not remember that the client has already sent requests to it before.
  • Independent of file type : HTTP allows transfer of all types of files, as long as both parties know how to handle the type in question.

The first official standard: HTTP / 1.1

In 1997, the HTTP / 1.1 version was published, described in memorandum RFC2068 and considered the first official standard . This version is still in use today and has important changes from HTTP / 1:

  • Keepalive : the client can decide to keep the connection beyond the request ( persistent connection ) by adding the keepalive command to the header ( keep alive ).
  • HTTP pipelining : This technique allows the client to send the next request without having to wait for the response from the first.
  • In chats , the browser can update the window using the multipart / replace MIME type .
  • Data can also be transferred from the client to the server .
  • With the new TRACE method , the path between the client and the web server can be traced.
  • Cache : there are new mechanisms to temporarily save content.
  • Host : The host specification in the header allows the HTTP request to work also if there are several domains hosted on the same IP address, which is currently the case in most web pages due to shared hosting .

A much needed update: HTTP / 2

As the years went by, web pages became more and more extensive and complex. To load a modern web in the browser, it has to request many megabytes of data and send up to a hundred HTTP requests. HTTP / 1.1 is designed to process requests one after another in the same connection, so the more complex a web page is, the longer it will take to load and display.

For this reason, Google developed a new and experimental protocol, SPDY or Speedy, which aroused great interest among developers and allowed the HTTP / 2 version of the protocol to be published in 2015. This standard includes, among others, the following improvements, which aim to speed up the loading of web pages:

  • Binary data . The protocol works with binary data instead of text files.
  • Multiplex . The client and the server can send and process multiple HTTP requests simultaneously.
  • Compression . The headers are compressed, since they are identical in many HTTP requests and thus, redundancies are avoided.
  • Server Push . When the server anticipates what data the client will ask for, it sends it directly to the client's cache, without waiting for the corresponding HTTP request.

The HTTP / 2 version spread quickly, and high-traffic web pages were among the first to adopt it. Currently (as of January 2020), according to W3Techs, 42% of web pages use the HTTP / 2 version.

advice

To learn more about HTTP / 2, check out our article How HTTP / 2 optimizes the World Wide Web .

The future: HTTP / 3

A weak point of all the versions of HTTP used so far is the Transmission Control Protocol (TCP) on which they are based. This protocol requires the receiver of each data packet to acknowledge receipt before the next packet can be sent. In this way, it is enough that a packet is lost so that everyone else has to wait for that packet to be transmitted again. Among specialists, these cases are called head-of-line blocking .

To avoid them, the new HTTP / 3 version will not work with TCP, but with UDP , which does not apply this type of corrective measures. From UDP, the QUIC (Quick UDP Internet Connections) protocol has been created, which will be the basis for HTTP / 3.

While HTTP / 3 has not yet been officially approved by the IETF, according to W3Techs 3% of web pages already use QUIC, or, as it were, HTTP / 3.


...