What is a Cookie? - a title Daily 20,190,623

What is a Cookie?

Cookie is actually a short text message, the client requests the server, if users need to record the state, issued a response on the use of Cookie to the client browser. Cookie clients will save up, and then when the browser requests that site, the browser requests submitted to the server along with the URL with Cookie, the server checks the Cookie, in order to identify the state of the user, the server can also be modified according to the needs of Cookie Content;

 

Cookie advantages and disadvantages

advantage:

        1. The high scalability and availability

                You can control the size of the session objects stored in a cookie;

                Transmission technology and security through encryption (SSL), to reduce the possibility of being cracked Cookie;

                Not only to store sensitive data in the Cookie, stolen there will be no great loss;

                Cookie lifetime of control, so that will not always be effective, thieves may get an expired Cookie;

                Text-based lightweight construction;

                Cookie stored in the client by the server and read at the transmission;

 

Disadvantages:

Limit the number and length 1.Cookie

                Each domain can only have a maximum of 20 cookie, the length of each cookie can not exceed 4KB, or else be cut off;

2. Security

                Cookie may be intercepted, tampered with. If the Cookie was intercepted person, that person can get all the information session

3. Some state can not be stored in the client

                Example: to prevent duplication submit the form, save the service counter at the end, if this counter is stored in the client, useless.

 

extend:

                Cookie and session of difference

                                1. cookie data == "customer's browser

                                                session data == "server

                                2.Cookie not very safe, people can analyze stored locally Cookie and Cookie deception, taking into account the security should be used session

                                3.session be saved within a certain time on the server when accessing the increase, it would be more take up server performance, taking into account mitigating server performance, you should use the Cookie

                                4. single Cookie data can not exceed 4K, many browsers are limited to one site to save up to 20 Cookie

 

Suggest:

                Login information and other important information is stored session

                Additional Information If you want to keep, you can put Cookie

Guess you like

Origin blog.csdn.net/qq_39394518/article/details/93394764