3 ms·
>I think of cookies as a mechanism to send data across the network. That mechanism can be used to simulate persistence on the client, among other things. I can
by NovemberWhiskey 4y ago
>I think of cookies as a mechanism to send data across the network. That mechanism can be used to simulate persistence on the client, among other things.
I can't get with that definition. A server that attempts to set a cookie is very explicitly asking for state persistence on the client in the otherwise stateless HTTP protocol exchange. It literally has no other purpose.
- javajosh 4y agoCookies are a way for clients (and servers) to add data to HTTP requests. It's a header, plus the expectation that the client will add this data to subsequent requests sent within a certain timeframe. Consider that a similar effect can be achieved by adding an id to every link in the body of a response. But its still just a link. In fact, before cookies this is how you associated requests with each other into a "session". And indeed, this is still a way to do user tracking across domains without cookies and in a way that is impossible to block in general. What a thing is used for is not the thing itself.
- NovemberWhiskey 4y ago>plus the expectation that the client will add this data to subsequent requests sent within a certain timeframe That's the definition of "client-side state". Cookies have no purpose other than maintenance of client-side state. https://www.rfc-editor.org/rfc/rfc6265 https://www.rfc-editor.org/rfc/rfc6265 "This document defines the HTTP Cookie and Set-Cookie header fields. These header fields can be used by HTTP servers to store state (called cookies) at HTTP user agents, letting the servers maintain a stateful session over the mostly stateless HTTP protocol."