Источник / закреплённая редакция
Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing
Источник пакета ietf.http_framing · RFC 7230
- work
- urn:ietf:clir:http-framing#RFC7230
- номер
- RFC 7230
- вид
- urn:ietf:clir:http-framing#standards_track
RFC 7230 (R. Fielding, J. Reschke, eds.)
- edition
- urn:ietf:clir:http-framing#RFC7230_EN
- язык
- en
- официальность
- official
- материализация
- PINNED_OFFICIAL_BYTES
- жизненный цикл
- adopted: 2014-06-01; in_force: [object Object]
Публикации
| URI | Тип | documentHash | Получено |
|---|---|---|---|
| https://www.rfc-editor.org/rfc/rfc7230.txt | text/plain; charset=utf-8 | sha256:c7fdc8bebdf1f8195f731592c47f5ea822b489436fd905b01b55ef531fca4120 | 2026-08-30T11:00:00Z |
Фрагменты — 2
section/1_1 · section · на него ссылаются: 1
en · official · sha256:48d3c2df23d66fff10dd5ac623a3a440749f20110a49e6ece036aa807c823cfcEN
1.1. Requirements Notation
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [RFC2119].
Conformance criteria and considerations regarding error handling are
defined in Section 2.5.Ссылаются нормы: assert-h753de982046c33473b201f1d4849613bdfb8630a437c3b080b7cd0a5f8af6ef9
section/3_3_3 · section · на него ссылаются: 8
en · official · sha256:46c66855bda647d16ada634829e2a4c958bb496498b12e90da87a555c8ee6d80EN
3.3.3. Message Body Length
The length of a message body is determined by one of the following
(in order of precedence):
1. Any response to a HEAD request and any response with a 1xx
(Informational), 204 (No Content), or 304 (Not Modified) status
code is always terminated by the first empty line after the
header fields, regardless of the header fields present in the
message, and thus cannot contain a message body.
2. Any 2xx (Successful) response to a CONNECT request implies that
the connection will become a tunnel immediately after the empty
line that concludes the header fields. A client MUST ignore any
Content-Length or Transfer-Encoding header fields received in
such a message.
3. If a Transfer-Encoding header field is present and the chunked
transfer coding (Section 4.1) is the final encoding, the message
body length is determined by reading and decoding the chunked
data until the transfer coding indicates the data is complete.
If a Transfer-Encoding header field is present in a response and
the chunked transfer coding is not the final encoding, the
message body length is determined by reading the connection until
it is closed by the server. If a Transfer-Encoding header field
is present in a request and the chunked transfer coding is not
the final encoding, the message body length cannot be determined
reliably; the server MUST respond with the 400 (Bad Request)
status code and then close the connection.
If a message is received with both a Transfer-Encoding and a
Content-Length header field, the Transfer-Encoding overrides the
Content-Length. Such a message might indicate an attempt to
perform request smuggling (Section 9.5) or response splitting
(Section 9.4) and ought to be handled as an error. A sender MUST
remove the received Content-Length field prior to forwarding such
a message downstream.
4. If a message is received without Transfer-Encoding and with
either multiple Content-Length header fields having differing
field-values or a single Content-Length header field having an
invalid value, then the message framing is invalid and the
recipient MUST treat it as an unrecoverable error. If this is a
request message, the server MUST respond with a 400 (Bad Request)
status code and then close the connection. If this is a response
message received by a proxy, the proxy MUST close the connection
to the server, discard the received response, and send a 502 (Bad
Fielding & Reschke Standards Track [Page 32]
RFC 7230 HTTP/1.1 Message Syntax and Routing June 2014
Gateway) response to the client. If this is a response message
received by a user agent, the user agent MUST close the
connection to the server and discard the received response.
5. If a valid Content-Length header field is present without
Transfer-Encoding, its decimal value defines the expected message
body length in octets. If the sender closes the connection or
the recipient times out before the indicated number of octets are
received, the recipient MUST consider the message to be
incomplete and close the connection.
6. 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).
7. Otherwise, this is a response message without a declared message
body length, so the message body length is determined by the
number of octets received prior to the server closing the
connection.
Since there is no way to distinguish a successfully completed,
close-delimited message from a partially received message interrupted
by network failure, a server SHOULD generate encoding or
length-delimited messages whenever possible. The close-delimiting
feature exists primarily for backwards compatibility with HTTP/1.0.
A server MAY reject a request that contains a message body but not a
Content-Length by responding with 411 (Length Required).
Unless a transfer coding other than chunked has been applied, a
client that sends a request containing a message body SHOULD use a
valid Content-Length header field if the message body length is known
in advance, rather than the chunked transfer coding, since some
existing services respond to chunked with a 411 (Length Required)
status code even though they understand the chunked transfer coding.
This is typically because such services are implemented via a gateway
that requires a content-length in advance of being called and the
server is unable or unwilling to buffer the entire request before
processing.
A user agent that sends a request containing a message body MUST send
a valid Content-Length header field if it does not know the server
will handle HTTP/1.1 (or later) requests; such knowledge can be in
the form of specific user configuration or by remembering the version
of a prior received response.
If the final response to the last request on a connection has been
completely received and there remains additional data to read, a user
agent MAY discard the remaining data or attempt to determine if that
Fielding & Reschke Standards Track [Page 33]
RFC 7230 HTTP/1.1 Message Syntax and Routing June 2014
data belongs as part of the prior response body, which might be the
case if the prior message's Content-Length value is incorrect. A
client MUST NOT process, cache, or forward such extra data as a
separate response, since such behavior would be vulnerable to cache
poisoning.Ссылаются нормы: ForwardingWithContentLengthDeviates7230, ForwardingWithoutContentLengthConforms7230, ProcessingConflictingContentLengthDeviates7230, RejectingConflictingContentLengthConforms7230, assert-h148b4de3e11c112511c99e8970c73e4804a06adc498bed7c3b26c40dff24953c, assert-h2e4fac9ce6258f448eb71e57c678e13ee39eab5f94238e2aa6eace8a0b538bd0, assert-h8696a46dcd8095e5a852c49091db14f002f906a10fd148bf3b6df6be035c96eb, assert-ha283032595d3228777141fbdfbca1e4faa475d4f8c09db84f57189232fb2896e
Хэш рядом с текстом — sha256 его точных байтов. Он и есть проверка того, что показанный текст совпадает с закреплённым в пакете: расхождение роняет статику оракула.