为什么Cookie路径区分大小写? [英] Why are cookie paths case sensitive?

查看:555
本文介绍了为什么Cookie路径区分大小写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设置一个HTTP cookie时,虽然域名不区分大小写我已经意识到,第一次在几个星期前的,路径是。

I've realised for the first time a couple of weeks ago that when setting an http cookie, while the domain name is not case sensitive, the path is.

所以一会儿存储的cookie

So a while a cookie stored for

http://SomeWebSite.com

可以使用阅读

http://somewebsite.com

存储的cookie

http://somewebsite.com/SomePath

无法的使用读

http://somewebsite.com/somepath

这将根本不会被发现。

由于这显然是在RFC规定(参见3.3.3点这里)我怀疑这是一个疏忽,但我没有受过训练来治疗的URL作为区分大小写的文本和Web服务器,据我所知,好像不介意无论哪种方式,并有助于页面就好了用户;所以我在想 - 这是什么决定背后的原因是什么?

As this is clearly stated in the RFC (see point 3.3.3 here) I doubt that's an oversight, but as a user I'm not trained to treat urls as case sensitive text and web servers, as far as I can tell, don't seem to mind either way, and would serve pages just fine; so I'm left wondering - what is the rationale behind this decision?

任何人都可以提供一些线索?

Anyone can shed some light?

推荐答案

大多数Web服务器提供傻瓜型的机制。两种最常见的,我知道要添加斜线目录名(年底 http://example.com/x => 的http:// example.com/x / )和纠正或忽略套管:( http://stackoverflow.com/ABOUT 提供相同的 http://stackoverflow.com/about )。然而,这是不会 Web服务器的要求,并在浏览器知道这一点。 http://stackoverflow.com/ABOUT 可提供一个完全不同的页面比 http://stackoverflow.com/about 。与?X = Y语法GET变量的使用是受欢迎的,值有时情况下服务器脚本敏感。这些可能的差异必须正确浏览器(没有缓存它们作为同一个文档使用不同的cookie域,不会破坏为Javascript,等)来处理。

Most Web servers provide idiot-proof mechanisms. Two common ones I know of are adding slashes to the end of directory names (http://example.com/x => http://example.com/x/) and correcting or ignoring casing: (http://stackoverflow.com/ABOUT serves the same as http://stackoverflow.com/about). However, this is not a requirement by the Web server, and the browser knows this. http://stackoverflow.com/ABOUT could be served a completely different page than http://stackoverflow.com/about. Use of GET variables with the ?x=y syntax is popular, and the values are sometimes case sensitive to server scripts. These possible differences must be handled properly by the browser (no caching them as the same document, using different cookie domains, not mangling for Javascript, etc.)

这篇关于为什么Cookie路径区分大小写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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