mirror of
https://github.com/boostorg/beast.git
synced 2025-07-29 20:37:31 +02:00
Use message::need_eof in example servers
This commit is contained in:
@ -5,6 +5,7 @@ Version 128:
|
||||
HTTP:
|
||||
|
||||
* Add message::need_eof
|
||||
* Use message::need_eof in example servers
|
||||
|
||||
API Changes:
|
||||
|
||||
|
@ -650,7 +650,8 @@ class http_session
|
||||
std::bind(
|
||||
&http_session::on_write,
|
||||
self_.derived().shared_from_this(),
|
||||
std::placeholders::_1)));
|
||||
std::placeholders::_1,
|
||||
msg_.need_eof())));
|
||||
}
|
||||
};
|
||||
|
||||
@ -760,22 +761,22 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
on_write(boost::system::error_code ec)
|
||||
on_write(boost::system::error_code ec, bool close)
|
||||
{
|
||||
// Happens when the timer closes the socket
|
||||
if(ec == boost::asio::error::operation_aborted)
|
||||
return;
|
||||
|
||||
if(ec == http::error::end_of_stream)
|
||||
if(ec)
|
||||
return fail(ec, "write");
|
||||
|
||||
if(close)
|
||||
{
|
||||
// This means we should close the connection, usually because
|
||||
// the response indicated the "Connection: close" semantic.
|
||||
return derived().do_eof();
|
||||
}
|
||||
|
||||
if(ec)
|
||||
return fail(ec, "write");
|
||||
|
||||
// Inform the queue that a write completed
|
||||
if(queue_.on_write())
|
||||
{
|
||||
|
@ -447,7 +447,8 @@ class http_session : public std::enable_shared_from_this<http_session>
|
||||
std::bind(
|
||||
&http_session::on_write,
|
||||
self_.shared_from_this(),
|
||||
std::placeholders::_1)));
|
||||
std::placeholders::_1,
|
||||
msg_.need_eof())));
|
||||
}
|
||||
};
|
||||
|
||||
@ -570,22 +571,22 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
on_write(boost::system::error_code ec)
|
||||
on_write(boost::system::error_code ec, bool close)
|
||||
{
|
||||
// Happens when the timer closes the socket
|
||||
if(ec == boost::asio::error::operation_aborted)
|
||||
return;
|
||||
|
||||
if(ec == http::error::end_of_stream)
|
||||
if(ec)
|
||||
return fail(ec, "write");
|
||||
|
||||
if(close)
|
||||
{
|
||||
// This means we should close the connection, usually because
|
||||
// the response indicated the "Connection: close" semantic.
|
||||
return do_close();
|
||||
}
|
||||
|
||||
if(ec)
|
||||
return fail(ec, "write");
|
||||
|
||||
// Inform the queue that a write completed
|
||||
if(queue_.on_write())
|
||||
{
|
||||
|
@ -252,7 +252,7 @@ class session : public std::enable_shared_from_this<session>
|
||||
self_.shared_from_this(),
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
! sp->keep_alive())));
|
||||
sp->need_eof())));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -248,7 +248,7 @@ class session : public std::enable_shared_from_this<session>
|
||||
self_.shared_from_this(),
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
! sp->keep_alive())));
|
||||
sp->need_eof())));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -238,7 +238,7 @@ struct send_lambda
|
||||
operator()(http::message<isRequest, Body, Fields>&& msg) const
|
||||
{
|
||||
// Determine if we should close the connection after
|
||||
close_ = ! msg.keep_alive();
|
||||
close_ = msg.need_eof();
|
||||
|
||||
// We need the serializer here because the serializer requires
|
||||
// a non-const file_body, and the message oriented version of
|
||||
|
@ -234,7 +234,7 @@ struct send_lambda
|
||||
operator()(http::message<isRequest, Body, Fields>&& msg) const
|
||||
{
|
||||
// Determine if we should close the connection after
|
||||
close_ = ! msg.keep_alive();
|
||||
close_ = msg.need_eof();
|
||||
|
||||
// We need the serializer here because the serializer requires
|
||||
// a non-const file_body, and the message oriented version of
|
||||
|
@ -263,7 +263,7 @@ class session
|
||||
self_.derived().shared_from_this(),
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
! sp->keep_alive())));
|
||||
sp->need_eof())));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -255,7 +255,7 @@ class session
|
||||
self_.shared_from_this(),
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
! sp->keep_alive())));
|
||||
sp->need_eof())));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -252,7 +252,7 @@ class session
|
||||
self_.shared_from_this(),
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
! sp->keep_alive())));
|
||||
sp->need_eof())));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -232,7 +232,7 @@ struct send_lambda
|
||||
operator()(http::message<isRequest, Body, Fields>&& msg) const
|
||||
{
|
||||
// Determine if we should close the connection after
|
||||
close_ = ! msg.keep_alive();
|
||||
close_ = msg.need_eof();
|
||||
|
||||
// We need the serializer here because the serializer requires
|
||||
// a non-const file_body, and the message oriented version of
|
||||
|
@ -230,7 +230,7 @@ struct send_lambda
|
||||
operator()(http::message<isRequest, Body, Fields>&& msg) const
|
||||
{
|
||||
// Determine if we should close the connection after
|
||||
close_ = ! msg.keep_alive();
|
||||
close_ = msg.need_eof();
|
||||
|
||||
// We need the serializer here because the serializer requires
|
||||
// a non-const file_body, and the message oriented version of
|
||||
|
Reference in New Issue
Block a user