HTTP - 多个尾部 header

标签 http http-headers chunked-encoding rfc2616

我正在尝试在我的服务器中实现 HTTP,但无法找到有关如何处理多个尾部 header 字段(使用分块编码)的任何信息。

标准 ( https://www.rfc-editor.org/rfc/rfc2616#section-14.40 ) 指出: “Trailer 通用字段值表示给定的头字段集出现在使用分块传输编码编码的消息的尾部。”

但是没有说明如何在此 Trailer header 中指定多个 header 。

例如,如果请求或响应有两个尾部 header ,Example1Example2,您将如何构造 Trailer header ?

像这样:Trailer: Example1 Example2Trailer: Example1,Example2 还是什么?

最佳答案

来自 RFC 2616:

14.40 Trailer

       Trailer  = "Trailer" ":" 1#field-name

2.1 Augmented BNF

#rule
   A construct "#" is defined, similar to "*", for defining lists of
   elements. The full form is "<n>#<m>element" indicating at least
   <n> and at most <m> elements, each separated by one or more commas
   (",") and OPTIONAL linear white space (LWS).

换句话说,你应该写:

预告片:示例 1、示例 2

请注意,RFC 2616 已被以下各项废弃:

关于HTTP - 多个尾部 header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26812057/

相关文章:

java - 返回 Spring MVC Post 请求的 JSON 响应

c++ - InternetReadFile 因分块响应而失败

python - 如何在 Python 中发布分块编码数据

ios - 在 iOS 中使用 JSON 发送 HTTP POST 请求

HTTP 302 重定向 - 是否需要消息正文?

security - 为(非)预检请求发送不同的 HTTP header ?

http - 为什么在请求 header (客户端到服务器)中发送 Cache-Control 属性?

asp.net-core - 在 ASP.Net Core 3.1 中禁用 HTTP 选项方法

PHP 文件服务脚本 : Unreliable Downloads?

php - 将文件作为附件发送到浏览器