有些浏览器会对Cookie进行编码吗? [英] Do some browsers encode cookies?

查看:398
本文介绍了有些浏览器会对Cookie进行编码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是对为什么是我的Cookie的后续跟进包含JSON偶尔畸形,我们已经解决了。



我有一个3值的cookie,我们的url编码的主要值。其他两个值是时间戳和散列。在我们的回复标题中看起来像这样:


foo = d = 634027688530013385& v =%7b%22HasDog%22%3afalse%2c% 22Greeting%22%3anull%2c%22RecentRecipes%22%3a%5b%5d%2c%22Remember%22%3afalse%7d& h = ARv5QGf4Cnftc4tFaPoy / VH8Pbo =; path = /; HttpOnly


在我们的日志中,我们看到不能正确解析三个值的情况,因为整个cookie现在已经编码: / p>


Cookie看起来复杂:d%3D634027653097874122%26v%3D%7B%22HasAcceptedTerms%22%3Afalse%2C%22RecipeBoxCount%22%3A0%2C %22Remember%22%3Afalse%7D%26h%3DR85mJ%2FTdA6yrVe5pVCVpfG2jumM%3D


不幸的是,我们没有捕获用户代理看看这是否与特定的浏览器相关。



我有几个选项可以解决这个问题。

解决方案

这可能不是一个答案,但....



这很有趣,值得一看。



我想看到一个面向公众的测试页面,该页面以粗体显示cookie的红色或绿色,然后通过 http://browsercam.com



我这样做时,我以为我发现 mozilla的本地json 中的一个bug支持。结果是 我是对的



在您填写表单前进行免费试用(200张),将分辨率设置为640/480,然后选择所有浏览器/平台,182



或花费时间,并获得 http://testswarm.com/



请继续关注。 p>

This is sort of a follow-up to Why are my cookies containing JSON occasionally malformed, which we have resolved.

I have a 3-value cookie, and we're url encoding the main value. The other two values are a timestamp and a hash. It looks like this in our response header:

foo=d=634027688530013385&v=%7b%22HasDog%22%3afalse%2c%22Greeting%22%3anull%2c%22RecentRecipes%22%3a%5b%5d%2c%22Remember%22%3afalse%7d&h=ARv5QGf4Cnftc4tFaPoy/VH8Pbo=; path=/; HttpOnly

In our logs, we see cases where we can't parse the three values correctly because the entire cookie is now encoded:

Cookie looks mangled: d%3D634027653097874122%26v%3D%7B%22HasAcceptedTerms%22%3Afalse%2C%22RecipeBoxCount%22%3A0%2C%22Remember%22%3Afalse%7D%26h%3DR85mJ%2FTdA6yrVe5pVCVpfG2jumM%3D

Unfortunately, we're not capturing the user agent to see if this is related to a specific browser.

I have several options to fix this. I just think the behavior is odd enough to warrant a question.

解决方案

This may not be an answer but....

This is interesting and warrants a deeper look.

I would like to see a public facing test page that shows red or green with the cookie in bold text and then run it through http://browsercam.com.

I did this when I thought I had found a bug in mozilla's native json support. turns out I was right.

Get your testpage working for sure for sure before you fill out the form for a free trial (200 shots), set the resolution to 640/480 and select all browsers/platform, 182 distinct combinations, set a delay to allow the redirection to set the cookie and track down the culprit.

Or take the time and get on http://testswarm.com/.

Please do follow up on this.

这篇关于有些浏览器会对Cookie进行编码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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