Fixes #14. Now does not copy pointers in the stream to be sent to client.
This commit is contained in:
parent
fa1efed7f0
commit
3b85cd0c54
1 changed files with 1 additions and 5 deletions
|
|
@ -29,12 +29,8 @@ namespace SimpleWeb {
|
||||||
boost::asio::yield_context& yield): strand(strand), yield(yield), socket(socket), stream(&streambuf) {}
|
boost::asio::yield_context& yield): strand(strand), yield(yield), socket(socket), stream(&streambuf) {}
|
||||||
|
|
||||||
void flush() {
|
void flush() {
|
||||||
boost::asio::streambuf write_buffer;
|
|
||||||
std::ostream response(&write_buffer);
|
|
||||||
response << stream.rdbuf();
|
|
||||||
|
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
boost::asio::async_write(*socket, write_buffer, yield[ec]);
|
boost::asio::async_write(*socket, streambuf, yield[ec]);
|
||||||
|
|
||||||
if(ec)
|
if(ec)
|
||||||
throw std::runtime_error(ec.message());
|
throw std::runtime_error(ec.message());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue