Hotmail搞乱了编码的URL参数 [英] Hotmail messing with encoded URL parameters

查看:158
本文介绍了Hotmail搞乱了编码的URL参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个系统可以发送常规的电子邮件链接,其中许多包含URL编码参数,如:

  href =http://www.mydomain.com/login.aspx?returnurl=http%3A%2F%2Fwww.mydomain.com%2Fview.aspx%3Fid%3D1234%26alert%3Dtrue

您可以看到returnurl参数被编码。然而,似乎我们的大量用户(似乎是Hotmail)正在接收电子邮件,这些参数被部分解码为,例如:

  HREF =http://www.mydomain.com/login.aspx?returnurl=http://www.mydomain.com/view.aspx?view.aspx%3Fid%3D1234%26alert %3Dtrue

为什么会这样解码?为什么只部分解码?因此,我不知道如何处理。我想到base-64编码,但是base64字符串包含需要解码的字符...我想到了双编码,但后来我不知道是否双重解码参数...任何人都可以帮助?谢谢。

解决方案

可能发生的一个原因是因为用于编码的url规则之前和之后是不同的 所以如果正在进行解码的机制是从URL和苹果查询解码规则的后面,直到找到第一个,那么这可能会导致你正在描述的问题...

不知道如何处理它,尽管我理解的系统,这种不正确的解码是在你的控制之外。我会尝试隐藏返回url查询某种方式...


We have a system that sends out regular emails with links in, many of which contain URL encoded parameters such as this:

href="http://www.mydomain.com/login.aspx?returnurl=http%3A%2F%2Fwww.mydomain.com%2Fview.aspx%3Fid%3D1234%26alert%3Dtrue"

You can see that the "returnurl" parameter is encoded. However, it seems that a large number of our users (seemingly hotmail) are receiving the emails with this paramater partly decoded such as:

href="http://www.mydomain.com/login.aspx?returnurl=http://www.mydomain.com/view.aspx?view.aspx%3Fid%3D1234%26alert%3Dtrue"

Why would it decode like this? Why only partly decode?? I therefore have no idea how to deal with it. I thought of base-64 encoding but that base64 strings contain characters that would need decoding too... I thought of double encoding but then I will not know whether to double-decode the parameter or not... Can anyone help? Thanks.

解决方案

One reason this could be happening is because url rules for encoding are different before and after ? so if mechanism that is doing decoding does it from the 'back' of url and apples query decoding rules until it finds first ? then this could cause problem you are describing...

Not sure how to deal with it though as I understand system that does this inappropriate decoding is outside of your control. I would try to hide the ? in return url query somehow...

这篇关于Hotmail搞乱了编码的URL参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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