forked from boostorg/beast
@@ -16,6 +16,7 @@
|
||||
#include <beast/core/detail/type_traits.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace beast {
|
||||
@@ -134,7 +135,7 @@ prepare_content_length(prepare_info& pi,
|
||||
error_code ec;
|
||||
w.init(ec);
|
||||
if(ec)
|
||||
throw system_error{ec};
|
||||
BOOST_THROW_EXCEPTION(system_error{ec});
|
||||
pi.content_length = w.content_length();
|
||||
}
|
||||
|
||||
@@ -157,8 +158,6 @@ void
|
||||
prepare(message<isRequest, Body, Fields>& msg,
|
||||
Options&&... options)
|
||||
{
|
||||
using beast::detail::make_exception;
|
||||
|
||||
// VFALCO TODO
|
||||
static_assert(is_Body<Body>::value,
|
||||
"Body requirements not met");
|
||||
@@ -174,16 +173,16 @@ prepare(message<isRequest, Body, Fields>& msg,
|
||||
std::forward<Options>(options)...);
|
||||
|
||||
if(msg.fields.exists("Connection"))
|
||||
throw make_exception<std::invalid_argument>(
|
||||
"prepare called with Connection field set", __FILE__, __LINE__);
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument{
|
||||
"prepare called with Connection field set"});
|
||||
|
||||
if(msg.fields.exists("Content-Length"))
|
||||
throw make_exception<std::invalid_argument>(
|
||||
"prepare called with Content-Length field set", __FILE__, __LINE__);
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument{
|
||||
"prepare called with Content-Length field set"});
|
||||
|
||||
if(token_list{msg.fields["Transfer-Encoding"]}.exists("chunked"))
|
||||
throw make_exception<std::invalid_argument>(
|
||||
"prepare called with Transfer-Encoding: chunked set", __FILE__, __LINE__);
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument{
|
||||
"prepare called with Transfer-Encoding: chunked set"});
|
||||
|
||||
if(pi.connection_value != connection::upgrade)
|
||||
{
|
||||
@@ -254,8 +253,8 @@ prepare(message<isRequest, Body, Fields>& msg,
|
||||
// rfc7230 6.7.
|
||||
if(msg.version < 11 && token_list{
|
||||
msg.fields["Connection"]}.exists("upgrade"))
|
||||
throw make_exception<std::invalid_argument>(
|
||||
"invalid version for Connection: upgrade", __FILE__, __LINE__);
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument{
|
||||
"invalid version for Connection: upgrade"});
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <boost/asio/handler_invoke_hook.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
namespace beast {
|
||||
namespace http {
|
||||
@@ -203,7 +204,7 @@ read_some(
|
||||
auto const bytes_used =
|
||||
read_some(stream, buffer, parser, ec);
|
||||
if(ec)
|
||||
throw system_error{ec};
|
||||
BOOST_THROW_EXCEPTION(system_error{ec});
|
||||
return bytes_used;
|
||||
}
|
||||
|
||||
@@ -244,7 +245,7 @@ read(
|
||||
error_code ec;
|
||||
read(stream, buffer, parser, ec);
|
||||
if(ec)
|
||||
throw system_error{ec};
|
||||
BOOST_THROW_EXCEPTION(system_error{ec});
|
||||
}
|
||||
|
||||
template<
|
||||
@@ -298,7 +299,7 @@ read(
|
||||
error_code ec;
|
||||
beast::http::read(stream, buffer, msg, ec);
|
||||
if(ec)
|
||||
throw system_error{ec};
|
||||
BOOST_THROW_EXCEPTION(system_error{ec});
|
||||
}
|
||||
|
||||
template<
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <boost/asio/handler_continuation_hook.hpp>
|
||||
#include <boost/asio/handler_invoke_hook.hpp>
|
||||
#include <boost/asio/write.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include <ostream>
|
||||
@@ -192,7 +193,7 @@ write(SyncWriteStream& stream,
|
||||
error_code ec;
|
||||
write(stream, msg, ec);
|
||||
if(ec)
|
||||
throw system_error{ec};
|
||||
BOOST_THROW_EXCEPTION(system_error{ec});
|
||||
}
|
||||
|
||||
template<class SyncWriteStream,
|
||||
@@ -584,7 +585,7 @@ write(SyncWriteStream& stream,
|
||||
error_code ec;
|
||||
write(stream, msg, ec);
|
||||
if(ec)
|
||||
throw system_error{ec};
|
||||
BOOST_THROW_EXCEPTION(system_error{ec});
|
||||
}
|
||||
|
||||
template<class SyncWriteStream,
|
||||
@@ -682,7 +683,7 @@ operator<<(std::ostream& os,
|
||||
error_code ec;
|
||||
write(oss, msg, ec);
|
||||
if(ec)
|
||||
throw system_error{ec};
|
||||
BOOST_THROW_EXCEPTION(system_error{ec});
|
||||
return os;
|
||||
}
|
||||
|
||||
@@ -702,7 +703,7 @@ operator<<(std::ostream& os,
|
||||
error_code ec;
|
||||
write(oss, msg, ec);
|
||||
if(ec && ec != boost::asio::error::eof)
|
||||
throw system_error{ec};
|
||||
BOOST_THROW_EXCEPTION(system_error{ec});
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user