Is the HTTP protocol in version 2 still stateless (stateless)?

Asked

Viewed 314 times

15

HTTP is a stateless protocol (stateless), i.e., requests and responses are independent, so the server does not need to store any data from any previous action.

But with its new version (HTTP 2), a Feature has been added:

"Only the changing headers are sent back [...] it is possible to reuse the headers for the following requests. This way, we only have to send the headers that change. This reduces the requests and makes them less bulky."

So now it becomes necessary to save the data of the headers used previously to send only those that have changed. This makes HTTP no longer stateless?

1 answer

4

Good afternoon, I will give my cooperation, although I am studying the subject now.

From a glance at the image below, as I understand it, the idea is simply to repurpose the last header, the protocol itself will be responsible for reusing the last header when the source of the data is the same, until the header is intentionally replaced the expire, I don’t know if that’s keeping state, because the connection is not kept between requests.

follows an initial reference on the subject: https://developers.google.com/web/fundamentals/performance/http2/? hl=en

inserir a descrição da imagem aqui

First analysis:

"if you allow us to undo many of the HTTP/1.1 palliative solutions previously adopted within the applications and solve these problems within the transport layer itself"

R: I believe that the header of the transport layer itself will be responsible for indicating the origin, it is the header of the application that today we use that will be reused, one of the intentions of the new protocol seems to be to do what is already done in the application layer with more performabce in the transport layer

Segunda Analise:

Stateless Look at the Wiki:

"In computing, a stateless protocol (stateless) is a communication protocol that considers each request as an independent transaction that is not related to any previous request, so that the communication consists of independent request and response pairs. A stateless protocol does not require the server to retain information or session status about each communication partner for the duration of multiple requests."

R: The Server still has no responsibility to retain this information, the transport layer would be responsible for the reuse of the headers, as well as the compression and multiplexing, which are the main gains of the protocol.

  • And how does HTTP know that the source is the same and which headers were used before? The server needs to somehow save this, no?

  • I edited the answer with some unpretentious analysis of the content of the article.

  • I can not understand yet. In headers is passed the origin of the request, I consider something like IP, so he compares this IP with what? to know which headers to return?

  • 2

    The stateless concept says that each request must be independent, unrelated to the previous protocol however establishing the connection being modified, if you open the browser console and check the Network tab, in the footer of it, will see a large number of connections, including with the same data source, in the new protocol the connections will be more "lasting" what allows a take advantage of data, the requests of the application layer remain stateless, but the protocol stores information about the data already circulated by the connection to "reuse them"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.