gpt4 book ai didi

http - 我的 cookie 真的只有 HTTP 吗? Cookie 请求 header 中没有标志

转载 作者:可可西里 更新时间:2023-11-01 16:32:48 25 4
gpt4 key购买 nike

我做了一些配置(最终)让我的 cookie 仅在 HTTP 上设置。

“似乎”有效。

我用 postman 试过了我有以下内容:

当我点击登录页面时:

在 cookie 部分,我名为 JSESSIONID 的 cookie 似乎只是 HTTP(它有检查)

当我进入登录区域时,同样的结果...

标题没有给我更多的细节。

然后,

我用谷歌浏览器检查过。我打开开发人员工具栏。

我加载登录页面。

在我得到的响应头上的头上

Set-Cookie: JSESSIONID=434434..... HttpOnly

所以,没问题(我猜)。

然后我重新加载页面(或登录)。

然后是问题:

没有收到响应头。

Request Headers 带来了我的 cookie(与前一个 ID 相同),但没有 httponly、主机信息或我之前设置的任何其他 cookie 值。

在 cookies 选项卡上,我只获得请求 Cookies 而没有响应 cookies。

并且请求 cookie 不是 http-only

enter image description here

在我的资源选项卡中,Cookie 就在那里,仅作为 HTTP 并且具有我之前设置的值。

我现在的问题是……它真的是一个仅限 http 的 cookie 吗?或者我的配置设置不正确?

我应该始终获取响应 cookie 还是请求 cookie 应该始终仅限 http(以防我试图将其设置为仅限 http),或者这种行为是否正常(或至少被接受)?

当我尝试在这两种情况下使用 Javascript 打印我的 cookie 时,我得到一个 null 作为响应(是什么让我认为它是正确的)。

想法?

最佳答案

客户端不会将名称和值以外的 cookie 属性发送回服务器。

另见 RFC6265 section 4.2.2 (强调我的)。

4.2.2. Semantics

Each cookie-pair represents a cookie stored by the user agent. Thecookie-pair contains the cookie-name and cookie-value the user agentreceived in the Set-Cookie header.

Notice that the cookie attributes are not returned. In particular,the server cannot determine from the Cookie header alone when acookie will expire, for which hosts the cookie is valid, for whichpaths the cookie is valid, or whether the cookie was set with theSecure or HttpOnly attributes.

一切都按规定运行。

关于http - 我的 cookie 真的只有 HTTP 吗? Cookie 请求 header 中没有标志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35564448/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com