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

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

问题描述

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

 code> Cookie:a = 1; b = 2 

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

  Cookie:a = 1 
Cookie:b = 2
解决方案

或者它们总是在同一行上吗?在寻找有关该主题的细节的同时浏览此页面。来自 HTTP状态管理机制 RFC 6265 的报价应该事情更清晰:



5.4。 Cookie标头

 当用户代理生成HTTP请求时,用户代理必须
多个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?

解决方案

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. The Cookie Header

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

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

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

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