forked from boostorg/beast
error_codes use source_location.
This commit is contained in:
1 parent
9473c10dde
commit
f4d1936bb2
27 files changed
+117
-84
No files matched your search
@@ -92,7 +92,7 @@ struct basic_dynamic_body
|
||||
auto const n = buffer_bytes(buffers);
|
||||
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;
|
||||
}
|
||||
auto const mb =
|
||||
|
||||
@@ -367,7 +367,7 @@ get(error_code& ec) ->
|
||||
|
||||
if (nread == 0)
|
||||
{
|
||||
ec = error::short_read;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::short_read);
|
||||
return boost::none;
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ struct buffer_body
|
||||
{
|
||||
if(! body_.data)
|
||||
{
|
||||
ec = error::need_buffer;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::need_buffer);
|
||||
return 0;
|
||||
}
|
||||
auto const bytes_transferred =
|
||||
@@ -136,7 +136,9 @@ struct buffer_body
|
||||
if(bytes_transferred == buffer_bytes(buffers))
|
||||
ec = {};
|
||||
else
|
||||
ec = error::need_buffer;
|
||||
{
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::need_buffer);
|
||||
}
|
||||
return bytes_transferred;
|
||||
}
|
||||
|
||||
@@ -186,7 +188,7 @@ struct buffer_body
|
||||
if(body_.more)
|
||||
{
|
||||
toggle_ = false;
|
||||
ec = error::need_buffer;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::need_buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -202,7 +204,9 @@ struct buffer_body
|
||||
body_.data, body_.size}, body_.more}};
|
||||
}
|
||||
if(body_.more)
|
||||
ec = error::need_buffer;
|
||||
{
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::need_buffer);
|
||||
}
|
||||
else
|
||||
ec = {};
|
||||
return boost::none;
|
||||
|
||||
@@ -78,7 +78,7 @@ struct empty_body
|
||||
put(ConstBufferSequence const&,
|
||||
error_code& ec)
|
||||
{
|
||||
ec = error::unexpected_body;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::unexpected_body);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -399,7 +399,7 @@ loop:
|
||||
++it;
|
||||
if(it == last)
|
||||
{
|
||||
ec = error::bad_chunk_extension;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::bad_chunk_extension);
|
||||
return it;
|
||||
}
|
||||
if(*it != ' ' && *it != '\t')
|
||||
@@ -409,7 +409,7 @@ loop:
|
||||
// ';'
|
||||
if(*it != ';')
|
||||
{
|
||||
ec = error::bad_chunk_extension;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::bad_chunk_extension);
|
||||
return it;
|
||||
}
|
||||
semi:
|
||||
@@ -419,7 +419,7 @@ semi:
|
||||
{
|
||||
if(it == last)
|
||||
{
|
||||
ec = error::bad_chunk_extension;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::bad_chunk_extension);
|
||||
return it;
|
||||
}
|
||||
if(*it != ' ' && *it != '\t')
|
||||
@@ -430,7 +430,7 @@ semi:
|
||||
{
|
||||
if(! detail::is_token_char(*it))
|
||||
{
|
||||
ec = error::bad_chunk_extension;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::bad_chunk_extension);
|
||||
return it;
|
||||
}
|
||||
auto const first = it;
|
||||
@@ -455,7 +455,7 @@ semi:
|
||||
++it;
|
||||
if(it == last)
|
||||
{
|
||||
ec = error::bad_chunk_extension;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::bad_chunk_extension);
|
||||
return it;
|
||||
}
|
||||
}
|
||||
@@ -466,7 +466,7 @@ semi:
|
||||
}
|
||||
if(*it != '=')
|
||||
{
|
||||
ec = error::bad_chunk_extension;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::bad_chunk_extension);
|
||||
return it;
|
||||
}
|
||||
++it; // skip '='
|
||||
@@ -475,7 +475,7 @@ semi:
|
||||
{
|
||||
if(it == last)
|
||||
{
|
||||
ec = error::bad_chunk_extension;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::bad_chunk_extension);
|
||||
return it;
|
||||
}
|
||||
if(*it != ' ' && *it != '\t')
|
||||
@@ -488,7 +488,7 @@ semi:
|
||||
// token
|
||||
if(! detail::is_token_char(*it))
|
||||
{
|
||||
ec = error::bad_chunk_extension;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::bad_chunk_extension);
|
||||
return it;
|
||||
}
|
||||
auto const first = it;
|
||||
@@ -514,7 +514,7 @@ semi:
|
||||
{
|
||||
if(it == last)
|
||||
{
|
||||
ec = error::bad_chunk_extension;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::bad_chunk_extension);
|
||||
return it;
|
||||
}
|
||||
if(*it == '"')
|
||||
@@ -524,7 +524,7 @@ semi:
|
||||
++it;
|
||||
if(it == last)
|
||||
{
|
||||
ec = error::bad_chunk_extension;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::bad_chunk_extension);
|
||||
return it;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ struct basic_file_body<file_win32>
|
||||
return boost::none;
|
||||
if (nread == 0)
|
||||
{
|
||||
ec = error::short_read;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::short_read);
|
||||
return boost::none;
|
||||
}
|
||||
BOOST_ASSERT(nread != 0);
|
||||
|
||||
@@ -199,7 +199,7 @@ public:
|
||||
auto const size = read_size(b_, 65536);
|
||||
if(size == 0)
|
||||
{
|
||||
ec = error::buffer_overflow;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::buffer_overflow);
|
||||
goto upcall;
|
||||
}
|
||||
auto const mb =
|
||||
@@ -228,7 +228,7 @@ public:
|
||||
BOOST_ASSERT(p_.is_done());
|
||||
goto upcall;
|
||||
}
|
||||
ec = error::end_of_stream;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::end_of_stream);
|
||||
break;
|
||||
}
|
||||
if(ec)
|
||||
@@ -337,7 +337,7 @@ read_some(SyncReadStream& s, DynamicBuffer& b, basic_parser<isRequest>& p, error
|
||||
auto const size = read_size(b, 65536);
|
||||
if(size == 0)
|
||||
{
|
||||
ec = error::buffer_overflow;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::buffer_overflow);
|
||||
return total;
|
||||
}
|
||||
auto const mb =
|
||||
@@ -362,7 +362,7 @@ read_some(SyncReadStream& s, DynamicBuffer& b, basic_parser<isRequest>& p, error
|
||||
BOOST_ASSERT(p.is_done());
|
||||
return total;
|
||||
}
|
||||
ec = error::end_of_stream;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::end_of_stream);
|
||||
break;
|
||||
}
|
||||
if(ec)
|
||||
|
||||
@@ -345,7 +345,7 @@ private:
|
||||
BOOST_ASSERT(! used_);
|
||||
if(used_)
|
||||
{
|
||||
ec = error::stale_parser;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::stale_parser);
|
||||
return;
|
||||
}
|
||||
used_ = true;
|
||||
@@ -395,7 +395,7 @@ private:
|
||||
BOOST_ASSERT(! used_);
|
||||
if(used_)
|
||||
{
|
||||
ec = error::stale_parser;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::stale_parser);
|
||||
return;
|
||||
}
|
||||
used_ = true;
|
||||
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
{
|
||||
if(length && *length > body_.size())
|
||||
{
|
||||
ec = error::buffer_overflow;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::buffer_overflow);
|
||||
return;
|
||||
}
|
||||
ec = {};
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
auto const len = body_.size();
|
||||
if(n > len)
|
||||
{
|
||||
ec = error::buffer_overflow;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::buffer_overflow);
|
||||
return 0;
|
||||
}
|
||||
ec = {};
|
||||
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
{
|
||||
if(*length > body_.max_size())
|
||||
{
|
||||
ec = error::buffer_overflow;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::buffer_overflow);
|
||||
return;
|
||||
}
|
||||
body_.reserve(beast::detail::clamp(*length));
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
auto const size = body_.size();
|
||||
if (extra > body_.max_size() - size)
|
||||
{
|
||||
ec = error::buffer_overflow;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::buffer_overflow);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
{
|
||||
if(*length > body_.max_size())
|
||||
{
|
||||
ec = error::buffer_overflow;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::buffer_overflow);
|
||||
return;
|
||||
}
|
||||
body_.reserve(beast::detail::clamp(*length));
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
auto const len = body_.size();
|
||||
if (n > body_.max_size() - len)
|
||||
{
|
||||
ec = error::buffer_overflow;
|
||||
BOOST_BEAST_ASSIGN_EC(ec, error::buffer_overflow);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user