mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 12:57:31 +02:00
Update stream write documentation for end of stream changes
This commit is contained in:
@ -2,6 +2,7 @@ Version 126:
|
||||
|
||||
* Add CppCon2017 presentation link
|
||||
* Update README.md
|
||||
* Update stream write documentation for end of stream changes
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
@ -94,14 +94,7 @@ overflow attacks. The following code will print the error message:
|
||||
[heading Writing]
|
||||
|
||||
A set of free functions allow serialization of an entire HTTP message to
|
||||
a stream. If a response has no declared content length and no chunked
|
||||
transfer encoding, then the end of the message is indicated by the server
|
||||
closing the connection. When sending such a response, Beast will return the
|
||||
[link beast.ref.boost__beast__http__error `error::end_of_stream`]
|
||||
from the write algorithm to indicate
|
||||
to the caller that the connection should be closed. This example
|
||||
constructs and sends a response whose body length is determined by
|
||||
the number of octets received prior to the server closing the connection:
|
||||
a stream. This example constructs and sends an HTTP response:
|
||||
|
||||
[http_snippet_7]
|
||||
|
||||
|
@ -116,11 +116,10 @@ void fxx() {
|
||||
res.result(status::ok);
|
||||
res.set(field::server, "Beast");
|
||||
res.body() = "Hello, world!";
|
||||
res.prepare_payload();
|
||||
|
||||
error_code ec;
|
||||
write(sock, res, ec);
|
||||
if(ec == error::end_of_stream)
|
||||
sock.close();
|
||||
//]
|
||||
|
||||
//[http_snippet_8
|
||||
|
Reference in New Issue
Block a user