mirror of
https://github.com/boostorg/beast.git
synced 2025-08-05 15:54:46 +02:00
error_codes use source_location.
This commit is contained in:
committed by
Klemens Morgenstern
parent
9473c10dde
commit
f4d1936bb2
@@ -157,7 +157,7 @@ public:
|
|||||||
net::mutable_buffer{},
|
net::mutable_buffer{},
|
||||||
std::move(*this));
|
std::move(*this));
|
||||||
}
|
}
|
||||||
ec = ec_;
|
BOOST_BEAST_ASSIGN_EC(ec, ec_);
|
||||||
bytes_transferred = n_;
|
bytes_transferred = n_;
|
||||||
}
|
}
|
||||||
this->complete_now(ec, bytes_transferred);
|
this->complete_now(ec, bytes_transferred);
|
||||||
|
@@ -83,7 +83,9 @@ class basic_stream<Executor>::read_op : public detail::stream_read_op_base
|
|||||||
std::size_t bytes_transferred = 0;
|
std::size_t bytes_transferred = 0;
|
||||||
auto sp = wp_.lock();
|
auto sp = wp_.lock();
|
||||||
if(! sp)
|
if(! sp)
|
||||||
ec = net::error::operation_aborted;
|
{
|
||||||
|
BOOST_BEAST_ASSIGN_EC(ec, net::error::operation_aborted);
|
||||||
|
}
|
||||||
if(! ec)
|
if(! ec)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(sp->m);
|
std::lock_guard<std::mutex> lock(sp->m);
|
||||||
@@ -98,7 +100,7 @@ class basic_stream<Executor>::read_op : public detail::stream_read_op_base
|
|||||||
}
|
}
|
||||||
else if (buffer_bytes(b_) > 0)
|
else if (buffer_bytes(b_) > 0)
|
||||||
{
|
{
|
||||||
ec = net::error::eof;
|
BOOST_BEAST_ASSIGN_EC(ec, net::error::eof);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +313,7 @@ read_some(MutableBufferSequence const& buffers,
|
|||||||
|
|
||||||
// deliver error
|
// deliver error
|
||||||
BOOST_ASSERT(in_->code != detail::stream_status::ok);
|
BOOST_ASSERT(in_->code != detail::stream_status::ok);
|
||||||
ec = net::error::eof;
|
BOOST_BEAST_ASSIGN_EC(ec, net::error::eof);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,7 +384,7 @@ write_some(
|
|||||||
auto out = out_.lock();
|
auto out = out_.lock();
|
||||||
if(! out)
|
if(! out)
|
||||||
{
|
{
|
||||||
ec = net::error::connection_reset;
|
BOOST_BEAST_ASSIGN_EC(ec, net::error::connection_reset);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,7 +443,9 @@ async_teardown(
|
|||||||
s.close();
|
s.close();
|
||||||
if( s.in_->fc &&
|
if( s.in_->fc &&
|
||||||
s.in_->fc->fail(ec))
|
s.in_->fc->fail(ec))
|
||||||
ec = net::error::eof;
|
{
|
||||||
|
BOOST_BEAST_ASSIGN_EC(ec, net::error::eof);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
ec = {};
|
ec = {};
|
||||||
|
|
||||||
|
@@ -34,7 +34,7 @@ dynamic_buffer_prepare_noexcept(
|
|||||||
if(buffer.max_size() - buffer.size() < size)
|
if(buffer.max_size() - buffer.size() < size)
|
||||||
{
|
{
|
||||||
// length error
|
// length error
|
||||||
ec = ev;
|
BOOST_BEAST_ASSIGN_EC(ec, ev);
|
||||||
return boost::none;
|
return boost::none;
|
||||||
}
|
}
|
||||||
boost::optional<typename
|
boost::optional<typename
|
||||||
@@ -67,7 +67,7 @@ dynamic_buffer_prepare(
|
|||||||
}
|
}
|
||||||
catch(std::length_error const&)
|
catch(std::length_error const&)
|
||||||
{
|
{
|
||||||
ec = ev;
|
BOOST_BEAST_ASSIGN_EC(ec, ev);
|
||||||
}
|
}
|
||||||
return boost::none;
|
return boost::none;
|
||||||
|
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
#include <boost/core/ignore_unused.hpp>
|
#include <boost/core/ignore_unused.hpp>
|
||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
|
#include <boost/preprocessor/cat.hpp>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace asio
|
namespace asio
|
||||||
@@ -101,4 +102,15 @@ namespace net = boost::asio;
|
|||||||
#define BOOST_BEAST_ASYNC_TPARAM2 BOOST_ASIO_COMPLETION_TOKEN_FOR(void(::boost::beast::error_code, ::std::size_t))
|
#define BOOST_BEAST_ASYNC_TPARAM2 BOOST_ASIO_COMPLETION_TOKEN_FOR(void(::boost::beast::error_code, ::std::size_t))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef BOOST_BEAST_NO_SOURCE_LOCATION
|
||||||
|
#define BOOST_BEAST_ASSIGN_EC(ec, error) ec.assign(error)
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define BOOST_BEAST_ASSIGN_EC(ec, error) \
|
||||||
|
static constexpr auto BOOST_PP_CAT(loc_, __LINE__) ((BOOST_CURRENT_LOCATION)); \
|
||||||
|
ec.assign(error, & BOOST_PP_CAT(loc_, __LINE__) )
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -96,7 +96,7 @@ public:
|
|||||||
BOOST_ASIO_CORO_YIELD
|
BOOST_ASIO_CORO_YIELD
|
||||||
s_.async_read_some(
|
s_.async_read_some(
|
||||||
b_.prepare(0), std::move(*this));
|
b_.prepare(0), std::move(*this));
|
||||||
ec = ec_;
|
BOOST_BEAST_ASSIGN_EC(ec, ec_);
|
||||||
}
|
}
|
||||||
this->complete_now(ec, total_);
|
this->complete_now(ec, total_);
|
||||||
}
|
}
|
||||||
|
@@ -647,7 +647,7 @@ operator()(error_code ec, std::size_t bytes_transferred, bool cont)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Restore the saved error code
|
// Restore the saved error code
|
||||||
ec = ec_;
|
BOOST_BEAST_ASSIGN_EC(ec, ec_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invoke the final handler.
|
// Invoke the final handler.
|
||||||
|
@@ -326,7 +326,7 @@ public:
|
|||||||
if(state().timer.expiry() <= clock_type::now())
|
if(state().timer.expiry() <= clock_type::now())
|
||||||
{
|
{
|
||||||
impl_->close();
|
impl_->close();
|
||||||
ec = beast::error::timeout;
|
BOOST_BEAST_ASSIGN_EC(ec, beast::error::timeout);
|
||||||
}
|
}
|
||||||
goto upcall;
|
goto upcall;
|
||||||
}
|
}
|
||||||
@@ -371,7 +371,7 @@ public:
|
|||||||
if(state().timeout)
|
if(state().timeout)
|
||||||
{
|
{
|
||||||
// yes, socket already closed
|
// yes, socket already closed
|
||||||
ec = beast::error::timeout;
|
BOOST_BEAST_ASSIGN_EC(ec, beast::error::timeout);
|
||||||
state().timeout = false;
|
state().timeout = false;
|
||||||
}
|
}
|
||||||
goto upcall;
|
goto upcall;
|
||||||
@@ -407,7 +407,7 @@ public:
|
|||||||
if(state().timeout)
|
if(state().timeout)
|
||||||
{
|
{
|
||||||
// yes, socket already closed
|
// yes, socket already closed
|
||||||
ec = beast::error::timeout;
|
BOOST_BEAST_ASSIGN_EC(ec, beast::error::timeout);
|
||||||
state().timeout = false;
|
state().timeout = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -566,7 +566,7 @@ public:
|
|||||||
if(state().timeout)
|
if(state().timeout)
|
||||||
{
|
{
|
||||||
// yes, socket already closed
|
// yes, socket already closed
|
||||||
ec = beast::error::timeout;
|
BOOST_BEAST_ASSIGN_EC(ec, beast::error::timeout);
|
||||||
state().timeout = false;
|
state().timeout = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -92,7 +92,7 @@ struct basic_dynamic_body
|
|||||||
auto const n = buffer_bytes(buffers);
|
auto const n = buffer_bytes(buffers);
|
||||||
if(beast::detail::sum_exceeds(body_.size(), n, body_.max_size()))
|
if(beast::detail::sum_exceeds(body_.size(), n, body_.max_size()))
|
||||||
{
|
{
|
||||||
ec = error::buffer_overflow;
|
BOOST_BEAST_ASSIGN_EC(ec, error::buffer_overflow);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
auto const mb =
|
auto const mb =
|
||||||
|
@@ -367,7 +367,7 @@ get(error_code& ec) ->
|
|||||||
|
|
||||||
if (nread == 0)
|
if (nread == 0)
|
||||||
{
|
{
|
||||||
ec = error::short_read;
|
BOOST_BEAST_ASSIGN_EC(ec, error::short_read);
|
||||||
return boost::none;
|
return boost::none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -124,7 +124,7 @@ struct buffer_body
|
|||||||
{
|
{
|
||||||
if(! body_.data)
|
if(! body_.data)
|
||||||
{
|
{
|
||||||
ec = error::need_buffer;
|
BOOST_BEAST_ASSIGN_EC(ec, error::need_buffer);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
auto const bytes_transferred =
|
auto const bytes_transferred =
|
||||||
@@ -136,7 +136,9 @@ struct buffer_body
|
|||||||
if(bytes_transferred == buffer_bytes(buffers))
|
if(bytes_transferred == buffer_bytes(buffers))
|
||||||
ec = {};
|
ec = {};
|
||||||
else
|
else
|
||||||
ec = error::need_buffer;
|
{
|
||||||
|
BOOST_BEAST_ASSIGN_EC(ec, error::need_buffer);
|
||||||
|
}
|
||||||
return bytes_transferred;
|
return bytes_transferred;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,7 +188,7 @@ struct buffer_body
|
|||||||
if(body_.more)
|
if(body_.more)
|
||||||
{
|
{
|
||||||
toggle_ = false;
|
toggle_ = false;
|
||||||
ec = error::need_buffer;
|
BOOST_BEAST_ASSIGN_EC(ec, error::need_buffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -202,7 +204,9 @@ struct buffer_body
|
|||||||
body_.data, body_.size}, body_.more}};
|
body_.data, body_.size}, body_.more}};
|
||||||
}
|
}
|
||||||
if(body_.more)
|
if(body_.more)
|
||||||
ec = error::need_buffer;
|
{
|
||||||
|
BOOST_BEAST_ASSIGN_EC(ec, error::need_buffer);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
ec = {};
|
ec = {};
|
||||||
return boost::none;
|
return boost::none;
|
||||||
|
@@ -78,7 +78,7 @@ struct empty_body
|
|||||||
put(ConstBufferSequence const&,
|
put(ConstBufferSequence const&,
|
||||||
error_code& ec)
|
error_code& ec)
|
||||||
{
|
{
|
||||||
ec = error::unexpected_body;
|
BOOST_BEAST_ASSIGN_EC(ec, error::unexpected_body);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -399,7 +399,7 @@ loop:
|
|||||||
++it;
|
++it;
|
||||||
if(it == last)
|
if(it == last)
|
||||||
{
|
{
|
||||||
ec = error::bad_chunk_extension;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_chunk_extension);
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
if(*it != ' ' && *it != '\t')
|
if(*it != ' ' && *it != '\t')
|
||||||
@@ -409,7 +409,7 @@ loop:
|
|||||||
// ';'
|
// ';'
|
||||||
if(*it != ';')
|
if(*it != ';')
|
||||||
{
|
{
|
||||||
ec = error::bad_chunk_extension;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_chunk_extension);
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
semi:
|
semi:
|
||||||
@@ -419,7 +419,7 @@ semi:
|
|||||||
{
|
{
|
||||||
if(it == last)
|
if(it == last)
|
||||||
{
|
{
|
||||||
ec = error::bad_chunk_extension;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_chunk_extension);
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
if(*it != ' ' && *it != '\t')
|
if(*it != ' ' && *it != '\t')
|
||||||
@@ -430,7 +430,7 @@ semi:
|
|||||||
{
|
{
|
||||||
if(! detail::is_token_char(*it))
|
if(! detail::is_token_char(*it))
|
||||||
{
|
{
|
||||||
ec = error::bad_chunk_extension;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_chunk_extension);
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
auto const first = it;
|
auto const first = it;
|
||||||
@@ -455,7 +455,7 @@ semi:
|
|||||||
++it;
|
++it;
|
||||||
if(it == last)
|
if(it == last)
|
||||||
{
|
{
|
||||||
ec = error::bad_chunk_extension;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_chunk_extension);
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -466,7 +466,7 @@ semi:
|
|||||||
}
|
}
|
||||||
if(*it != '=')
|
if(*it != '=')
|
||||||
{
|
{
|
||||||
ec = error::bad_chunk_extension;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_chunk_extension);
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
++it; // skip '='
|
++it; // skip '='
|
||||||
@@ -475,7 +475,7 @@ semi:
|
|||||||
{
|
{
|
||||||
if(it == last)
|
if(it == last)
|
||||||
{
|
{
|
||||||
ec = error::bad_chunk_extension;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_chunk_extension);
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
if(*it != ' ' && *it != '\t')
|
if(*it != ' ' && *it != '\t')
|
||||||
@@ -488,7 +488,7 @@ semi:
|
|||||||
// token
|
// token
|
||||||
if(! detail::is_token_char(*it))
|
if(! detail::is_token_char(*it))
|
||||||
{
|
{
|
||||||
ec = error::bad_chunk_extension;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_chunk_extension);
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
auto const first = it;
|
auto const first = it;
|
||||||
@@ -514,7 +514,7 @@ semi:
|
|||||||
{
|
{
|
||||||
if(it == last)
|
if(it == last)
|
||||||
{
|
{
|
||||||
ec = error::bad_chunk_extension;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_chunk_extension);
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
if(*it == '"')
|
if(*it == '"')
|
||||||
@@ -524,7 +524,7 @@ semi:
|
|||||||
++it;
|
++it;
|
||||||
if(it == last)
|
if(it == last)
|
||||||
{
|
{
|
||||||
ec = error::bad_chunk_extension;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_chunk_extension);
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ struct basic_file_body<file_win32>
|
|||||||
return boost::none;
|
return boost::none;
|
||||||
if (nread == 0)
|
if (nread == 0)
|
||||||
{
|
{
|
||||||
ec = error::short_read;
|
BOOST_BEAST_ASSIGN_EC(ec, error::short_read);
|
||||||
return boost::none;
|
return boost::none;
|
||||||
}
|
}
|
||||||
BOOST_ASSERT(nread != 0);
|
BOOST_ASSERT(nread != 0);
|
||||||
|
@@ -199,7 +199,7 @@ public:
|
|||||||
auto const size = read_size(b_, 65536);
|
auto const size = read_size(b_, 65536);
|
||||||
if(size == 0)
|
if(size == 0)
|
||||||
{
|
{
|
||||||
ec = error::buffer_overflow;
|
BOOST_BEAST_ASSIGN_EC(ec, error::buffer_overflow);
|
||||||
goto upcall;
|
goto upcall;
|
||||||
}
|
}
|
||||||
auto const mb =
|
auto const mb =
|
||||||
@@ -228,7 +228,7 @@ public:
|
|||||||
BOOST_ASSERT(p_.is_done());
|
BOOST_ASSERT(p_.is_done());
|
||||||
goto upcall;
|
goto upcall;
|
||||||
}
|
}
|
||||||
ec = error::end_of_stream;
|
BOOST_BEAST_ASSIGN_EC(ec, error::end_of_stream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(ec)
|
if(ec)
|
||||||
@@ -337,7 +337,7 @@ read_some(SyncReadStream& s, DynamicBuffer& b, basic_parser<isRequest>& p, error
|
|||||||
auto const size = read_size(b, 65536);
|
auto const size = read_size(b, 65536);
|
||||||
if(size == 0)
|
if(size == 0)
|
||||||
{
|
{
|
||||||
ec = error::buffer_overflow;
|
BOOST_BEAST_ASSIGN_EC(ec, error::buffer_overflow);
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
auto const mb =
|
auto const mb =
|
||||||
@@ -362,7 +362,7 @@ read_some(SyncReadStream& s, DynamicBuffer& b, basic_parser<isRequest>& p, error
|
|||||||
BOOST_ASSERT(p.is_done());
|
BOOST_ASSERT(p.is_done());
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
ec = error::end_of_stream;
|
BOOST_BEAST_ASSIGN_EC(ec, error::end_of_stream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(ec)
|
if(ec)
|
||||||
|
@@ -345,7 +345,7 @@ private:
|
|||||||
BOOST_ASSERT(! used_);
|
BOOST_ASSERT(! used_);
|
||||||
if(used_)
|
if(used_)
|
||||||
{
|
{
|
||||||
ec = error::stale_parser;
|
BOOST_BEAST_ASSIGN_EC(ec, error::stale_parser);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
used_ = true;
|
used_ = true;
|
||||||
@@ -395,7 +395,7 @@ private:
|
|||||||
BOOST_ASSERT(! used_);
|
BOOST_ASSERT(! used_);
|
||||||
if(used_)
|
if(used_)
|
||||||
{
|
{
|
||||||
ec = error::stale_parser;
|
BOOST_BEAST_ASSIGN_EC(ec, error::stale_parser);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
used_ = true;
|
used_ = true;
|
||||||
|
@@ -87,7 +87,7 @@ public:
|
|||||||
{
|
{
|
||||||
if(length && *length > body_.size())
|
if(length && *length > body_.size())
|
||||||
{
|
{
|
||||||
ec = error::buffer_overflow;
|
BOOST_BEAST_ASSIGN_EC(ec, error::buffer_overflow);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ec = {};
|
ec = {};
|
||||||
@@ -102,7 +102,7 @@ public:
|
|||||||
auto const len = body_.size();
|
auto const len = body_.size();
|
||||||
if(n > len)
|
if(n > len)
|
||||||
{
|
{
|
||||||
ec = error::buffer_overflow;
|
BOOST_BEAST_ASSIGN_EC(ec, error::buffer_overflow);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ec = {};
|
ec = {};
|
||||||
|
@@ -96,7 +96,7 @@ public:
|
|||||||
{
|
{
|
||||||
if(*length > body_.max_size())
|
if(*length > body_.max_size())
|
||||||
{
|
{
|
||||||
ec = error::buffer_overflow;
|
BOOST_BEAST_ASSIGN_EC(ec, error::buffer_overflow);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
body_.reserve(beast::detail::clamp(*length));
|
body_.reserve(beast::detail::clamp(*length));
|
||||||
@@ -113,7 +113,7 @@ public:
|
|||||||
auto const size = body_.size();
|
auto const size = body_.size();
|
||||||
if (extra > body_.max_size() - size)
|
if (extra > body_.max_size() - size)
|
||||||
{
|
{
|
||||||
ec = error::buffer_overflow;
|
BOOST_BEAST_ASSIGN_EC(ec, error::buffer_overflow);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -89,7 +89,7 @@ public:
|
|||||||
{
|
{
|
||||||
if(*length > body_.max_size())
|
if(*length > body_.max_size())
|
||||||
{
|
{
|
||||||
ec = error::buffer_overflow;
|
BOOST_BEAST_ASSIGN_EC(ec, error::buffer_overflow);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
body_.reserve(beast::detail::clamp(*length));
|
body_.reserve(beast::detail::clamp(*length));
|
||||||
@@ -106,7 +106,7 @@ public:
|
|||||||
auto const len = body_.size();
|
auto const len = body_.size();
|
||||||
if (n > body_.max_size() - len)
|
if (n > body_.max_size() - len)
|
||||||
{
|
{
|
||||||
ec = error::buffer_overflow;
|
BOOST_BEAST_ASSIGN_EC(ec, error::buffer_overflow);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -209,7 +209,7 @@ read_close(
|
|||||||
if(n == 1)
|
if(n == 1)
|
||||||
{
|
{
|
||||||
// invalid payload size == 1
|
// invalid payload size == 1
|
||||||
ec = error::bad_close_size;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_close_size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ read_close(
|
|||||||
if(! is_valid_close_code(cr.code))
|
if(! is_valid_close_code(cr.code))
|
||||||
{
|
{
|
||||||
// invalid close code
|
// invalid close code
|
||||||
ec = error::bad_close_code;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_close_code);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ read_close(
|
|||||||
cr.reason.data(), cr.reason.size()))
|
cr.reason.data(), cr.reason.size()))
|
||||||
{
|
{
|
||||||
// not valid utf-8
|
// not valid utf-8
|
||||||
ec = error::bad_close_payload;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_close_payload);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ec = {};
|
ec = {};
|
||||||
|
@@ -215,7 +215,7 @@ public:
|
|||||||
auto sp = wp_.lock();
|
auto sp = wp_.lock();
|
||||||
if(! sp)
|
if(! sp)
|
||||||
{
|
{
|
||||||
ec = net::error::operation_aborted;
|
BOOST_BEAST_ASSIGN_EC(ec, net::error::operation_aborted);
|
||||||
return this->complete(cont, ec);
|
return this->complete(cont, ec);
|
||||||
}
|
}
|
||||||
auto& impl = *sp;
|
auto& impl = *sp;
|
||||||
@@ -247,7 +247,10 @@ public:
|
|||||||
if(impl.check_stop_now(ec))
|
if(impl.check_stop_now(ec))
|
||||||
goto upcall;
|
goto upcall;
|
||||||
if(! ec)
|
if(! ec)
|
||||||
ec = result_;
|
{
|
||||||
|
BOOST_BEAST_ASSIGN_EC(ec, result_);
|
||||||
|
BOOST_BEAST_ASSIGN_EC(ec, result_);
|
||||||
|
}
|
||||||
if(! ec)
|
if(! ec)
|
||||||
{
|
{
|
||||||
impl.do_pmd_config(res_);
|
impl.do_pmd_config(res_);
|
||||||
@@ -311,7 +314,7 @@ public:
|
|||||||
auto sp = wp_.lock();
|
auto sp = wp_.lock();
|
||||||
if(! sp)
|
if(! sp)
|
||||||
{
|
{
|
||||||
ec = net::error::operation_aborted;
|
BOOST_BEAST_ASSIGN_EC(ec, net::error::operation_aborted);
|
||||||
return this->complete(cont, ec);
|
return this->complete(cont, ec);
|
||||||
}
|
}
|
||||||
auto& impl = *sp;
|
auto& impl = *sp;
|
||||||
@@ -334,7 +337,9 @@ public:
|
|||||||
impl.rd_buf, p_, std::move(*this));
|
impl.rd_buf, p_, std::move(*this));
|
||||||
}
|
}
|
||||||
if(ec == http::error::end_of_stream)
|
if(ec == http::error::end_of_stream)
|
||||||
ec = error::closed;
|
{
|
||||||
|
BOOST_BEAST_ASSIGN_EC(ec, error::closed);
|
||||||
|
}
|
||||||
if(impl.check_stop_now(ec))
|
if(impl.check_stop_now(ec))
|
||||||
goto upcall;
|
goto upcall;
|
||||||
|
|
||||||
@@ -456,7 +461,7 @@ do_accept(
|
|||||||
http::write(impl_->stream(), res, ec);
|
http::write(impl_->stream(), res, ec);
|
||||||
if(ec)
|
if(ec)
|
||||||
return;
|
return;
|
||||||
ec = result;
|
BOOST_BEAST_ASSIGN_EC(ec, result);
|
||||||
if(ec)
|
if(ec)
|
||||||
{
|
{
|
||||||
// VFALCO TODO Respect keep alive setting, perform
|
// VFALCO TODO Respect keep alive setting, perform
|
||||||
@@ -488,7 +493,9 @@ do_accept(
|
|||||||
http::request_parser<http::empty_body> p;
|
http::request_parser<http::empty_body> p;
|
||||||
http::read(next_layer(), impl_->rd_buf, p, ec);
|
http::read(next_layer(), impl_->rd_buf, p, ec);
|
||||||
if(ec == http::error::end_of_stream)
|
if(ec == http::error::end_of_stream)
|
||||||
ec = error::closed;
|
{
|
||||||
|
BOOST_BEAST_ASSIGN_EC(ec, error::closed);
|
||||||
|
}
|
||||||
if(ec)
|
if(ec)
|
||||||
return;
|
return;
|
||||||
do_accept(p.get(), decorator, ec);
|
do_accept(p.get(), decorator, ec);
|
||||||
|
@@ -76,7 +76,7 @@ public:
|
|||||||
auto sp = wp_.lock();
|
auto sp = wp_.lock();
|
||||||
if(! sp)
|
if(! sp)
|
||||||
{
|
{
|
||||||
ec = net::error::operation_aborted;
|
BOOST_BEAST_ASSIGN_EC(ec, net::error::operation_aborted);
|
||||||
return this->complete(cont, ec);
|
return this->complete(cont, ec);
|
||||||
}
|
}
|
||||||
auto& impl = *sp;
|
auto& impl = *sp;
|
||||||
@@ -260,7 +260,9 @@ public:
|
|||||||
ec = {};
|
ec = {};
|
||||||
}
|
}
|
||||||
if(! ec)
|
if(! ec)
|
||||||
ec = ev_;
|
{
|
||||||
|
BOOST_BEAST_ASSIGN_EC(ec, ev_);
|
||||||
|
}
|
||||||
if(ec)
|
if(ec)
|
||||||
impl.change_status(status::failed);
|
impl.change_status(status::failed);
|
||||||
else
|
else
|
||||||
|
@@ -93,7 +93,7 @@ public:
|
|||||||
auto sp = wp_.lock();
|
auto sp = wp_.lock();
|
||||||
if(! sp)
|
if(! sp)
|
||||||
{
|
{
|
||||||
ec = net::error::operation_aborted;
|
BOOST_BEAST_ASSIGN_EC(ec, net::error::operation_aborted);
|
||||||
return this->complete(cont, ec);
|
return this->complete(cont, ec);
|
||||||
}
|
}
|
||||||
auto& impl = *sp;
|
auto& impl = *sp;
|
||||||
@@ -162,7 +162,7 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ec = http::error::buffer_overflow;
|
BOOST_BEAST_ASSIGN_EC(ec, http::error::buffer_overflow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,7 +271,7 @@ do_handshake(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ec = http::error::buffer_overflow;
|
BOOST_BEAST_ASSIGN_EC(ec, http::error::buffer_overflow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -72,7 +72,7 @@ public:
|
|||||||
auto sp = wp_.lock();
|
auto sp = wp_.lock();
|
||||||
if(! sp)
|
if(! sp)
|
||||||
{
|
{
|
||||||
ec = net::error::operation_aborted;
|
BOOST_BEAST_ASSIGN_EC(ec, net::error::operation_aborted);
|
||||||
return this->complete(cont, ec);
|
return this->complete(cont, ec);
|
||||||
}
|
}
|
||||||
auto& impl = *sp;
|
auto& impl = *sp;
|
||||||
|
@@ -87,7 +87,7 @@ public:
|
|||||||
auto sp = wp_.lock();
|
auto sp = wp_.lock();
|
||||||
if(! sp)
|
if(! sp)
|
||||||
{
|
{
|
||||||
ec = net::error::operation_aborted;
|
BOOST_BEAST_ASSIGN_EC(ec, net::error::operation_aborted);
|
||||||
bytes_written_ = 0;
|
bytes_written_ = 0;
|
||||||
return this->complete(cont, ec, bytes_written_);
|
return this->complete(cont, ec, bytes_written_);
|
||||||
}
|
}
|
||||||
@@ -136,7 +136,7 @@ public:
|
|||||||
// a `close_op` wrote a close frame
|
// a `close_op` wrote a close frame
|
||||||
BOOST_ASSERT(impl.wr_close);
|
BOOST_ASSERT(impl.wr_close);
|
||||||
BOOST_ASSERT(impl.status_ != status::open);
|
BOOST_ASSERT(impl.status_ != status::open);
|
||||||
ec = net::error::operation_aborted;
|
BOOST_BEAST_ASSIGN_EC(ec, net::error::operation_aborted);
|
||||||
goto upcall;
|
goto upcall;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -145,7 +145,7 @@ public:
|
|||||||
if( impl.status_ == status::closed ||
|
if( impl.status_ == status::closed ||
|
||||||
impl.status_ == status::failed)
|
impl.status_ == status::failed)
|
||||||
{
|
{
|
||||||
ec = net::error::operation_aborted;
|
BOOST_BEAST_ASSIGN_EC(ec, net::error::operation_aborted);
|
||||||
goto upcall;
|
goto upcall;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -691,7 +691,9 @@ public:
|
|||||||
ec = {};
|
ec = {};
|
||||||
}
|
}
|
||||||
if(! ec)
|
if(! ec)
|
||||||
ec = result_;
|
{
|
||||||
|
BOOST_BEAST_ASSIGN_EC(ec, result_);
|
||||||
|
}
|
||||||
if(ec && ec != error::closed)
|
if(ec && ec != error::closed)
|
||||||
impl.change_status(status::failed);
|
impl.change_status(status::failed);
|
||||||
else
|
else
|
||||||
@@ -756,7 +758,7 @@ public:
|
|||||||
auto sp = wp_.lock();
|
auto sp = wp_.lock();
|
||||||
if(! sp)
|
if(! sp)
|
||||||
{
|
{
|
||||||
ec = net::error::operation_aborted;
|
BOOST_BEAST_ASSIGN_EC(ec, net::error::operation_aborted);
|
||||||
bytes_written_ = 0;
|
bytes_written_ = 0;
|
||||||
return this->complete(cont, ec, bytes_written_);
|
return this->complete(cont, ec, bytes_written_);
|
||||||
}
|
}
|
||||||
|
@@ -352,7 +352,9 @@ do_fail(
|
|||||||
ec = {};
|
ec = {};
|
||||||
}
|
}
|
||||||
if(! ec)
|
if(! ec)
|
||||||
ec = ev;
|
{
|
||||||
|
BOOST_BEAST_ASSIGN_EC(ec, ev);
|
||||||
|
}
|
||||||
if(ec && ec != error::closed)
|
if(ec && ec != error::closed)
|
||||||
impl_->change_status(status::failed);
|
impl_->change_status(status::failed);
|
||||||
else
|
else
|
||||||
|
@@ -342,7 +342,7 @@ struct stream<NextLayer, deflateSupported>::impl_type
|
|||||||
if(timed_out)
|
if(timed_out)
|
||||||
{
|
{
|
||||||
timed_out = false;
|
timed_out = false;
|
||||||
ec = beast::error::timeout;
|
BOOST_BEAST_ASSIGN_EC(ec, beast::error::timeout);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,7 +351,7 @@ struct stream<NextLayer, deflateSupported>::impl_type
|
|||||||
status_ == status::failed)
|
status_ == status::failed)
|
||||||
{
|
{
|
||||||
//BOOST_ASSERT(ec_delivered);
|
//BOOST_ASSERT(ec_delivered);
|
||||||
ec = net::error::operation_aborted;
|
BOOST_BEAST_ASSIGN_EC(ec, net::error::operation_aborted);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,7 +363,7 @@ struct stream<NextLayer, deflateSupported>::impl_type
|
|||||||
if(ec_delivered)
|
if(ec_delivered)
|
||||||
{
|
{
|
||||||
// No, so abort
|
// No, so abort
|
||||||
ec = net::error::operation_aborted;
|
BOOST_BEAST_ASSIGN_EC(ec, net::error::operation_aborted);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -653,7 +653,7 @@ on_response(
|
|||||||
auto const err =
|
auto const err =
|
||||||
[&](error e)
|
[&](error e)
|
||||||
{
|
{
|
||||||
ec = e;
|
BOOST_BEAST_ASSIGN_EC(ec, e);
|
||||||
};
|
};
|
||||||
if(res.result() != http::status::switching_protocols)
|
if(res.result() != http::status::switching_protocols)
|
||||||
return err(error::upgrade_declined);
|
return err(error::upgrade_declined);
|
||||||
@@ -747,14 +747,14 @@ parse_fh(
|
|||||||
if(rd_cont)
|
if(rd_cont)
|
||||||
{
|
{
|
||||||
// new data frame when continuation expected
|
// new data frame when continuation expected
|
||||||
ec = error::bad_data_frame;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_data_frame);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(fh.rsv2 || fh.rsv3 ||
|
if(fh.rsv2 || fh.rsv3 ||
|
||||||
! this->rd_deflated(fh.rsv1))
|
! this->rd_deflated(fh.rsv1))
|
||||||
{
|
{
|
||||||
// reserved bits not cleared
|
// reserved bits not cleared
|
||||||
ec = error::bad_reserved_bits;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_reserved_bits);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -763,13 +763,13 @@ parse_fh(
|
|||||||
if(! rd_cont)
|
if(! rd_cont)
|
||||||
{
|
{
|
||||||
// continuation without an active message
|
// continuation without an active message
|
||||||
ec = error::bad_continuation;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_continuation);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(fh.rsv1 || fh.rsv2 || fh.rsv3)
|
if(fh.rsv1 || fh.rsv2 || fh.rsv3)
|
||||||
{
|
{
|
||||||
// reserved bits not cleared
|
// reserved bits not cleared
|
||||||
ec = error::bad_reserved_bits;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_reserved_bits);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -778,25 +778,25 @@ parse_fh(
|
|||||||
if(detail::is_reserved(fh.op))
|
if(detail::is_reserved(fh.op))
|
||||||
{
|
{
|
||||||
// reserved opcode
|
// reserved opcode
|
||||||
ec = error::bad_opcode;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_opcode);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(! fh.fin)
|
if(! fh.fin)
|
||||||
{
|
{
|
||||||
// fragmented control message
|
// fragmented control message
|
||||||
ec = error::bad_control_fragment;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_control_fragment);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(fh.len > 125)
|
if(fh.len > 125)
|
||||||
{
|
{
|
||||||
// invalid length for control message
|
// invalid length for control message
|
||||||
ec = error::bad_control_size;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_control_size);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(fh.rsv1 || fh.rsv2 || fh.rsv3)
|
if(fh.rsv1 || fh.rsv2 || fh.rsv3)
|
||||||
{
|
{
|
||||||
// reserved bits not cleared
|
// reserved bits not cleared
|
||||||
ec = error::bad_reserved_bits;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_reserved_bits);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -804,13 +804,13 @@ parse_fh(
|
|||||||
if(role == role_type::server && ! fh.mask)
|
if(role == role_type::server && ! fh.mask)
|
||||||
{
|
{
|
||||||
// unmasked frame from client
|
// unmasked frame from client
|
||||||
ec = error::bad_unmasked_frame;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_unmasked_frame);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(role == role_type::client && fh.mask)
|
if(role == role_type::client && fh.mask)
|
||||||
{
|
{
|
||||||
// masked frame from server
|
// masked frame from server
|
||||||
ec = error::bad_masked_frame;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_masked_frame);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(detail::is_control(fh.op) &&
|
if(detail::is_control(fh.op) &&
|
||||||
@@ -833,7 +833,7 @@ parse_fh(
|
|||||||
if(fh.len < 126)
|
if(fh.len < 126)
|
||||||
{
|
{
|
||||||
// length not canonical
|
// length not canonical
|
||||||
ec = error::bad_size;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_size);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -848,7 +848,7 @@ parse_fh(
|
|||||||
if(fh.len < 65536)
|
if(fh.len < 65536)
|
||||||
{
|
{
|
||||||
// length not canonical
|
// length not canonical
|
||||||
ec = error::bad_size;
|
BOOST_BEAST_ASSIGN_EC(ec, error::bad_size);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -881,7 +881,7 @@ parse_fh(
|
|||||||
std::uint64_t>::max)() - fh.len)
|
std::uint64_t>::max)() - fh.len)
|
||||||
{
|
{
|
||||||
// message size exceeds configured limit
|
// message size exceeds configured limit
|
||||||
ec = error::message_too_big;
|
BOOST_BEAST_ASSIGN_EC(ec, error::message_too_big);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -891,7 +891,7 @@ parse_fh(
|
|||||||
rd_size, fh.len, rd_msg_max))
|
rd_size, fh.len, rd_msg_max))
|
||||||
{
|
{
|
||||||
// message size exceeds configured limit
|
// message size exceeds configured limit
|
||||||
ec = error::message_too_big;
|
BOOST_BEAST_ASSIGN_EC(ec, error::message_too_big);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ operator()(
|
|||||||
auto sp = wp_.lock();
|
auto sp = wp_.lock();
|
||||||
if(! sp)
|
if(! sp)
|
||||||
{
|
{
|
||||||
ec = net::error::operation_aborted;
|
BOOST_BEAST_ASSIGN_EC(ec, net::error::operation_aborted);
|
||||||
bytes_transferred_ = 0;
|
bytes_transferred_ = 0;
|
||||||
return this->complete(cont, ec, bytes_transferred_);
|
return this->complete(cont, ec, bytes_transferred_);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user