简体   繁体   English

当cookie文件超过最大大小时会发生什么?

[英]what happens when cookies file exceeds maximum size?

当Cookie文件超过最大大小时会发生什么?

The typical behavior of most browsers, to my knowledge, is to simply truncate the oldest data that does not fit. 据我所知,大多数浏览器的典型行为是简单地截断不适合的最旧数据。

For example, create cookies 1 through 9. When creating cookie 10 and the data size is going to overflow, cookie 1 is simply discarded. 例如,创建cookie 1到9.当创建cookie 10并且数据大小将溢出时,cookie 1被简单地丢弃。

In general practice, if you are worried about bumping into the limit and loosing cookies to overflow, it is probably time to rethink your strategy of what you are storing and start caching the data server-side and limiting the cookie to a value to access the cached data. 在一般实践中,如果您担心碰到限制并且丢失cookie会溢出,那么可能是时候重新考虑您正在存储的策略并开始缓存数据服务器端并将cookie限制为访问缓存数据。

该文件被截断为最大长度。

我认为这将取决于浏览器,因为RFC2965没有定义cookie的最大大小或超过最大值时的任何标准行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM