mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-28 06:25:49 +00:00
Reduce requirements to C++11 only
This commit is contained in:
@@ -134,7 +134,7 @@ private:
|
||||
base&
|
||||
get()
|
||||
{
|
||||
return *reinterpret_cast<base*>(buf_);
|
||||
return *reinterpret_cast<base*>(&buf_[0]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -106,28 +106,28 @@ prepare_key(std::uint64_t& prepared, std::uint32_t key)
|
||||
|
||||
template<class T>
|
||||
inline
|
||||
std::enable_if_t<std::is_integral<T>::value, T>
|
||||
typename std::enable_if<std::is_integral<T>::value, T>::type
|
||||
rol(T t, unsigned n = 1)
|
||||
{
|
||||
auto constexpr bits =
|
||||
static_cast<unsigned>(
|
||||
sizeof(T) * CHAR_BIT);
|
||||
n &= bits-1;
|
||||
return static_cast<T>((t << n) |
|
||||
(static_cast<std::make_unsigned_t<T>>(t) >> (bits - n)));
|
||||
return static_cast<T>((t << n) | (
|
||||
static_cast<typename std::make_unsigned<T>::type>(t) >> (bits - n)));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
std::enable_if_t<std::is_integral<T>::value, T>
|
||||
typename std::enable_if<std::is_integral<T>::value, T>::type
|
||||
ror(T t, unsigned n = 1)
|
||||
{
|
||||
auto constexpr bits =
|
||||
static_cast<unsigned>(
|
||||
sizeof(T) * CHAR_BIT);
|
||||
n &= bits-1;
|
||||
return static_cast<T>((t << (bits - n)) |
|
||||
(static_cast<std::make_unsigned_t<T>>(t) >> n));
|
||||
return static_cast<T>((t << (bits - n)) | (
|
||||
static_cast<typename std::make_unsigned<T>::type>(t) >> n));
|
||||
}
|
||||
|
||||
// 32-bit Uuoptimized
|
||||
|
||||
@@ -97,8 +97,7 @@ protected:
|
||||
close_reason cr_; // set from received close frame
|
||||
|
||||
stream_base()
|
||||
: d_(std::make_unique<
|
||||
decorator<default_decorator>>())
|
||||
: d_(new decorator<default_decorator>{})
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
std::size_t bytes_transferred, bool again = true);
|
||||
|
||||
friend
|
||||
auto asio_handler_allocate(
|
||||
void* asio_handler_allocate(
|
||||
std::size_t size, accept_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
}
|
||||
|
||||
friend
|
||||
auto asio_handler_deallocate(
|
||||
void asio_handler_deallocate(
|
||||
void* p, std::size_t size, accept_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
@@ -94,14 +94,14 @@ public:
|
||||
}
|
||||
|
||||
friend
|
||||
auto asio_handler_is_continuation(accept_op* op)
|
||||
bool asio_handler_is_continuation(accept_op* op)
|
||||
{
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
friend
|
||||
auto asio_handler_invoke(Function&& f, accept_op* op)
|
||||
void asio_handler_invoke(Function&& f, accept_op* op)
|
||||
{
|
||||
return boost_asio_handler_invoke_helpers::
|
||||
invoke(f, op->d_->h);
|
||||
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
std::size_t bytes_transferred, bool again = true);
|
||||
|
||||
friend
|
||||
auto asio_handler_allocate(
|
||||
void* asio_handler_allocate(
|
||||
std::size_t size, close_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
}
|
||||
|
||||
friend
|
||||
auto asio_handler_deallocate(
|
||||
void asio_handler_deallocate(
|
||||
void* p, std::size_t size, close_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
@@ -101,14 +101,14 @@ public:
|
||||
}
|
||||
|
||||
friend
|
||||
auto asio_handler_is_continuation(close_op* op)
|
||||
bool asio_handler_is_continuation(close_op* op)
|
||||
{
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
friend
|
||||
auto asio_handler_invoke(Function&& f, close_op* op)
|
||||
void asio_handler_invoke(Function&& f, close_op* op)
|
||||
{
|
||||
return boost_asio_handler_invoke_helpers::
|
||||
invoke(f, op->d_->h);
|
||||
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
std::size_t bytes_transferred, bool again = true);
|
||||
|
||||
friend
|
||||
auto asio_handler_allocate(
|
||||
void* asio_handler_allocate(
|
||||
std::size_t size, handshake_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
}
|
||||
|
||||
friend
|
||||
auto asio_handler_deallocate(
|
||||
void asio_handler_deallocate(
|
||||
void* p, std::size_t size, handshake_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
@@ -92,14 +92,14 @@ public:
|
||||
}
|
||||
|
||||
friend
|
||||
auto asio_handler_is_continuation(handshake_op* op)
|
||||
bool asio_handler_is_continuation(handshake_op* op)
|
||||
{
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
friend
|
||||
auto asio_handler_invoke(Function&& f, handshake_op* op)
|
||||
void asio_handler_invoke(Function&& f, handshake_op* op)
|
||||
{
|
||||
return boost_asio_handler_invoke_helpers::
|
||||
invoke(f, op->d_->h);
|
||||
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
std::size_t bytes_transferred, bool again = true);
|
||||
|
||||
friend
|
||||
auto asio_handler_allocate(
|
||||
void* asio_handler_allocate(
|
||||
std::size_t size, read_frame_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
}
|
||||
|
||||
friend
|
||||
auto asio_handler_deallocate(
|
||||
void asio_handler_deallocate(
|
||||
void* p, std::size_t size, read_frame_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
@@ -110,14 +110,14 @@ public:
|
||||
}
|
||||
|
||||
friend
|
||||
auto asio_handler_is_continuation(read_frame_op* op)
|
||||
bool asio_handler_is_continuation(read_frame_op* op)
|
||||
{
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
friend
|
||||
auto asio_handler_invoke(Function&& f, read_frame_op* op)
|
||||
void asio_handler_invoke(Function&& f, read_frame_op* op)
|
||||
{
|
||||
return boost_asio_handler_invoke_helpers::
|
||||
invoke(f, op->d_->h);
|
||||
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
error_code const& ec, bool again = true);
|
||||
|
||||
friend
|
||||
auto asio_handler_allocate(
|
||||
void* asio_handler_allocate(
|
||||
std::size_t size, read_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
}
|
||||
|
||||
friend
|
||||
auto asio_handler_deallocate(
|
||||
void asio_handler_deallocate(
|
||||
void* p, std::size_t size, read_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
@@ -83,14 +83,14 @@ public:
|
||||
}
|
||||
|
||||
friend
|
||||
auto asio_handler_is_continuation(read_op* op)
|
||||
bool asio_handler_is_continuation(read_op* op)
|
||||
{
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
friend
|
||||
auto asio_handler_invoke(Function&& f, read_op* op)
|
||||
void asio_handler_invoke(Function&& f, read_op* op)
|
||||
{
|
||||
return boost_asio_handler_invoke_helpers::
|
||||
invoke(f, op->d_->h);
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
error_code ec, bool again = true);
|
||||
|
||||
friend
|
||||
auto asio_handler_allocate(
|
||||
void* asio_handler_allocate(
|
||||
std::size_t size, response_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
}
|
||||
|
||||
friend
|
||||
auto asio_handler_deallocate(
|
||||
void asio_handler_deallocate(
|
||||
void* p, std::size_t size, response_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
@@ -84,14 +84,14 @@ public:
|
||||
}
|
||||
|
||||
friend
|
||||
auto asio_handler_is_continuation(response_op* op)
|
||||
bool asio_handler_is_continuation(response_op* op)
|
||||
{
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
friend
|
||||
auto asio_handler_invoke(Function&& f, response_op* op)
|
||||
void asio_handler_invoke(Function&& f, response_op* op)
|
||||
{
|
||||
return boost_asio_handler_invoke_helpers::
|
||||
invoke(f, op->d_->h);
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
operator()(error_code ec, bool again = true);
|
||||
|
||||
friend
|
||||
auto asio_handler_allocate(std::size_t size,
|
||||
void* asio_handler_allocate(std::size_t size,
|
||||
teardown_ssl_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
}
|
||||
|
||||
friend
|
||||
auto asio_handler_deallocate(void* p,
|
||||
void asio_handler_deallocate(void* p,
|
||||
std::size_t size, teardown_ssl_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
}
|
||||
|
||||
friend
|
||||
auto asio_handler_is_continuation(
|
||||
bool asio_handler_is_continuation(
|
||||
teardown_ssl_op* op)
|
||||
{
|
||||
return op->d_->cont;
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
|
||||
template <class Function>
|
||||
friend
|
||||
auto asio_handler_invoke(Function&& f,
|
||||
void asio_handler_invoke(Function&& f,
|
||||
teardown_ssl_op* op)
|
||||
{
|
||||
return boost_asio_handler_invoke_helpers::
|
||||
@@ -147,8 +147,8 @@ async_teardown(
|
||||
static_assert(beast::is_Handler<
|
||||
TeardownHandler, void(error_code)>::value,
|
||||
"TeardownHandler requirements not met");
|
||||
detail::teardown_ssl_op<AsyncStream, std::decay_t<
|
||||
TeardownHandler>>{std::forward<TeardownHandler>(
|
||||
detail::teardown_ssl_op<AsyncStream, typename std::decay<
|
||||
TeardownHandler>::type>{std::forward<TeardownHandler>(
|
||||
handler), stream};
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_WEBSOCKET_IMPL_SOCKET_IPP
|
||||
#define BEAST_WEBSOCKET_IMPL_SOCKET_IPP
|
||||
#ifndef BEAST_WEBSOCKET_IMPL_STREAM_IPP
|
||||
#define BEAST_WEBSOCKET_IMPL_STREAM_IPP
|
||||
|
||||
#include <beast/websocket/teardown.hpp>
|
||||
#include <beast/websocket/detail/hybi13.hpp>
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <beast/websocket/impl/write_op.ipp>
|
||||
#include <beast/websocket/impl/write_frame_op.ipp>
|
||||
#include <beast/buffer_cat.hpp>
|
||||
#include <beast/async_completion.hpp>
|
||||
#include <beast/consuming_buffers.hpp>
|
||||
#include <beast/prepare_buffers.hpp>
|
||||
#include <beast/static_streambuf.hpp>
|
||||
@@ -167,7 +166,8 @@ stream_base::write_ping(Streambuf& sb,
|
||||
|
||||
template<class NextLayer>
|
||||
template<class... Args>
|
||||
stream<NextLayer>::stream(Args&&... args)
|
||||
stream<NextLayer>::
|
||||
stream(Args&&... args)
|
||||
: next_layer_(std::forward<Args>(args)...)
|
||||
, stream_(next_layer_)
|
||||
{
|
||||
@@ -177,15 +177,18 @@ stream<NextLayer>::stream(Args&&... args)
|
||||
|
||||
template<class NextLayer>
|
||||
void
|
||||
stream<NextLayer>::accept(error_code& ec)
|
||||
stream<NextLayer>::
|
||||
accept(error_code& ec)
|
||||
{
|
||||
accept(boost::asio::null_buffers{}, ec);
|
||||
}
|
||||
|
||||
template<class NextLayer>
|
||||
template<class AcceptHandler>
|
||||
auto
|
||||
stream<NextLayer>::async_accept(AcceptHandler&& handler)
|
||||
typename async_completion<
|
||||
AcceptHandler, void(error_code)>::result_type
|
||||
stream<NextLayer>::
|
||||
async_accept(AcceptHandler&& handler)
|
||||
{
|
||||
return async_accept(boost::asio::null_buffers{},
|
||||
std::forward<AcceptHandler>(handler));
|
||||
@@ -194,8 +197,8 @@ stream<NextLayer>::async_accept(AcceptHandler&& handler)
|
||||
template<class NextLayer>
|
||||
template<class ConstBufferSequence>
|
||||
void
|
||||
stream<NextLayer>::accept(
|
||||
ConstBufferSequence const& buffers)
|
||||
stream<NextLayer>::
|
||||
accept(ConstBufferSequence const& buffers)
|
||||
{
|
||||
static_assert(is_ConstBufferSequence<
|
||||
ConstBufferSequence>::value,
|
||||
@@ -208,8 +211,8 @@ stream<NextLayer>::accept(
|
||||
template<class NextLayer>
|
||||
template<class ConstBufferSequence>
|
||||
void
|
||||
stream<NextLayer>::accept(
|
||||
ConstBufferSequence const& buffers, error_code& ec)
|
||||
stream<NextLayer>::
|
||||
accept(ConstBufferSequence const& buffers, error_code& ec)
|
||||
{
|
||||
static_assert(beast::is_ConstBufferSequence<
|
||||
ConstBufferSequence>::value,
|
||||
@@ -228,9 +231,10 @@ stream<NextLayer>::accept(
|
||||
|
||||
template<class NextLayer>
|
||||
template<class ConstBufferSequence, class AcceptHandler>
|
||||
auto
|
||||
stream<NextLayer>::async_accept(
|
||||
ConstBufferSequence const& bs, AcceptHandler&& handler)
|
||||
typename async_completion<
|
||||
AcceptHandler, void(error_code)>::result_type
|
||||
stream<NextLayer>::
|
||||
async_accept(ConstBufferSequence const& bs, AcceptHandler&& handler)
|
||||
{
|
||||
static_assert(beast::is_ConstBufferSequence<
|
||||
ConstBufferSequence>::value,
|
||||
@@ -246,8 +250,8 @@ stream<NextLayer>::async_accept(
|
||||
template<class NextLayer>
|
||||
template<class Body, class Headers>
|
||||
void
|
||||
stream<NextLayer>::accept(
|
||||
http::message<true, Body, Headers> const& request)
|
||||
stream<NextLayer>::
|
||||
accept(http::message<true, Body, Headers> const& request)
|
||||
{
|
||||
error_code ec;
|
||||
accept(request, ec);
|
||||
@@ -257,9 +261,9 @@ stream<NextLayer>::accept(
|
||||
template<class NextLayer>
|
||||
template<class Body, class Headers>
|
||||
void
|
||||
stream<NextLayer>::accept(
|
||||
http::message<true, Body, Headers> const& req,
|
||||
error_code& ec)
|
||||
stream<NextLayer>::
|
||||
accept(http::message<true, Body, Headers> const& req,
|
||||
error_code& ec)
|
||||
{
|
||||
auto resp = build_response(req);
|
||||
http::write(stream_, resp, ec);
|
||||
@@ -275,10 +279,11 @@ stream<NextLayer>::accept(
|
||||
|
||||
template<class NextLayer>
|
||||
template<class Body, class Headers, class AcceptHandler>
|
||||
auto
|
||||
stream<NextLayer>::async_accept(
|
||||
http::message<true, Body, Headers> const& req,
|
||||
AcceptHandler&& handler)
|
||||
typename async_completion<
|
||||
AcceptHandler, void(error_code)>::result_type
|
||||
stream<NextLayer>::
|
||||
async_accept(http::message<true, Body, Headers> const& req,
|
||||
AcceptHandler&& handler)
|
||||
{
|
||||
beast::async_completion<
|
||||
AcceptHandler, void(error_code)
|
||||
@@ -292,7 +297,8 @@ stream<NextLayer>::async_accept(
|
||||
|
||||
template<class NextLayer>
|
||||
void
|
||||
stream<NextLayer>::handshake(boost::string_ref const& host,
|
||||
stream<NextLayer>::
|
||||
handshake(boost::string_ref const& host,
|
||||
boost::string_ref const& resource, error_code& ec)
|
||||
{
|
||||
std::string key;
|
||||
@@ -309,8 +315,10 @@ stream<NextLayer>::handshake(boost::string_ref const& host,
|
||||
|
||||
template<class NextLayer>
|
||||
template<class HandshakeHandler>
|
||||
auto
|
||||
stream<NextLayer>::async_handshake(boost::string_ref const& host,
|
||||
typename async_completion<
|
||||
HandshakeHandler, void(error_code)>::result_type
|
||||
stream<NextLayer>::
|
||||
async_handshake(boost::string_ref const& host,
|
||||
boost::string_ref const& resource, HandshakeHandler&& handler)
|
||||
{
|
||||
beast::async_completion<
|
||||
@@ -323,8 +331,8 @@ stream<NextLayer>::async_handshake(boost::string_ref const& host,
|
||||
|
||||
template<class NextLayer>
|
||||
void
|
||||
stream<NextLayer>::close(
|
||||
close_reason const& cr, error_code& ec)
|
||||
stream<NextLayer>::
|
||||
close(close_reason const& cr, error_code& ec)
|
||||
{
|
||||
assert(! wr_close_);
|
||||
wr_close_ = true;
|
||||
@@ -336,9 +344,10 @@ stream<NextLayer>::close(
|
||||
|
||||
template<class NextLayer>
|
||||
template<class CloseHandler>
|
||||
auto
|
||||
stream<NextLayer>::async_close(
|
||||
close_reason const& cr, CloseHandler&& handler)
|
||||
typename async_completion<
|
||||
CloseHandler, void(error_code)>::result_type
|
||||
stream<NextLayer>::
|
||||
async_close(close_reason const& cr, CloseHandler&& handler)
|
||||
{
|
||||
beast::async_completion<
|
||||
CloseHandler, void(error_code)
|
||||
@@ -368,7 +377,8 @@ read(opcode& op, Streambuf& streambuf, error_code& ec)
|
||||
|
||||
template<class NextLayer>
|
||||
template<class Streambuf, class ReadHandler>
|
||||
auto
|
||||
typename async_completion<
|
||||
ReadHandler, void(error_code)>::result_type
|
||||
stream<NextLayer>::
|
||||
async_read(opcode& op,
|
||||
Streambuf& streambuf, ReadHandler&& handler)
|
||||
@@ -386,8 +396,8 @@ async_read(opcode& op,
|
||||
template<class NextLayer>
|
||||
template<class Streambuf>
|
||||
void
|
||||
stream<NextLayer>::read_frame(frame_info& fi,
|
||||
Streambuf& streambuf, error_code& ec)
|
||||
stream<NextLayer>::
|
||||
read_frame(frame_info& fi, Streambuf& streambuf, error_code& ec)
|
||||
{
|
||||
close_code code{};
|
||||
for(;;)
|
||||
@@ -521,8 +531,10 @@ stream<NextLayer>::read_frame(frame_info& fi,
|
||||
|
||||
template<class NextLayer>
|
||||
template<class Streambuf, class ReadHandler>
|
||||
auto
|
||||
stream<NextLayer>::async_read_frame(frame_info& fi,
|
||||
typename async_completion<
|
||||
ReadHandler, void(error_code)>::result_type
|
||||
stream<NextLayer>::
|
||||
async_read_frame(frame_info& fi,
|
||||
Streambuf& streambuf, ReadHandler&& handler)
|
||||
{
|
||||
static_assert(beast::is_Streambuf<Streambuf>::value,
|
||||
@@ -537,8 +549,8 @@ stream<NextLayer>::async_read_frame(frame_info& fi,
|
||||
template<class NextLayer>
|
||||
template<class ConstBufferSequence>
|
||||
void
|
||||
stream<NextLayer>::write(
|
||||
ConstBufferSequence const& bs, error_code& ec)
|
||||
stream<NextLayer>::
|
||||
write(ConstBufferSequence const& bs, error_code& ec)
|
||||
{
|
||||
static_assert(beast::is_ConstBufferSequence<
|
||||
ConstBufferSequence>::value,
|
||||
@@ -563,9 +575,10 @@ stream<NextLayer>::write(
|
||||
|
||||
template<class NextLayer>
|
||||
template<class ConstBufferSequence, class WriteHandler>
|
||||
auto
|
||||
stream<NextLayer>::async_write(
|
||||
ConstBufferSequence const& bs, WriteHandler&& handler)
|
||||
typename async_completion<
|
||||
WriteHandler, void(error_code)>::result_type
|
||||
stream<NextLayer>::
|
||||
async_write(ConstBufferSequence const& bs, WriteHandler&& handler)
|
||||
{
|
||||
static_assert(beast::is_ConstBufferSequence<
|
||||
ConstBufferSequence>::value,
|
||||
@@ -580,8 +593,8 @@ stream<NextLayer>::async_write(
|
||||
template<class NextLayer>
|
||||
template<class ConstBufferSequence>
|
||||
void
|
||||
stream<NextLayer>::write_frame(bool fin,
|
||||
ConstBufferSequence const& bs, error_code& ec)
|
||||
stream<NextLayer>::
|
||||
write_frame(bool fin, ConstBufferSequence const& bs, error_code& ec)
|
||||
{
|
||||
static_assert(beast::is_ConstBufferSequence<
|
||||
ConstBufferSequence>::value,
|
||||
@@ -656,8 +669,10 @@ stream<NextLayer>::write_frame(bool fin,
|
||||
|
||||
template<class NextLayer>
|
||||
template<class ConstBufferSequence, class WriteHandler>
|
||||
auto
|
||||
stream<NextLayer>::async_write_frame(bool fin,
|
||||
typename async_completion<
|
||||
WriteHandler, void(error_code)>::result_type
|
||||
stream<NextLayer>::
|
||||
async_write_frame(bool fin,
|
||||
ConstBufferSequence const& bs, WriteHandler&& handler)
|
||||
{
|
||||
static_assert(beast::is_ConstBufferSequence<
|
||||
@@ -676,7 +691,8 @@ stream<NextLayer>::async_write_frame(bool fin,
|
||||
|
||||
template<class NextLayer>
|
||||
http::request<http::empty_body>
|
||||
stream<NextLayer>::build_request(boost::string_ref const& host,
|
||||
stream<NextLayer>::
|
||||
build_request(boost::string_ref const& host,
|
||||
boost::string_ref const& resource, std::string& key)
|
||||
{
|
||||
http::request<http::empty_body> req;
|
||||
@@ -696,11 +712,11 @@ stream<NextLayer>::build_request(boost::string_ref const& host,
|
||||
template<class NextLayer>
|
||||
template<class Body, class Headers>
|
||||
http::response<http::string_body>
|
||||
stream<NextLayer>::build_response(
|
||||
http::message<true, Body, Headers> const& req)
|
||||
stream<NextLayer>::
|
||||
build_response(http::message<true, Body, Headers> const& req)
|
||||
{
|
||||
auto err =
|
||||
[&](auto const& text)
|
||||
[&](std::string const& text)
|
||||
{
|
||||
http::response<http::string_body> resp(
|
||||
{400, http::reason_string(400), req.version});
|
||||
@@ -748,9 +764,9 @@ stream<NextLayer>::build_response(
|
||||
template<class NextLayer>
|
||||
template<class Body, class Headers>
|
||||
void
|
||||
stream<NextLayer>::do_response(
|
||||
http::message<false, Body, Headers> const& resp,
|
||||
boost::string_ref const& key, error_code& ec)
|
||||
stream<NextLayer>::
|
||||
do_response(http::message<false, Body, Headers> const& resp,
|
||||
boost::string_ref const& key, error_code& ec)
|
||||
{
|
||||
// VFALCO Review these error codes
|
||||
auto fail = [&]{ ec = error::response_failed; };
|
||||
@@ -771,9 +787,9 @@ stream<NextLayer>::do_response(
|
||||
|
||||
template<class NextLayer>
|
||||
void
|
||||
stream<NextLayer>::do_read_fh(
|
||||
detail::frame_streambuf& fb,
|
||||
close_code& code, error_code& ec)
|
||||
stream<NextLayer>::
|
||||
do_read_fh(detail::frame_streambuf& fb,
|
||||
close_code& code, error_code& ec)
|
||||
{
|
||||
fb.commit(boost::asio::read(
|
||||
stream_, fb.prepare(2), ec));
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
error_code ec, std::size_t, bool again = true);
|
||||
|
||||
friend
|
||||
auto asio_handler_allocate(std::size_t size,
|
||||
void* asio_handler_allocate(std::size_t size,
|
||||
teardown_tcp_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
}
|
||||
|
||||
friend
|
||||
auto asio_handler_deallocate(void* p,
|
||||
void asio_handler_deallocate(void* p,
|
||||
std::size_t size, teardown_tcp_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
@@ -77,14 +77,14 @@ public:
|
||||
}
|
||||
|
||||
friend
|
||||
auto asio_handler_is_continuation(teardown_tcp_op* op)
|
||||
bool asio_handler_is_continuation(teardown_tcp_op* op)
|
||||
{
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
friend
|
||||
auto asio_handler_invoke(Function&& f,
|
||||
void asio_handler_invoke(Function&& f,
|
||||
teardown_tcp_op* op)
|
||||
{
|
||||
return boost_asio_handler_invoke_helpers::
|
||||
@@ -160,8 +160,8 @@ async_teardown(
|
||||
static_assert(beast::is_Handler<
|
||||
TeardownHandler, void(error_code)>::value,
|
||||
"TeardownHandler requirements not met");
|
||||
detail::teardown_tcp_op<std::decay_t<
|
||||
TeardownHandler>>{std::forward<
|
||||
detail::teardown_tcp_op<typename std::decay<
|
||||
TeardownHandler>::type>{std::forward<
|
||||
TeardownHandler>(handler), socket};
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
std::size_t bytes_transferred, bool again = true);
|
||||
|
||||
friend
|
||||
auto asio_handler_allocate(
|
||||
void* asio_handler_allocate(
|
||||
std::size_t size, write_frame_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
}
|
||||
|
||||
friend
|
||||
auto asio_handler_deallocate(
|
||||
void asio_handler_deallocate(
|
||||
void* p, std::size_t size, write_frame_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
@@ -129,14 +129,14 @@ public:
|
||||
}
|
||||
|
||||
friend
|
||||
auto asio_handler_is_continuation(write_frame_op* op)
|
||||
bool asio_handler_is_continuation(write_frame_op* op)
|
||||
{
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
friend
|
||||
auto asio_handler_invoke(Function&& f, write_frame_op* op)
|
||||
void asio_handler_invoke(Function&& f, write_frame_op* op)
|
||||
{
|
||||
return boost_asio_handler_invoke_helpers::
|
||||
invoke(f, op->d_->h);
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
void operator()(error_code ec, bool again = true);
|
||||
|
||||
friend
|
||||
auto asio_handler_allocate(
|
||||
void* asio_handler_allocate(
|
||||
std::size_t size, write_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
}
|
||||
|
||||
friend
|
||||
auto asio_handler_deallocate(
|
||||
void asio_handler_deallocate(
|
||||
void* p, std::size_t size, write_op* op)
|
||||
{
|
||||
return boost_asio_handler_alloc_helpers::
|
||||
@@ -86,14 +86,14 @@ public:
|
||||
}
|
||||
|
||||
friend
|
||||
auto asio_handler_is_continuation(write_op* op)
|
||||
bool asio_handler_is_continuation(write_op* op)
|
||||
{
|
||||
return op->d_->cont;
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
friend
|
||||
auto asio_handler_invoke(Function&& f, write_op* op)
|
||||
void asio_handler_invoke(Function&& f, write_op* op)
|
||||
{
|
||||
return boost_asio_handler_invoke_helpers::
|
||||
invoke(f, op->d_->h);
|
||||
|
||||
@@ -99,12 +99,12 @@ using decorate = implementation_defined;
|
||||
#else
|
||||
template<class Decorator>
|
||||
inline
|
||||
auto
|
||||
detail::decorator_type
|
||||
decorate(Decorator&& d)
|
||||
{
|
||||
return std::make_unique<detail::decorator<
|
||||
std::decay_t<Decorator>>>(
|
||||
std::forward<Decorator>(d));
|
||||
return detail::decorator_type{new
|
||||
detail::decorator<typename std::decay<Decorator>::type>{
|
||||
std::forward<Decorator>(d)}};
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <beast/websocket/option.hpp>
|
||||
#include <beast/websocket/detail/stream_base.hpp>
|
||||
#include <beast/streambuf_readstream.hpp>
|
||||
#include <beast/async_completion.hpp>
|
||||
#include <beast/http/message.hpp>
|
||||
#include <beast/http/string_body.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
@@ -85,7 +86,7 @@ class stream : public detail::stream_base
|
||||
public:
|
||||
/// The type of the next layer.
|
||||
using next_layer_type =
|
||||
std::remove_reference_t<NextLayer>;
|
||||
typename std::remove_reference<NextLayer>::type;
|
||||
|
||||
/// The type of the lowest layer.
|
||||
using lowest_layer_type =
|
||||
@@ -365,7 +366,8 @@ public:
|
||||
manner equivalent to using boost::asio::io_service::post().
|
||||
*/
|
||||
template<class AcceptHandler>
|
||||
auto
|
||||
typename async_completion<
|
||||
AcceptHandler, void(error_code)>::result_type
|
||||
async_accept(AcceptHandler&& handler);
|
||||
|
||||
/** Read and respond to a WebSocket HTTP Upgrade request.
|
||||
@@ -465,7 +467,8 @@ public:
|
||||
manner equivalent to using boost::asio::io_service::post().
|
||||
*/
|
||||
template<class ConstBufferSequence, class AcceptHandler>
|
||||
auto
|
||||
typename async_completion<
|
||||
AcceptHandler, void(error_code)>::result_type
|
||||
async_accept(ConstBufferSequence const& buffers,
|
||||
AcceptHandler&& handler);
|
||||
|
||||
@@ -560,7 +563,8 @@ public:
|
||||
manner equivalent to using boost::asio::io_service::post().
|
||||
*/
|
||||
template<class Body, class Headers, class AcceptHandler>
|
||||
auto
|
||||
typename async_completion<
|
||||
AcceptHandler, void(error_code)>::result_type
|
||||
async_accept(http::message<true,
|
||||
Body, Headers> const& request, AcceptHandler&& handler);
|
||||
|
||||
@@ -666,7 +670,8 @@ public:
|
||||
manner equivalent to using boost::asio::io_service::post().
|
||||
*/
|
||||
template<class HandshakeHandler>
|
||||
auto
|
||||
typename async_completion<
|
||||
HandshakeHandler, void(error_code)>::result_type
|
||||
async_handshake(boost::string_ref const& host,
|
||||
boost::string_ref const& resource, HandshakeHandler&& h);
|
||||
|
||||
@@ -745,7 +750,8 @@ public:
|
||||
manner equivalent to using boost::asio::io_service::post().
|
||||
*/
|
||||
template<class CloseHandler>
|
||||
auto
|
||||
typename async_completion<
|
||||
CloseHandler, void(error_code)>::result_type
|
||||
async_close(close_reason const& cr, CloseHandler&& handler);
|
||||
|
||||
/** Read a message.
|
||||
@@ -829,7 +835,8 @@ public:
|
||||
#if GENERATING_DOCS
|
||||
void_or_deduced
|
||||
#else
|
||||
auto
|
||||
typename async_completion<
|
||||
ReadHandler, void(error_code)>::result_type
|
||||
#endif
|
||||
async_read(opcode& op,
|
||||
Streambuf& streambuf, ReadHandler&& handler);
|
||||
@@ -938,7 +945,8 @@ public:
|
||||
manner equivalent to using boost::asio::io_service::post().
|
||||
*/
|
||||
template<class Streambuf, class ReadHandler>
|
||||
auto
|
||||
typename async_completion<
|
||||
ReadHandler, void(error_code)>::result_type
|
||||
async_read_frame(frame_info& fi,
|
||||
Streambuf& streambuf, ReadHandler&& handler);
|
||||
|
||||
@@ -1041,7 +1049,8 @@ public:
|
||||
#if GENERATING_DOCS
|
||||
void_or_deduced
|
||||
#else
|
||||
auto
|
||||
typename async_completion<
|
||||
WriteHandler, void(error_code)>::result_type
|
||||
#endif
|
||||
async_write(ConstBufferSequence const& buffers,
|
||||
WriteHandler&& handler);
|
||||
@@ -1140,7 +1149,8 @@ public:
|
||||
); @endcode
|
||||
*/
|
||||
template<class ConstBufferSequence, class WriteHandler>
|
||||
auto
|
||||
typename async_completion<
|
||||
WriteHandler, void(error_code)>::result_type
|
||||
async_write_frame(bool fin,
|
||||
ConstBufferSequence const& buffers, WriteHandler&& handler);
|
||||
|
||||
@@ -1176,6 +1186,6 @@ private:
|
||||
} // websocket
|
||||
} // beast
|
||||
|
||||
#include <beast/websocket/impl/socket.ipp>
|
||||
#include <beast/websocket/impl/stream.ipp>
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user