mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Separate beast::http::body from beast::http::message (RIPD-660):
This changes the http::message object to no longer contain a body. It modifies the parser to store the body in a separate object, or to pass the body data to a functor. This allows the body to be stored in more flexible ways. For example, in HTTP responses the body can be generated procedurally instead of being required to exist entirely in memory at once.
This commit is contained in:
@@ -413,7 +413,9 @@ PeerImp::on_write_http_request (error_code ec, std::size_t bytes_transferred)
|
||||
{
|
||||
// done sending request, now read the response
|
||||
http_message_ = boost::in_place ();
|
||||
http_parser_ = boost::in_place (std::ref(*http_message_), false);
|
||||
http_body_.clear();
|
||||
http_parser_ = boost::in_place (std::ref(*http_message_),
|
||||
std::ref(http_body_), false);
|
||||
on_read_http_response (error_code(), 0);
|
||||
return;
|
||||
}
|
||||
@@ -559,7 +561,9 @@ PeerImp::on_read_http_detect (error_code ec, std::size_t bytes_transferred)
|
||||
else if (! is_peer_protocol)
|
||||
{
|
||||
http_message_ = boost::in_place ();
|
||||
http_parser_ = boost::in_place (std::ref(*http_message_), true);
|
||||
http_body_.clear();
|
||||
http_parser_ = boost::in_place (std::ref(*http_message_),
|
||||
std::ref(http_body_), true);
|
||||
on_read_http_request (error_code(), 0);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user