What is a Cookie ?(1) (Simple approach)

Cookie ? 

(1) Cookie is just an arbitrary list of key = value information.

(2) Cookie is sent from a server to a client's browser. (using Set-Cookie HTTP Response)
* Set-Cookie HTTP is just a response for setting a cookie and sending(responsing) it to a browser.

(3) Then, the client's browser remembers the cookie contents, storing it in a browser cookie database.

(4) After storing the cookie in a browser cookie database, when user go to the same site in the future, the client's browser will select those cookies and pass them back in a Cookie request header.

In picture, like this :

1. At first , Client's browser go to some site. Let's assume it "www.blogger.com"


2. Server send a cookie to a Client(Browser). The contents of cookie is " id = 4882 " .




3. The cookie sent from a server is stored in a Client's browser cookie database.



4. when user go to the same site in the future, the client's browser will select those cookies and pass them back in a Cookie request header.





See ? It's done!

Conclusion -

The basic idea of cookies :

To let the client's browser accumulate a set of server-specific information, and provide this information back to the server each time you visit.

* Because the browser is responsible for storing the cookie information, the system is called client-side state.



Refernce book : HTTP Defintive Guide.

댓글 없음:

댓글 쓰기