mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Return error_code from beast::http::basic_parser:
This changes the HTTP parser interface to return an error_code instead of a bool. This eliminates the need for the error() member function and simplifies calling code.
This commit is contained in:
@@ -447,13 +447,9 @@ PeerImp::on_read_http_response (error_code ec, std::size_t bytes_transferred)
|
||||
if (! ec)
|
||||
{
|
||||
read_buffer_.commit (bytes_transferred);
|
||||
bool success;
|
||||
std::size_t bytes_consumed;
|
||||
std::tie (success, bytes_consumed) = http_parser_->write (
|
||||
std::tie (ec, bytes_consumed) = http_parser_->write (
|
||||
read_buffer_.data());
|
||||
if (! success)
|
||||
ec = http_parser_->error();
|
||||
|
||||
if (! ec)
|
||||
{
|
||||
read_buffer_.consume (bytes_consumed);
|
||||
@@ -597,12 +593,9 @@ PeerImp::on_read_http_request (error_code ec, std::size_t bytes_transferred)
|
||||
if (! ec)
|
||||
{
|
||||
read_buffer_.commit (bytes_transferred);
|
||||
bool success;
|
||||
std::size_t bytes_consumed;
|
||||
std::tie (success, bytes_consumed) = http_parser_->write (
|
||||
std::tie (ec, bytes_consumed) = http_parser_->write (
|
||||
read_buffer_.data());
|
||||
if (! success)
|
||||
ec = http_parser_->error();
|
||||
|
||||
if (! ec)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user