HTTP Content-Length:修订间差异

来自WHY42
(创建页面,内容为“The Content-Length header indicates the size of the message body, in bytes, sent to the recipient. <syntaxhighlight lang="http"> Content-Length: <length> </syntaxhighlight> When no Content-Length is received, the client keeps reading until the server closes the connection.<ref>https://stackoverflow.com/questions/15991173/is-the-content-length-header-required-for-a-http-1-0-response</ref> Category:Network Category:RFC Category:Protocol Category…”)
 
无编辑摘要
 
第4行: 第4行:
Content-Length: <length>
Content-Length: <length>
</syntaxhighlight>
</syntaxhighlight>
The Content-Length header is not mandatory in HTTP responses, but it is recommended for responses that have a body. The header specifies the length of the message body in octets (8-bit bytes) and allows the recipient to accurately determine the message size and prevent buffer overflows. However, for responses that use chunked transfer encoding, the Content-Length header is not necessary, as the chunked encoding itself indicates the message length.


When no Content-Length is received, the client keeps reading until the server closes the connection.<ref>https://stackoverflow.com/questions/15991173/is-the-content-length-header-required-for-a-http-1-0-response</ref>
When no Content-Length is received, the client keeps reading until the server closes the connection.<ref>https://stackoverflow.com/questions/15991173/is-the-content-length-header-required-for-a-http-1-0-response</ref>

2024年1月17日 (三) 11:28的最新版本

The Content-Length header indicates the size of the message body, in bytes, sent to the recipient.

Content-Length: <length>

The Content-Length header is not mandatory in HTTP responses, but it is recommended for responses that have a body. The header specifies the length of the message body in octets (8-bit bytes) and allows the recipient to accurately determine the message size and prevent buffer overflows. However, for responses that use chunked transfer encoding, the Content-Length header is not necessary, as the chunked encoding itself indicates the message length.

When no Content-Length is received, the client keeps reading until the server closes the connection.[1]