Cookie
Maintain user/server state
HTTP GET/response is stateless, so in the server, we always create a cookie for each client, so that in following transactions, the server can track the request state of each client.
Privacy
In each website, it always asks for your sancation for the cookies, you can browse a new webpage that you never browsed before to try it.
Components
- cookie header line of HTTP response message
- cookie header line in next HTTP request message
- cookie file kept on user’s host, managed by user’s browser
- back-end database at website
What a site creates for cookie
- unique ID (aka “cookie”)
- entry in backend database for ID
Working process
Here is a graph to show how a cookie works
![](/note/computer-network/application-layer/cookie/cookie_hu83ed41a0a1e489b71ddc81a02d3f33fd_410707_848cd33ed4b28c5f923b327be0c9a6c3.png)