HTTP 请求中是否允许使用多个 Cookie 标头? [英] Are multiple Cookie headers allowed in an HTTP request?

查看:31
本文介绍了HTTP 请求中是否允许使用多个 Cookie 标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,浏览器将 cookie 分组到单个 Cookie 标头中,例如:

Usually, a browser groups cookies into a single Cookie header, such as:

Cookie: a=1; b=2

标准是否允许将这些作为单独的标头发送,例如:

Does the standard allow to send these as separate headers, such as:

Cookie: a=1
Cookie: b=2

或者他们总是必须在同一条线上?

Or do they always have to be on the same line?

推荐答案

在查找有关该主题的详细信息时偶然看到此页面.引用自 HTTP 状态管理机制RFC 6265 应该让事情更清楚:

Chanced upon this page while looking for details on the topic. A quote from HTTP State Management Mechanism, RFC 6265 ought to make things clearer:

5.4.Cookie 标头

当用户代理产生一个 HTTP 请求时,用户代理必须请勿附加多个 Cookie 标头字段.

When the user agent generates an HTTP request, the user agent MUST NOT attach more than one Cookie header field.

看似使用多个Cookie headers,其实是禁止的!

It looks like the use of multiple Cookie headers is, in fact, prohibited!

这篇关于HTTP 请求中是否允许使用多个 Cookie 标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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