为什么Safari让您设置超过4kB的Cookie? [英] Why does Safari let you set cookies over 4kB?

查看:245
本文介绍了为什么Safari让您设置超过4kB的Cookie?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设置了一个A / B测试,需要相当大量的数据临时存储在Cookie中。在测试我的代码,我设法得到超过4kB的cookie。 Safari设置cookie。在后续页面加载时,Apache返回一个错误,因为cookie太大了。

I set up an A/B test which required a fairly large amount of data to be stored in a cookie temporarily. While testing my code, I managed to get the cookie over 4kB. Safari set the cookie. On the subsequent page load, Apache returned an error since the cookie was too large.

我在Firefox上测试了这个,它只是忽略了cookie,似乎是对我来说是正确的行为。

I tested this on Firefox as well and it simply ignores the cookie, which seems to be the correct behavior to me.

我看到这种情况发生在第一手的GMail。我曾经得到错误的请求错误,必须删除我的cookie。这是一个已知的问题已经解决。

I've seen this happen before first-hand on GMail. I used to get Bad Request errors and would have to delete my cookies. It was a known issue that's been resolved.

我在网上找不到Safari允许超过4kB的Cookie。这不是潜在的危险吗?我们的用户可能被阻止访问我们的网站,不知道发生了什么是可怕的想法。我不知道如何从我们这边删除那些饼干,如果他们太大了。

I can find nothing online about Safari allowing cookies over 4kB. Isn't this potentially dangerous? The idea that our users could be blocked from accessing our site and have no idea what's going on is scary. I don't know off the top of my head how it'd be possible to delete those cookies from our side if they got too large.

为什么Safari做这个?做任何其他浏览器吗?

Why does Safari do this? Do any other browsers?

推荐答案

http://www.nczonline.net/blog/2008/05/17/browser-cookie-restrictions/ 说,firefox和safari允许最多4097个字符的Cookie,IE 4095和歌剧4096

http://www.nczonline.net/blog/2008/05/17/browser-cookie-restrictions/ says that firefox and safari allow cookies up to 4097 characters, IE 4095 and opera 4096

这里有一些东西在修复错误发生的问题,基本上错误文档清除违规的cookie,请求将工作(希望) http://www.webmasterworld.com/forum92/1163.htm

there is something here about fixing the issue when the error happens, basically the error document clears the offending cookie so subsequent request will work (hopefully) http://www.webmasterworld.com/forum92/1163.htm

这篇关于为什么Safari让您设置超过4kB的Cookie?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆