⊗inhpAdvSs 27 of 29 menu

Session in HTTP

Cookies are the basis for sessions. Sessions allow the server to remember the client and store information for him.

For example, a website visitor can add items to a shopping cart. And after the page is reloaded, the server will identify the client and show him the items that were put aside in this browser.

Let's see how this works. As you already know, the HTTP protocol is stateless in the sense that the server cannot distinguish which client the request came from. So in this case, a workaround is used.

Its essence is as follows. When the client first requests the server sets a cookie with a random unique string. This cookie is called session and usually has the name sessid.

The server also stores a list of all session cookies and binds the necessary data to them. For example, a list of selected products in a store.

The next time the client accesses the server, it will send a session cookie to the server, and the server will identify it by this cookie and will be able to obtain the data that is stored on the server for this client.

The HTTP protocol does not store data between requests. However, the server can distinguish users. How is this implemented?

azbydeenesfrkakkptruuz