- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有本地服务器在 /server/public
下运行端点和 /server/saml
,并且我正在使用 HttpClient (v4.4.1) 与之交互。对任何端点触发器的请求(如果客户端还没有 session ) header Set-Cookie: JSESSIONID=ABC123; Path=/server/
,以便客户端应该有一个 session 。
但是,如果我调试并查看我的 BasicCookieStore
的内容,保存的 cookie 的路径为 /server/public
和 /server/saml
,导致保存两个 cookie,并根据端点发送不同的 session cookie。
我正在使用标准 CookieSpec
,并使用标准严格查看相同的行为。
有什么想法发生了什么或我该如何解决?
最佳答案
问题似乎是由 this bug 引起的导致Path
标题不被尊重。相反,客户端将删除从 URL 中检索响应的最后一个正斜杠之后的所有内容,并将其用作 cookie 的路径。 Scott Blum 的相关评论:
Namely, mixed-cased cookie attributes were not being handled properly. For example, if the Set-Cookie header being parsed contained a "Path=/foo" attribute, the path would not be respected at all. This is because the attributeHandler lookup would fail (it's keyed to "path").
关于java - 如何让 Apache HttpClient 尊重 Set-Cookie header 中的路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32696035/
我是一名优秀的程序员,十分优秀!