HTTP is Stateless
Learning objectives
- Knows that the HTTP protocol is stateless, and knows the implications of this.
HTTP is a stateless protocol. This means that every request that is made to the server is independent from other requests, and thus, not linked to any previous or future requests. When we make two simple GET requests to a server using the HTTP protocol, there is nothing in the requests that would allow the server to determine whether the requests were made by the same client.
GET / HTTP/1.1
Host: myserver.net
GET / HTTP/1.1
Host: myserver.net
There is a need to distinguish users, however. For example, applications that require authentication need to be able to determine whether the user has previously logged in. If this information would not be available, the user would have to send credentials to the server during every request. Similarly, online shopping sites keep track of users to, for example, maintain shopping carts and to identify which items individual users are interested in -- if it would not be possible to distinguish users from each other, maintaining user-specific shopping carts or creating personalized suggestions would not be possible.
A solution to the problem, initially proposed in mid 1990s, is cookies. We will look into cookies next.