在HTTP规范中,分隔cookie的字符串是什么? [英] In HTTP specification, what is the string that separates cookies?
本文介绍了在HTTP规范中,分隔cookie的字符串是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
分号;
, Cookie:
字符串或其他字符串?
Semicolon ;
, the Cookie:
string or some other string?
推荐答案
检查HTTP请求中的cookie
Cookie:
header具有以下语法:
Inspecting cookies in an HTTP request
The Cookie:
header has the following syntax:
Cookie: <Name> = <Value> { ; <Name> = <Value> }
因此,用分号分隔各个cookie。
Hence individual cookies are separated with the semicolon.
另一方面,在响应中设置cookie时,每个 Set有一个cookie -Cookie:
header:
On the other hand, when setting a cookie in the response, there one cookie per the Set-Cookie:
header:
Set-Cookie: <Name> = <Value> [ ; expires = <Date>] [ ; path = <Path> ] [ ; domain = <Domain> ] // etc…
设置多个cookie Set-Cookie
标头在HTTP响应中重复。
To set multiple cookies the Set-Cookie
header is repeated in an HTTP response.
注意:
- 查看此处示例教程,以及 RFC 6265 HTTP状态管理机制 规范性参考,显示语法的全部细节。
- 现已过时的 RFC 2965 定义了另一对标题
Cookie2
和Set-Cookie2
,这些标题已被放弃。 - HTTP状态管理机制的已废弃版本( RFC 2109 和 RFC 2965 )提供了折叠多种方式将
Set-Cookie
(或Set-Cookie2
)标题合并为一个。但是,最新的 RFC 6265 规范不建议进行此折叠。
- Have a look here for a tutorial with examples, and to RFC 6265 HTTP State Management Mechanism for a normative reference showing the full details of the syntax.
- The now-obsolete RFC 2965 defined an alternate pair of headers
Cookie2
andSet-Cookie2
which were abandoned. - The obsoleted versions of the HTTP State Management Mechanism (RFC 2109 and RFC 2965) provided a way to fold multiple
Set-Cookie
(orSet-Cookie2
) headers into one. However, this folding is not recommended by the latest RFC 6265 spec.
这篇关于在HTTP规范中,分隔cookie的字符串是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文