mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 21:07:26 +02:00
Fix buffer lifetime in websocket write
This commit is contained in:
@ -3,6 +3,11 @@ Version 83:
|
|||||||
* Add flat_static_buffer::mutable_data
|
* Add flat_static_buffer::mutable_data
|
||||||
* Add buffer_front
|
* Add buffer_front
|
||||||
|
|
||||||
|
WebSocket
|
||||||
|
|
||||||
|
* Add wstest compression option
|
||||||
|
* Fix buffer lifetime in websocket write
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
Version 82:
|
Version 82:
|
||||||
|
@ -401,20 +401,21 @@ loop:
|
|||||||
}
|
}
|
||||||
d.fh.fin = ! more;
|
d.fh.fin = ! more;
|
||||||
d.fh.len = n;
|
d.fh.len = n;
|
||||||
detail::fh_streambuf fh_buf;
|
detail::write<
|
||||||
detail::write<flat_static_buffer_base>(fh_buf, d.fh);
|
flat_static_buffer_base>(d.fh_buf, d.fh);
|
||||||
d.ws.wr_.cont = ! d.fin;
|
d.ws.wr_.cont = ! d.fin;
|
||||||
// Send frame
|
// Send frame
|
||||||
d.step = more ?
|
d.step = more ?
|
||||||
do_deflate + 1 : do_deflate + 2;
|
do_deflate + 1 : do_deflate + 2;
|
||||||
boost::asio::async_write(d.ws.stream_,
|
boost::asio::async_write(d.ws.stream_,
|
||||||
buffer_cat(fh_buf.data(), b),
|
buffer_cat(d.fh_buf.data(), b),
|
||||||
std::move(*this));
|
std::move(*this));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
case do_deflate + 1:
|
case do_deflate + 1:
|
||||||
BOOST_ASSERT(d.ws.wr_block_ == &d);
|
BOOST_ASSERT(d.ws.wr_block_ == &d);
|
||||||
|
d.fh_buf.consume(d.fh_buf.size());
|
||||||
d.ws.wr_block_ = nullptr;
|
d.ws.wr_block_ = nullptr;
|
||||||
d.fh.op = detail::opcode::cont;
|
d.fh.op = detail::opcode::cont;
|
||||||
d.fh.rsv1 = false;
|
d.fh.rsv1 = false;
|
||||||
|
Reference in New Issue
Block a user