mirror of
https://github.com/boostorg/beast.git
synced 2025-07-31 21:34:46 +02:00
Refine Body::size specification
This commit is contained in:
@@ -3,6 +3,7 @@ Version 72:
|
||||
HTTP:
|
||||
|
||||
* Tidy up set payload in http-server-fast
|
||||
* Refine Body::size specification
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
@@ -48,14 +48,37 @@ In this table:
|
||||
the message body for serialization.
|
||||
]
|
||||
][
|
||||
[`X::size(X::value_type const& v)`]
|
||||
[`X::size(X::value_type v)`]
|
||||
[`std::uint64_t`]
|
||||
[
|
||||
If present, returns the serialized size of `v` not including
|
||||
any chunked transfer encoding. When this function is provided,
|
||||
This static member function is optional. It returns the payload
|
||||
size of `v` not including any chunked transfer encoding. The
|
||||
function shall not exit via an exception.
|
||||
|
||||
When this function is present:
|
||||
|
||||
* The function shall not fail
|
||||
|
||||
* A call to
|
||||
[link beast.ref.beast__http__message.payload_size `message::payload_size`]
|
||||
will return the same value as `size`.
|
||||
|
||||
* A call to
|
||||
[link beast.ref.beast__http__message.prepare_payload `message::prepare_payload`]
|
||||
will automatically set the content length field based on the
|
||||
value. Otherwise, the chunked transfer encoding will be set.
|
||||
will remove "chunked" from the Transfer-Encoding field if it appears
|
||||
as the last encoding, and will set the Content-Length field to the
|
||||
returned value.
|
||||
|
||||
Otherwise, when the function is omitted:
|
||||
|
||||
* A call to
|
||||
[link beast.ref.beast__http__message.payload_size `message::payload_size`]
|
||||
will return `boost::none`.
|
||||
|
||||
* A call to
|
||||
[link beast.ref.beast__http__message.prepare_payload `message::prepare_payload`]
|
||||
will erase the Content-Length field, and add "chunked" as the last
|
||||
encoding in the Transfer-Encoding field if it is not already present.
|
||||
]
|
||||
][
|
||||
[`is_body<X>`]
|
||||
|
@@ -134,6 +134,8 @@ struct BodyWriter
|
||||
{
|
||||
// The specification requires this to indicate "no error"
|
||||
ec = {};
|
||||
|
||||
return boost::asio::buffer_size(buffers);
|
||||
}
|
||||
|
||||
/** Called when the body is complete.
|
||||
|
Reference in New Issue
Block a user