如何处理没有 Transfer-Encoding 和 Content-Length headers 的请求消息?
How to treat request messages without Transfer-Encoding nor Content-Length headers?
我正在实现一个 Web 服务器,我想知道如何处理带有消息 body 但没有 Transfer-Encoding
或 Content-Length
headers 的请求消息(假设请求方法当然不是 HEAD 也不是 CONNECT)。
根据RFC 7230, § 3.3.3. Message Body Length:
The length of a message body is determined by one of the following (in order of precedence):
[…]
- If this is a request message and none of the above are true, then the message body length is zero (no message body is present).
我是那种情况吗,因此我是否应该考虑消息 body 长度为零(即使它实际上不是零)?
规范定义它。如果没有 content-length 或分块编码,则 header 部分后面的内容是下一个请求(可能格式错误)。
我正在实现一个 Web 服务器,我想知道如何处理带有消息 body 但没有 Transfer-Encoding
或 Content-Length
headers 的请求消息(假设请求方法当然不是 HEAD 也不是 CONNECT)。
根据RFC 7230, § 3.3.3. Message Body Length:
The length of a message body is determined by one of the following (in order of precedence):
[…]
- If this is a request message and none of the above are true, then the message body length is zero (no message body is present).
我是那种情况吗,因此我是否应该考虑消息 body 长度为零(即使它实际上不是零)?
规范定义它。如果没有 content-length 或分块编码,则 header 部分后面的内容是下一个请求(可能格式错误)。