mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 21:07:26 +02:00
Enable split Beast compilation for tests
This commit is contained in:
@ -2,6 +2,7 @@ Version 218:
|
||||
|
||||
* detect_ssl, async_detect_ssl are public interfaces
|
||||
* Add OpenSSL installation/setup instructions
|
||||
* Enable split Beast compilation for tests
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
47
Jamfile
47
Jamfile
@ -52,7 +52,7 @@ variant beast_ubasan
|
||||
path-constant TEST_MAIN : include/boost/beast/_experimental/unit_test/main.cpp ;
|
||||
|
||||
lib static_asio
|
||||
: test/asio.cpp
|
||||
: test/lib_asio.cpp
|
||||
: requirements
|
||||
[ requires
|
||||
cxx11_constexpr
|
||||
@ -61,14 +61,39 @@ lib static_asio
|
||||
cxx11_template_aliases
|
||||
cxx11_variadic_templates
|
||||
]
|
||||
<define>BOOST_ASIO_SEPARATE_COMPILATION
|
||||
<define>BOOST_ASIO_NO_DEPRECATED=1
|
||||
<define>BOOST_ASIO_DISABLE_BOOST_ARRAY=1
|
||||
<define>BOOST_ASIO_DISABLE_BOOST_BIND=1
|
||||
<define>BOOST_ASIO_DISABLE_BOOST_DATE_TIME=1
|
||||
<define>BOOST_ASIO_DISABLE_BOOST_REGEX=1
|
||||
<define>BOOST_ASIO_SEPARATE_COMPILATION
|
||||
<define>BOOST_COROUTINES_NO_DEPRECATION_WARNING=1
|
||||
<target-os>windows:<define>_WIN32_WINNT=0x0501
|
||||
<target-os>windows:<define>_WIN32_WINNT=0x0601
|
||||
<link>static
|
||||
;
|
||||
|
||||
lib static_beast
|
||||
: test/lib_beast.cpp
|
||||
: requirements
|
||||
[ requires
|
||||
cxx11_constexpr
|
||||
cxx11_decltype
|
||||
cxx11_hdr_tuple
|
||||
cxx11_template_aliases
|
||||
cxx11_variadic_templates
|
||||
]
|
||||
<define>BOOST_BEAST_SPLIT_COMPILATION
|
||||
<define>BOOST_ASIO_NO_DEPRECATED=1
|
||||
<define>BOOST_ASIO_DISABLE_BOOST_ARRAY=1
|
||||
<define>BOOST_ASIO_DISABLE_BOOST_BIND=1
|
||||
<define>BOOST_ASIO_DISABLE_BOOST_DATE_TIME=1
|
||||
<define>BOOST_ASIO_DISABLE_BOOST_REGEX=1
|
||||
<define>BOOST_COROUTINES_NO_DEPRECATION_WARNING=1
|
||||
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS=1
|
||||
<toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS=1
|
||||
<toolset>msvc:<define>_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING
|
||||
<toolset>msvc:<define>_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING
|
||||
<target-os>windows:<define>_WIN32_WINNT=0x0601
|
||||
<link>static
|
||||
;
|
||||
|
||||
@ -79,13 +104,13 @@ project /boost/beast
|
||||
<library>/boost/coroutine//boost_coroutine
|
||||
<library>/boost/filesystem//boost_filesystem
|
||||
<library>static_asio
|
||||
<library>static_beast
|
||||
<implicit-dependency>/boost//headers
|
||||
<threading>multi
|
||||
<debug-symbols>on
|
||||
<runtime-link>shared
|
||||
[ ac.check-library /boost/beast//ssl : <library>/boost/beast//ssl : <build>no ]
|
||||
<library>/boost/beast//crypto
|
||||
|
||||
<define>BOOST_ALL_NO_LIB=1
|
||||
<define>BOOST_ASIO_NO_DEPRECATED=1
|
||||
<define>BOOST_ASIO_DISABLE_BOOST_ARRAY=1
|
||||
@ -93,14 +118,10 @@ project /boost/beast
|
||||
<define>BOOST_ASIO_DISABLE_BOOST_DATE_TIME=1
|
||||
<define>BOOST_ASIO_DISABLE_BOOST_REGEX=1
|
||||
<define>BOOST_COROUTINES_NO_DEPRECATION_WARNING=1
|
||||
|
||||
# workaround for asio defect
|
||||
<define>BOOST_ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE=1
|
||||
<define>BOOST_ASIO_DISABLE_WINDOWS_STREAM_HANDLE=1
|
||||
|
||||
# VFALCO FIXME Need this for recent asio changes
|
||||
<define>BOOST_BEAST_NO_FILE_BODY_WIN32=1
|
||||
|
||||
#<define>BOOST_ASIO_SEPARATE_COMPILATION
|
||||
<define>BOOST_ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE=1
|
||||
<define>BOOST_ASIO_DISABLE_WINDOWS_STREAM_HANDLE=1
|
||||
#<define>BOOST_BEAST_SEPARATE_COMPILATION
|
||||
<toolset>msvc:<cxxflags>"/bigobj"
|
||||
<toolset>msvc-14.1:<cxxflags>"/permissive-"
|
||||
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS=1
|
||||
@ -108,7 +129,6 @@ project /boost/beast
|
||||
<toolset>msvc:<define>_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING
|
||||
<toolset>msvc:<define>_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING
|
||||
<toolset>msvc,<variant>release:<cxxflags>"/Ob2 /Oi /Ot"
|
||||
|
||||
<target-os>linux:<define>_XOPEN_SOURCE=600
|
||||
<target-os>linux:<define>_GNU_SOURCE=1
|
||||
<target-os>solaris:<define>_XOPEN_SOURCE=500
|
||||
@ -128,3 +148,4 @@ project /boost/beast
|
||||
|
||||
: usage-requirements
|
||||
;
|
||||
|
||||
|
@ -64,7 +64,15 @@
|
||||
* All asynchronous operations use Asio's
|
||||
[@boost:/doc/html/boost_asio/reference/async_initiate.html `async_initiate`]
|
||||
for efficient integration with Coroutines TS.
|
||||
* OpenSSL is now required to build tests and examples
|
||||
* '''
|
||||
⚡
|
||||
'''
|
||||
[*['faster compilation]],
|
||||
'''
|
||||
⚡
|
||||
'''
|
||||
define `BOOST_BEAST_SPLIT_COMPILATION` and include
|
||||
[@../../include/boost/beast/src.hpp src.hpp] in one of your .cpp files!
|
||||
* See the full [link beast.release_notes [*Release Notes]] for a complete list
|
||||
of changes.
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#define BOOST_BEAST_TEST_ERROR_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/error.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
@ -21,8 +22,8 @@ enum class error
|
||||
{
|
||||
/** The test stream generated a simulated testing error
|
||||
|
||||
This error is returned by the test @ref stream when it
|
||||
generates a simulated error.
|
||||
This error is returned by a @ref fail_count object
|
||||
when it generates a simulated error.
|
||||
*/
|
||||
test_failure = 1
|
||||
};
|
||||
|
@ -11,7 +11,6 @@
|
||||
#define BOOST_BEAST_TEST_FAIL_COUNT_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/error.hpp>
|
||||
#include <boost/beast/_experimental/test/error.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
@ -47,7 +46,7 @@ public:
|
||||
explicit
|
||||
fail_count(
|
||||
std::size_t n,
|
||||
error_code ev = make_error_code(error::test_failure));
|
||||
error_code ev = error::test_failure);
|
||||
|
||||
/// Throw an exception on the Nth failure
|
||||
BOOST_BEAST_DECL
|
||||
|
@ -29,26 +29,6 @@ namespace boost {
|
||||
namespace beast {
|
||||
namespace test {
|
||||
|
||||
namespace detail {
|
||||
|
||||
class error_codes : public error_category
|
||||
{
|
||||
public:
|
||||
BOOST_BEAST_DECL
|
||||
const char*
|
||||
name() const noexcept override;
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
std::string
|
||||
message(int ev) const override;
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
error_condition
|
||||
default_error_condition(int ev) const noexcept override;
|
||||
};
|
||||
|
||||
} // detail
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
error_code
|
||||
make_error_code(error e) noexcept;
|
||||
@ -57,6 +37,8 @@ make_error_code(error e) noexcept;
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#include <boost/beast/_experimental/test/impl/impl/error.hpp>
|
||||
#ifdef BOOST_BEAST_HEADER_ONLY
|
||||
#include <boost/beast/_experimental/test/impl/error.ipp>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
65
include/boost/beast/_experimental/test/impl/error.ipp
Normal file
65
include/boost/beast/_experimental/test/impl/error.ipp
Normal file
@ -0,0 +1,65 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_TEST_IMPL_ERROR_IPP
|
||||
#define BOOST_BEAST_TEST_IMPL_ERROR_IPP
|
||||
|
||||
#include <boost/beast/_experimental/test/error.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
namespace test {
|
||||
|
||||
namespace detail {
|
||||
|
||||
class error_codes : public error_category
|
||||
{
|
||||
public:
|
||||
BOOST_BEAST_DECL
|
||||
const char*
|
||||
name() const noexcept override
|
||||
{
|
||||
return "boost.beast.test";
|
||||
}
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
std::string
|
||||
message(int ev) const override
|
||||
{
|
||||
switch(static_cast<error>(ev))
|
||||
{
|
||||
default:
|
||||
case error::test_failure: return
|
||||
"An automatic unit test failure occurred";
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
error_condition
|
||||
default_error_condition(int ev) const noexcept override
|
||||
{
|
||||
return error_condition{ev, *this};
|
||||
}
|
||||
};
|
||||
|
||||
} // detail
|
||||
|
||||
error_code
|
||||
make_error_code(error e) noexcept
|
||||
{
|
||||
static detail::error_codes const cat{};
|
||||
return error_code{static_cast<
|
||||
std::underlying_type<error>::type>(e), cat};
|
||||
}
|
||||
|
||||
} // test
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#endif
|
@ -1,59 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_TEST_IMPL_IMPL_ERROR_HPP
|
||||
#define BOOST_BEAST_TEST_IMPL_IMPL_ERROR_HPP
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
namespace test {
|
||||
|
||||
namespace detail {
|
||||
|
||||
const char*
|
||||
error_codes::
|
||||
name() const noexcept
|
||||
{
|
||||
return "boost.beast.test";
|
||||
}
|
||||
|
||||
std::string
|
||||
error_codes::
|
||||
message(int ev) const
|
||||
{
|
||||
switch(static_cast<error>(ev))
|
||||
{
|
||||
default:
|
||||
case error::test_failure: return
|
||||
"The test stream generated a simulated error";
|
||||
}
|
||||
}
|
||||
|
||||
error_condition
|
||||
error_codes::
|
||||
default_error_condition(int ev) const noexcept
|
||||
{
|
||||
return error_condition{ev, *this};
|
||||
}
|
||||
|
||||
} // detail
|
||||
|
||||
error_code
|
||||
make_error_code(error e) noexcept
|
||||
{
|
||||
static detail::error_codes const cat{};
|
||||
return error_code{static_cast<
|
||||
std::underlying_type<error>::type>(e), cat};
|
||||
}
|
||||
|
||||
} // test
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#endif
|
@ -236,7 +236,7 @@ struct stream::run_write_op
|
||||
return;
|
||||
}
|
||||
|
||||
// A request to read 0 bytes from a stream is a no-op.
|
||||
// A request to write 0 bytes to a stream is a no-op.
|
||||
if(buffer_size(buffers) == 0)
|
||||
{
|
||||
net::post(
|
||||
@ -251,11 +251,12 @@ struct stream::run_write_op
|
||||
auto out = out_.lock();
|
||||
if(! out)
|
||||
{
|
||||
ec = net::error::connection_reset;
|
||||
net::post(
|
||||
in_->ioc.get_executor(),
|
||||
beast::bind_front_handler(
|
||||
std::move(h),
|
||||
net::error::connection_reset,
|
||||
ec,
|
||||
std::size_t{0}));
|
||||
return;
|
||||
}
|
||||
@ -269,209 +270,18 @@ struct stream::run_write_op
|
||||
out->b.commit(n);
|
||||
out->notify_read();
|
||||
}
|
||||
BOOST_ASSERT(! ec);
|
||||
net::post(
|
||||
in_->ioc.get_executor(),
|
||||
beast::bind_front_handler(
|
||||
std::move(h),
|
||||
error_code{},
|
||||
ec,
|
||||
n));
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
stream::
|
||||
state::
|
||||
state(
|
||||
net::io_context& ioc_,
|
||||
fail_count* fc_)
|
||||
: ioc(ioc_)
|
||||
, fc(fc_)
|
||||
{
|
||||
}
|
||||
|
||||
stream::
|
||||
state::
|
||||
~state()
|
||||
{
|
||||
// cancel outstanding read
|
||||
if(op != nullptr)
|
||||
(*op)(true);
|
||||
}
|
||||
|
||||
void
|
||||
stream::
|
||||
state::
|
||||
notify_read()
|
||||
{
|
||||
if(op)
|
||||
{
|
||||
auto op_ = std::move(op);
|
||||
op_->operator()();
|
||||
}
|
||||
else
|
||||
{
|
||||
cv.notify_all();
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
stream::
|
||||
~stream()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
stream::
|
||||
stream(stream&& other)
|
||||
{
|
||||
auto in = std::make_shared<state>(
|
||||
other.in_->ioc, other.in_->fc);
|
||||
in_ = std::move(other.in_);
|
||||
out_ = std::move(other.out_);
|
||||
other.in_ = in;
|
||||
}
|
||||
|
||||
stream&
|
||||
stream::
|
||||
operator=(stream&& other)
|
||||
{
|
||||
close();
|
||||
auto in = std::make_shared<state>(
|
||||
other.in_->ioc, other.in_->fc);
|
||||
in_ = std::move(other.in_);
|
||||
out_ = std::move(other.out_);
|
||||
other.in_ = in;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
stream::
|
||||
stream(net::io_context& ioc)
|
||||
: in_(std::make_shared<state>(ioc, nullptr))
|
||||
{
|
||||
}
|
||||
|
||||
stream::
|
||||
stream(
|
||||
net::io_context& ioc,
|
||||
fail_count& fc)
|
||||
: in_(std::make_shared<state>(ioc, &fc))
|
||||
{
|
||||
}
|
||||
|
||||
stream::
|
||||
stream(
|
||||
net::io_context& ioc,
|
||||
string_view s)
|
||||
: in_(std::make_shared<state>(ioc, nullptr))
|
||||
{
|
||||
in_->b.commit(net::buffer_copy(
|
||||
in_->b.prepare(s.size()),
|
||||
net::buffer(s.data(), s.size())));
|
||||
}
|
||||
|
||||
stream::
|
||||
stream(
|
||||
net::io_context& ioc,
|
||||
fail_count& fc,
|
||||
string_view s)
|
||||
: in_(std::make_shared<state>(ioc, &fc))
|
||||
{
|
||||
in_->b.commit(net::buffer_copy(
|
||||
in_->b.prepare(s.size()),
|
||||
net::buffer(s.data(), s.size())));
|
||||
}
|
||||
|
||||
void
|
||||
stream::
|
||||
connect(stream& remote)
|
||||
{
|
||||
BOOST_ASSERT(! out_.lock());
|
||||
BOOST_ASSERT(! remote.out_.lock());
|
||||
out_ = remote.in_;
|
||||
remote.out_ = in_;
|
||||
in_->code = status::ok;
|
||||
remote.in_->code = status::ok;
|
||||
}
|
||||
|
||||
string_view
|
||||
stream::
|
||||
str() const
|
||||
{
|
||||
auto const bs = in_->b.data();
|
||||
if(buffer_size(bs) == 0)
|
||||
return {};
|
||||
auto const b = beast::buffers_front(bs);
|
||||
return {static_cast<char const*>(b.data()), b.size()};
|
||||
}
|
||||
|
||||
void
|
||||
stream::
|
||||
append(string_view s)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock{in_->m};
|
||||
in_->b.commit(net::buffer_copy(
|
||||
in_->b.prepare(s.size()),
|
||||
net::buffer(s.data(), s.size())));
|
||||
}
|
||||
|
||||
void
|
||||
stream::
|
||||
clear()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock{in_->m};
|
||||
in_->b.consume(in_->b.size());
|
||||
}
|
||||
|
||||
void
|
||||
stream::
|
||||
close()
|
||||
{
|
||||
// cancel outstanding read
|
||||
{
|
||||
std::unique_ptr<read_op_base> op;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(in_->m);
|
||||
in_->code = status::eof;
|
||||
op = std::move(in_->op);
|
||||
}
|
||||
if(op != nullptr)
|
||||
(*op)(true);
|
||||
}
|
||||
|
||||
// disconnect
|
||||
{
|
||||
auto out = out_.lock();
|
||||
out_.reset();
|
||||
|
||||
// notify peer
|
||||
if(out)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(out->m);
|
||||
if(out->code == status::ok)
|
||||
{
|
||||
out->code = status::eof;
|
||||
out->notify_read();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
stream::
|
||||
close_remote()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock{in_->m};
|
||||
if(in_->code == status::ok)
|
||||
{
|
||||
in_->code = status::eof;
|
||||
in_->notify_read();
|
||||
}
|
||||
}
|
||||
|
||||
template<class MutableBufferSequence>
|
||||
std::size_t
|
||||
stream::
|
||||
@ -637,24 +447,7 @@ async_write_some(
|
||||
buffers);
|
||||
}
|
||||
|
||||
void
|
||||
teardown(
|
||||
websocket::role_type,
|
||||
stream& s,
|
||||
boost::system::error_code& ec)
|
||||
{
|
||||
if( s.in_->fc &&
|
||||
s.in_->fc->fail(ec))
|
||||
return;
|
||||
|
||||
s.close();
|
||||
|
||||
if( s.in_->fc &&
|
||||
s.in_->fc->fail(ec))
|
||||
ec = net::error::eof;
|
||||
else
|
||||
ec = {};
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<class TeardownHandler>
|
||||
void
|
||||
@ -683,19 +476,7 @@ async_teardown(
|
||||
std::move(handler), ec));
|
||||
}
|
||||
|
||||
stream
|
||||
connect(stream& to)
|
||||
{
|
||||
stream from{to.get_executor().context()};
|
||||
from.connect(to);
|
||||
return from;
|
||||
}
|
||||
|
||||
void
|
||||
connect(stream& s1, stream& s2)
|
||||
{
|
||||
s1.connect(s2);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<class Arg1, class... ArgN>
|
||||
stream
|
||||
@ -712,4 +493,8 @@ connect(stream& to, Arg1&& arg1, ArgN&&... argn)
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#ifdef BOOST_BEAST_HEADER_ONLY
|
||||
#include <boost/beast/_experimental/test/impl/stream.ipp>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
256
include/boost/beast/_experimental/test/impl/stream.ipp
Normal file
256
include/boost/beast/_experimental/test/impl/stream.ipp
Normal file
@ -0,0 +1,256 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_TEST_IMPL_STREAM_IPP
|
||||
#define BOOST_BEAST_TEST_IMPL_STREAM_IPP
|
||||
|
||||
#include <boost/beast/_experimental/test/stream.hpp>
|
||||
#include <boost/beast/core/bind_handler.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffers_prefix.hpp>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
namespace test {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
stream::
|
||||
state::
|
||||
state(
|
||||
net::io_context& ioc_,
|
||||
fail_count* fc_)
|
||||
: ioc(ioc_)
|
||||
, fc(fc_)
|
||||
{
|
||||
}
|
||||
|
||||
stream::
|
||||
state::
|
||||
~state()
|
||||
{
|
||||
// cancel outstanding read
|
||||
if(op != nullptr)
|
||||
(*op)(true);
|
||||
}
|
||||
|
||||
void
|
||||
stream::
|
||||
state::
|
||||
notify_read()
|
||||
{
|
||||
if(op)
|
||||
{
|
||||
auto op_ = std::move(op);
|
||||
op_->operator()();
|
||||
}
|
||||
else
|
||||
{
|
||||
cv.notify_all();
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
stream::
|
||||
~stream()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
stream::
|
||||
stream(stream&& other)
|
||||
{
|
||||
auto in = std::make_shared<state>(
|
||||
other.in_->ioc, other.in_->fc);
|
||||
in_ = std::move(other.in_);
|
||||
out_ = std::move(other.out_);
|
||||
other.in_ = in;
|
||||
}
|
||||
|
||||
stream&
|
||||
stream::
|
||||
operator=(stream&& other)
|
||||
{
|
||||
close();
|
||||
auto in = std::make_shared<state>(
|
||||
other.in_->ioc, other.in_->fc);
|
||||
in_ = std::move(other.in_);
|
||||
out_ = std::move(other.out_);
|
||||
other.in_ = in;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
stream::
|
||||
stream(net::io_context& ioc)
|
||||
: in_(std::make_shared<state>(ioc, nullptr))
|
||||
{
|
||||
}
|
||||
|
||||
stream::
|
||||
stream(
|
||||
net::io_context& ioc,
|
||||
fail_count& fc)
|
||||
: in_(std::make_shared<state>(ioc, &fc))
|
||||
{
|
||||
}
|
||||
|
||||
stream::
|
||||
stream(
|
||||
net::io_context& ioc,
|
||||
string_view s)
|
||||
: in_(std::make_shared<state>(ioc, nullptr))
|
||||
{
|
||||
in_->b.commit(net::buffer_copy(
|
||||
in_->b.prepare(s.size()),
|
||||
net::buffer(s.data(), s.size())));
|
||||
}
|
||||
|
||||
stream::
|
||||
stream(
|
||||
net::io_context& ioc,
|
||||
fail_count& fc,
|
||||
string_view s)
|
||||
: in_(std::make_shared<state>(ioc, &fc))
|
||||
{
|
||||
in_->b.commit(net::buffer_copy(
|
||||
in_->b.prepare(s.size()),
|
||||
net::buffer(s.data(), s.size())));
|
||||
}
|
||||
|
||||
void
|
||||
stream::
|
||||
connect(stream& remote)
|
||||
{
|
||||
BOOST_ASSERT(! out_.lock());
|
||||
BOOST_ASSERT(! remote.out_.lock());
|
||||
out_ = remote.in_;
|
||||
remote.out_ = in_;
|
||||
in_->code = status::ok;
|
||||
remote.in_->code = status::ok;
|
||||
}
|
||||
|
||||
string_view
|
||||
stream::
|
||||
str() const
|
||||
{
|
||||
auto const bs = in_->b.data();
|
||||
if(buffer_size(bs) == 0)
|
||||
return {};
|
||||
auto const b = beast::buffers_front(bs);
|
||||
return {static_cast<char const*>(b.data()), b.size()};
|
||||
}
|
||||
|
||||
void
|
||||
stream::
|
||||
append(string_view s)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock{in_->m};
|
||||
in_->b.commit(net::buffer_copy(
|
||||
in_->b.prepare(s.size()),
|
||||
net::buffer(s.data(), s.size())));
|
||||
}
|
||||
|
||||
void
|
||||
stream::
|
||||
clear()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock{in_->m};
|
||||
in_->b.consume(in_->b.size());
|
||||
}
|
||||
|
||||
void
|
||||
stream::
|
||||
close()
|
||||
{
|
||||
// cancel outstanding read
|
||||
{
|
||||
std::unique_ptr<read_op_base> op;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(in_->m);
|
||||
in_->code = status::eof;
|
||||
op = std::move(in_->op);
|
||||
}
|
||||
if(op != nullptr)
|
||||
(*op)(true);
|
||||
}
|
||||
|
||||
// disconnect
|
||||
{
|
||||
auto out = out_.lock();
|
||||
out_.reset();
|
||||
|
||||
// notify peer
|
||||
if(out)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(out->m);
|
||||
if(out->code == status::ok)
|
||||
{
|
||||
out->code = status::eof;
|
||||
out->notify_read();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
stream::
|
||||
close_remote()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock{in_->m};
|
||||
if(in_->code == status::ok)
|
||||
{
|
||||
in_->code = status::eof;
|
||||
in_->notify_read();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
teardown(
|
||||
websocket::role_type,
|
||||
stream& s,
|
||||
boost::system::error_code& ec)
|
||||
{
|
||||
if( s.in_->fc &&
|
||||
s.in_->fc->fail(ec))
|
||||
return;
|
||||
|
||||
s.close();
|
||||
|
||||
if( s.in_->fc &&
|
||||
s.in_->fc->fail(ec))
|
||||
ec = net::error::eof;
|
||||
else
|
||||
ec = {};
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
stream
|
||||
connect(stream& to)
|
||||
{
|
||||
stream from{to.get_executor().context()};
|
||||
from.connect(to);
|
||||
return from;
|
||||
}
|
||||
|
||||
void
|
||||
connect(stream& s1, stream& s2)
|
||||
{
|
||||
s1.connect(s2);
|
||||
}
|
||||
|
||||
} // test
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#endif
|
@ -7,35 +7,6 @@
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
/*
|
||||
Portions from http://www.adp-gmbh.ch/cpp/common/base64.html
|
||||
Copyright notice:
|
||||
|
||||
base64.cpp and base64.h
|
||||
|
||||
Copyright (C) 2004-2008 Rene Nyffenegger
|
||||
|
||||
This source code is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the author be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this source code must not be misrepresented; you must not
|
||||
claim that you wrote the original source code. If you use this source code
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original source code.
|
||||
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Rene Nyffenegger rene.nyffenegger@adp-gmbh.ch
|
||||
*/
|
||||
|
||||
#ifndef BOOST_BEAST_DETAIL_BASE64_HPP
|
||||
#define BOOST_BEAST_DETAIL_BASE64_HPP
|
||||
|
||||
@ -50,47 +21,16 @@ namespace detail {
|
||||
|
||||
namespace base64 {
|
||||
|
||||
inline
|
||||
BOOST_BEAST_DECL
|
||||
char const*
|
||||
get_alphabet()
|
||||
{
|
||||
static char constexpr tab[] = {
|
||||
"ABCDEFGHIJKLMNOP"
|
||||
"QRSTUVWXYZabcdef"
|
||||
"ghijklmnopqrstuv"
|
||||
"wxyz0123456789+/"
|
||||
};
|
||||
return &tab[0];
|
||||
}
|
||||
get_alphabet();
|
||||
|
||||
inline
|
||||
BOOST_BEAST_DECL
|
||||
signed char const*
|
||||
get_inverse()
|
||||
{
|
||||
static signed char constexpr tab[] = {
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 0-15
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 16-31
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, // 32-47
|
||||
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, // 48-63
|
||||
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 64-79
|
||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, // 80-95
|
||||
-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, // 96-111
|
||||
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, // 112-127
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 128-143
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 144-159
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 160-175
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 176-191
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 192-207
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 208-223
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 224-239
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 // 240-255
|
||||
};
|
||||
return &tab[0];
|
||||
}
|
||||
|
||||
get_inverse();
|
||||
|
||||
/// Returns max chars needed to encode a base64 string
|
||||
inline
|
||||
BOOST_BEAST_DECL
|
||||
std::size_t constexpr
|
||||
encoded_size(std::size_t n)
|
||||
{
|
||||
@ -103,7 +43,6 @@ std::size_t constexpr
|
||||
decoded_size(std::size_t n)
|
||||
{
|
||||
return n / 4 * 3; // requires n&3==0, smaller
|
||||
//return 3 * n / 4;
|
||||
}
|
||||
|
||||
/** Encode a series of octets as a padded, base64 string.
|
||||
@ -118,45 +57,9 @@ decoded_size(std::size_t n)
|
||||
@return The number of characters written to `out`. This
|
||||
will exclude any null termination.
|
||||
*/
|
||||
inline
|
||||
BOOST_BEAST_DECL
|
||||
std::size_t
|
||||
encode(void* dest, void const* src, std::size_t len)
|
||||
{
|
||||
char* out = static_cast<char*>(dest);
|
||||
char const* in = static_cast<char const*>(src);
|
||||
auto const tab = base64::get_alphabet();
|
||||
|
||||
for(auto n = len / 3; n--;)
|
||||
{
|
||||
*out++ = tab[ (in[0] & 0xfc) >> 2];
|
||||
*out++ = tab[((in[0] & 0x03) << 4) + ((in[1] & 0xf0) >> 4)];
|
||||
*out++ = tab[((in[2] & 0xc0) >> 6) + ((in[1] & 0x0f) << 2)];
|
||||
*out++ = tab[ in[2] & 0x3f];
|
||||
in += 3;
|
||||
}
|
||||
|
||||
switch(len % 3)
|
||||
{
|
||||
case 2:
|
||||
*out++ = tab[ (in[0] & 0xfc) >> 2];
|
||||
*out++ = tab[((in[0] & 0x03) << 4) + ((in[1] & 0xf0) >> 4)];
|
||||
*out++ = tab[ (in[1] & 0x0f) << 2];
|
||||
*out++ = '=';
|
||||
break;
|
||||
|
||||
case 1:
|
||||
*out++ = tab[ (in[0] & 0xfc) >> 2];
|
||||
*out++ = tab[((in[0] & 0x03) << 4)];
|
||||
*out++ = '=';
|
||||
*out++ = '=';
|
||||
break;
|
||||
|
||||
case 0:
|
||||
break;
|
||||
}
|
||||
|
||||
return out - static_cast<char*>(dest);
|
||||
}
|
||||
encode(void* dest, void const* src, std::size_t len);
|
||||
|
||||
/** Decode a padded base64 string into a series of octets.
|
||||
|
||||
@ -169,72 +72,19 @@ encode(void* dest, void const* src, std::size_t len)
|
||||
the number of characters read from the input string,
|
||||
expressed as a pair.
|
||||
*/
|
||||
inline
|
||||
BOOST_BEAST_DECL
|
||||
std::pair<std::size_t, std::size_t>
|
||||
decode(void* dest, char const* src, std::size_t len)
|
||||
{
|
||||
char* out = static_cast<char*>(dest);
|
||||
auto in = reinterpret_cast<unsigned char const*>(src);
|
||||
unsigned char c3[3], c4[4];
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
|
||||
auto const inverse = base64::get_inverse();
|
||||
|
||||
while(len-- && *in != '=')
|
||||
{
|
||||
auto const v = inverse[*in];
|
||||
if(v == -1)
|
||||
break;
|
||||
++in;
|
||||
c4[i] = v;
|
||||
if(++i == 4)
|
||||
{
|
||||
c3[0] = (c4[0] << 2) + ((c4[1] & 0x30) >> 4);
|
||||
c3[1] = ((c4[1] & 0xf) << 4) + ((c4[2] & 0x3c) >> 2);
|
||||
c3[2] = ((c4[2] & 0x3) << 6) + c4[3];
|
||||
|
||||
for(i = 0; i < 3; i++)
|
||||
*out++ = c3[i];
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(i)
|
||||
{
|
||||
c3[0] = ( c4[0] << 2) + ((c4[1] & 0x30) >> 4);
|
||||
c3[1] = ((c4[1] & 0xf) << 4) + ((c4[2] & 0x3c) >> 2);
|
||||
c3[2] = ((c4[2] & 0x3) << 6) + c4[3];
|
||||
|
||||
for(j = 0; j < i - 1; j++)
|
||||
*out++ = c3[j];
|
||||
}
|
||||
|
||||
return {out - static_cast<char*>(dest),
|
||||
in - reinterpret_cast<unsigned char const*>(src)};
|
||||
}
|
||||
decode(void* dest, char const* src, std::size_t len);
|
||||
|
||||
} // base64
|
||||
|
||||
inline
|
||||
BOOST_BEAST_DECL
|
||||
std::string
|
||||
base64_encode(
|
||||
std::uint8_t const* data,
|
||||
std::size_t len)
|
||||
{
|
||||
std::string dest;
|
||||
dest.resize(base64::encoded_size(len));
|
||||
dest.resize(base64::encode(&dest[0], data, len));
|
||||
return dest;
|
||||
}
|
||||
base64_encode(std::uint8_t const* data, std::size_t len);
|
||||
|
||||
inline
|
||||
BOOST_BEAST_DECL
|
||||
std::string
|
||||
base64_encode(string_view s)
|
||||
{
|
||||
return base64_encode (reinterpret_cast <
|
||||
std::uint8_t const*> (s.data()), s.size());
|
||||
}
|
||||
base64_encode(string_view s);
|
||||
|
||||
template<class = void>
|
||||
std::string
|
||||
@ -252,4 +102,8 @@ base64_decode(string_view data)
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#ifdef BOOST_BEAST_HEADER_ONLY
|
||||
#include <boost/beast/core/detail/base64.ipp>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
220
include/boost/beast/core/detail/base64.ipp
Normal file
220
include/boost/beast/core/detail/base64.ipp
Normal file
@ -0,0 +1,220 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
/*
|
||||
Portions from http://www.adp-gmbh.ch/cpp/common/base64.html
|
||||
Copyright notice:
|
||||
|
||||
base64.cpp and base64.h
|
||||
|
||||
Copyright (C) 2004-2008 Rene Nyffenegger
|
||||
|
||||
This source code is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the author be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this source code must not be misrepresented; you must not
|
||||
claim that you wrote the original source code. If you use this source code
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original source code.
|
||||
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Rene Nyffenegger rene.nyffenegger@adp-gmbh.ch
|
||||
*/
|
||||
|
||||
#ifndef BOOST_BEAST_DETAIL_BASE64_IPP
|
||||
#define BOOST_BEAST_DETAIL_BASE64_IPP
|
||||
|
||||
#include <boost/beast/core/detail/base64.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
#include <cctype>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
namespace base64 {
|
||||
|
||||
char const*
|
||||
get_alphabet()
|
||||
{
|
||||
static char constexpr tab[] = {
|
||||
"ABCDEFGHIJKLMNOP"
|
||||
"QRSTUVWXYZabcdef"
|
||||
"ghijklmnopqrstuv"
|
||||
"wxyz0123456789+/"
|
||||
};
|
||||
return &tab[0];
|
||||
}
|
||||
|
||||
signed char const*
|
||||
get_inverse()
|
||||
{
|
||||
static signed char constexpr tab[] = {
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 0-15
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 16-31
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, // 32-47
|
||||
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, // 48-63
|
||||
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 64-79
|
||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, // 80-95
|
||||
-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, // 96-111
|
||||
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, // 112-127
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 128-143
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 144-159
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 160-175
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 176-191
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 192-207
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 208-223
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 224-239
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 // 240-255
|
||||
};
|
||||
return &tab[0];
|
||||
}
|
||||
|
||||
/** Encode a series of octets as a padded, base64 string.
|
||||
|
||||
The resulting string will not be null terminated.
|
||||
|
||||
@par Requires
|
||||
|
||||
The memory pointed to by `out` points to valid memory
|
||||
of at least `encoded_size(len)` bytes.
|
||||
|
||||
@return The number of characters written to `out`. This
|
||||
will exclude any null termination.
|
||||
*/
|
||||
std::size_t
|
||||
encode(void* dest, void const* src, std::size_t len)
|
||||
{
|
||||
char* out = static_cast<char*>(dest);
|
||||
char const* in = static_cast<char const*>(src);
|
||||
auto const tab = base64::get_alphabet();
|
||||
|
||||
for(auto n = len / 3; n--;)
|
||||
{
|
||||
*out++ = tab[ (in[0] & 0xfc) >> 2];
|
||||
*out++ = tab[((in[0] & 0x03) << 4) + ((in[1] & 0xf0) >> 4)];
|
||||
*out++ = tab[((in[2] & 0xc0) >> 6) + ((in[1] & 0x0f) << 2)];
|
||||
*out++ = tab[ in[2] & 0x3f];
|
||||
in += 3;
|
||||
}
|
||||
|
||||
switch(len % 3)
|
||||
{
|
||||
case 2:
|
||||
*out++ = tab[ (in[0] & 0xfc) >> 2];
|
||||
*out++ = tab[((in[0] & 0x03) << 4) + ((in[1] & 0xf0) >> 4)];
|
||||
*out++ = tab[ (in[1] & 0x0f) << 2];
|
||||
*out++ = '=';
|
||||
break;
|
||||
|
||||
case 1:
|
||||
*out++ = tab[ (in[0] & 0xfc) >> 2];
|
||||
*out++ = tab[((in[0] & 0x03) << 4)];
|
||||
*out++ = '=';
|
||||
*out++ = '=';
|
||||
break;
|
||||
|
||||
case 0:
|
||||
break;
|
||||
}
|
||||
|
||||
return out - static_cast<char*>(dest);
|
||||
}
|
||||
|
||||
/** Decode a padded base64 string into a series of octets.
|
||||
|
||||
@par Requires
|
||||
|
||||
The memory pointed to by `out` points to valid memory
|
||||
of at least `decoded_size(len)` bytes.
|
||||
|
||||
@return The number of octets written to `out`, and
|
||||
the number of characters read from the input string,
|
||||
expressed as a pair.
|
||||
*/
|
||||
std::pair<std::size_t, std::size_t>
|
||||
decode(void* dest, char const* src, std::size_t len)
|
||||
{
|
||||
char* out = static_cast<char*>(dest);
|
||||
auto in = reinterpret_cast<unsigned char const*>(src);
|
||||
unsigned char c3[3], c4[4];
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
|
||||
auto const inverse = base64::get_inverse();
|
||||
|
||||
while(len-- && *in != '=')
|
||||
{
|
||||
auto const v = inverse[*in];
|
||||
if(v == -1)
|
||||
break;
|
||||
++in;
|
||||
c4[i] = v;
|
||||
if(++i == 4)
|
||||
{
|
||||
c3[0] = (c4[0] << 2) + ((c4[1] & 0x30) >> 4);
|
||||
c3[1] = ((c4[1] & 0xf) << 4) + ((c4[2] & 0x3c) >> 2);
|
||||
c3[2] = ((c4[2] & 0x3) << 6) + c4[3];
|
||||
|
||||
for(i = 0; i < 3; i++)
|
||||
*out++ = c3[i];
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(i)
|
||||
{
|
||||
c3[0] = ( c4[0] << 2) + ((c4[1] & 0x30) >> 4);
|
||||
c3[1] = ((c4[1] & 0xf) << 4) + ((c4[2] & 0x3c) >> 2);
|
||||
c3[2] = ((c4[2] & 0x3) << 6) + c4[3];
|
||||
|
||||
for(j = 0; j < i - 1; j++)
|
||||
*out++ = c3[j];
|
||||
}
|
||||
|
||||
return {out - static_cast<char*>(dest),
|
||||
in - reinterpret_cast<unsigned char const*>(src)};
|
||||
}
|
||||
|
||||
} // base64
|
||||
|
||||
std::string
|
||||
base64_encode(
|
||||
std::uint8_t const* data,
|
||||
std::size_t len)
|
||||
{
|
||||
std::string dest;
|
||||
dest.resize(base64::encoded_size(len));
|
||||
dest.resize(base64::encode(&dest[0], data, len));
|
||||
return dest;
|
||||
}
|
||||
|
||||
std::string
|
||||
base64_encode(string_view s)
|
||||
{
|
||||
return base64_encode (reinterpret_cast <
|
||||
std::uint8_t const*> (s.data()), s.size());
|
||||
}
|
||||
|
||||
} // detail
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#endif
|
@ -67,12 +67,6 @@ namespace net = boost::asio;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if BOOST_BEAST_DOXYGEN
|
||||
# define BOOST_BEAST_DECL
|
||||
#else
|
||||
# define BOOST_BEAST_DECL inline
|
||||
#endif
|
||||
|
||||
#define BOOST_BEAST_INLINE_VARIABLE(name, type) \
|
||||
namespace \
|
||||
{ \
|
||||
@ -80,4 +74,20 @@ namespace net = boost::asio;
|
||||
::boost::beast::detail::static_const<type>::value; \
|
||||
}
|
||||
|
||||
// Default to a header-only implementation. The user must specifically
|
||||
// request separate compilation by defining BOOST_BEAST_SPLIT_COMPILATION
|
||||
#ifndef BOOST_BEAST_HEADER_ONLY
|
||||
# ifndef BOOST_BEAST_SPLIT_COMPILATION
|
||||
# define BOOST_BEAST_HEADER_ONLY 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if BOOST_BEAST_DOXYGEN
|
||||
# define BOOST_BEAST_DECL
|
||||
#elif defined(BOOST_BEAST_HEADER_ONLY)
|
||||
# define BOOST_BEAST_DECL inline
|
||||
#else
|
||||
# define BOOST_BEAST_DECL
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -10,6 +10,8 @@
|
||||
#ifndef BOOST_BEAST_DETAIL_SHA1_HPP
|
||||
#define BOOST_BEAST_DETAIL_SHA1_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
@ -34,189 +36,6 @@ static std::size_t constexpr BLOCK_INTS = 16;
|
||||
static std::size_t constexpr BLOCK_BYTES = 64;
|
||||
static std::size_t constexpr DIGEST_BYTES = 20;
|
||||
|
||||
inline
|
||||
std::uint32_t
|
||||
rol(std::uint32_t value, std::size_t bits)
|
||||
{
|
||||
return (value << bits) | (value >> (32 - bits));
|
||||
}
|
||||
|
||||
inline
|
||||
std::uint32_t
|
||||
blk(std::uint32_t block[BLOCK_INTS], std::size_t i)
|
||||
{
|
||||
return rol(
|
||||
block[(i+13)&15] ^ block[(i+8)&15] ^
|
||||
block[(i+2)&15] ^ block[i], 1);
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
R0(std::uint32_t block[BLOCK_INTS], std::uint32_t v,
|
||||
std::uint32_t &w, std::uint32_t x, std::uint32_t y,
|
||||
std::uint32_t &z, std::size_t i)
|
||||
{
|
||||
z += ((w&(x^y))^y) + block[i] + 0x5a827999 + rol(v, 5);
|
||||
w = rol(w, 30);
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void
|
||||
R1(std::uint32_t block[BLOCK_INTS], std::uint32_t v,
|
||||
std::uint32_t &w, std::uint32_t x, std::uint32_t y,
|
||||
std::uint32_t &z, std::size_t i)
|
||||
{
|
||||
block[i] = blk(block, i);
|
||||
z += ((w&(x^y))^y) + block[i] + 0x5a827999 + rol(v, 5);
|
||||
w = rol(w, 30);
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
R2(std::uint32_t block[BLOCK_INTS], std::uint32_t v,
|
||||
std::uint32_t &w, std::uint32_t x, std::uint32_t y,
|
||||
std::uint32_t &z, std::size_t i)
|
||||
{
|
||||
block[i] = blk(block, i);
|
||||
z += (w^x^y) + block[i] + 0x6ed9eba1 + rol(v, 5);
|
||||
w = rol(w, 30);
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
R3(std::uint32_t block[BLOCK_INTS], std::uint32_t v,
|
||||
std::uint32_t &w, std::uint32_t x, std::uint32_t y,
|
||||
std::uint32_t &z, std::size_t i)
|
||||
{
|
||||
block[i] = blk(block, i);
|
||||
z += (((w|x)&y)|(w&x)) + block[i] + 0x8f1bbcdc + rol(v, 5);
|
||||
w = rol(w, 30);
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
R4(std::uint32_t block[BLOCK_INTS], std::uint32_t v,
|
||||
std::uint32_t &w, std::uint32_t x, std::uint32_t y,
|
||||
std::uint32_t &z, std::size_t i)
|
||||
{
|
||||
block[i] = blk(block, i);
|
||||
z += (w^x^y) + block[i] + 0xca62c1d6 + rol(v, 5);
|
||||
w = rol(w, 30);
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
make_block(std::uint8_t const* p,
|
||||
std::uint32_t block[BLOCK_INTS])
|
||||
{
|
||||
for(std::size_t i = 0; i < BLOCK_INTS; i++)
|
||||
block[i] =
|
||||
(static_cast<std::uint32_t>(p[4*i+3])) |
|
||||
(static_cast<std::uint32_t>(p[4*i+2]))<< 8 |
|
||||
(static_cast<std::uint32_t>(p[4*i+1]))<<16 |
|
||||
(static_cast<std::uint32_t>(p[4*i+0]))<<24;
|
||||
}
|
||||
|
||||
template<class = void>
|
||||
void
|
||||
transform(
|
||||
std::uint32_t digest[], std::uint32_t block[BLOCK_INTS])
|
||||
{
|
||||
std::uint32_t a = digest[0];
|
||||
std::uint32_t b = digest[1];
|
||||
std::uint32_t c = digest[2];
|
||||
std::uint32_t d = digest[3];
|
||||
std::uint32_t e = digest[4];
|
||||
|
||||
R0(block, a, b, c, d, e, 0);
|
||||
R0(block, e, a, b, c, d, 1);
|
||||
R0(block, d, e, a, b, c, 2);
|
||||
R0(block, c, d, e, a, b, 3);
|
||||
R0(block, b, c, d, e, a, 4);
|
||||
R0(block, a, b, c, d, e, 5);
|
||||
R0(block, e, a, b, c, d, 6);
|
||||
R0(block, d, e, a, b, c, 7);
|
||||
R0(block, c, d, e, a, b, 8);
|
||||
R0(block, b, c, d, e, a, 9);
|
||||
R0(block, a, b, c, d, e, 10);
|
||||
R0(block, e, a, b, c, d, 11);
|
||||
R0(block, d, e, a, b, c, 12);
|
||||
R0(block, c, d, e, a, b, 13);
|
||||
R0(block, b, c, d, e, a, 14);
|
||||
R0(block, a, b, c, d, e, 15);
|
||||
R1(block, e, a, b, c, d, 0);
|
||||
R1(block, d, e, a, b, c, 1);
|
||||
R1(block, c, d, e, a, b, 2);
|
||||
R1(block, b, c, d, e, a, 3);
|
||||
R2(block, a, b, c, d, e, 4);
|
||||
R2(block, e, a, b, c, d, 5);
|
||||
R2(block, d, e, a, b, c, 6);
|
||||
R2(block, c, d, e, a, b, 7);
|
||||
R2(block, b, c, d, e, a, 8);
|
||||
R2(block, a, b, c, d, e, 9);
|
||||
R2(block, e, a, b, c, d, 10);
|
||||
R2(block, d, e, a, b, c, 11);
|
||||
R2(block, c, d, e, a, b, 12);
|
||||
R2(block, b, c, d, e, a, 13);
|
||||
R2(block, a, b, c, d, e, 14);
|
||||
R2(block, e, a, b, c, d, 15);
|
||||
R2(block, d, e, a, b, c, 0);
|
||||
R2(block, c, d, e, a, b, 1);
|
||||
R2(block, b, c, d, e, a, 2);
|
||||
R2(block, a, b, c, d, e, 3);
|
||||
R2(block, e, a, b, c, d, 4);
|
||||
R2(block, d, e, a, b, c, 5);
|
||||
R2(block, c, d, e, a, b, 6);
|
||||
R2(block, b, c, d, e, a, 7);
|
||||
R3(block, a, b, c, d, e, 8);
|
||||
R3(block, e, a, b, c, d, 9);
|
||||
R3(block, d, e, a, b, c, 10);
|
||||
R3(block, c, d, e, a, b, 11);
|
||||
R3(block, b, c, d, e, a, 12);
|
||||
R3(block, a, b, c, d, e, 13);
|
||||
R3(block, e, a, b, c, d, 14);
|
||||
R3(block, d, e, a, b, c, 15);
|
||||
R3(block, c, d, e, a, b, 0);
|
||||
R3(block, b, c, d, e, a, 1);
|
||||
R3(block, a, b, c, d, e, 2);
|
||||
R3(block, e, a, b, c, d, 3);
|
||||
R3(block, d, e, a, b, c, 4);
|
||||
R3(block, c, d, e, a, b, 5);
|
||||
R3(block, b, c, d, e, a, 6);
|
||||
R3(block, a, b, c, d, e, 7);
|
||||
R3(block, e, a, b, c, d, 8);
|
||||
R3(block, d, e, a, b, c, 9);
|
||||
R3(block, c, d, e, a, b, 10);
|
||||
R3(block, b, c, d, e, a, 11);
|
||||
R4(block, a, b, c, d, e, 12);
|
||||
R4(block, e, a, b, c, d, 13);
|
||||
R4(block, d, e, a, b, c, 14);
|
||||
R4(block, c, d, e, a, b, 15);
|
||||
R4(block, b, c, d, e, a, 0);
|
||||
R4(block, a, b, c, d, e, 1);
|
||||
R4(block, e, a, b, c, d, 2);
|
||||
R4(block, d, e, a, b, c, 3);
|
||||
R4(block, c, d, e, a, b, 4);
|
||||
R4(block, b, c, d, e, a, 5);
|
||||
R4(block, a, b, c, d, e, 6);
|
||||
R4(block, e, a, b, c, d, 7);
|
||||
R4(block, d, e, a, b, c, 8);
|
||||
R4(block, c, d, e, a, b, 9);
|
||||
R4(block, b, c, d, e, a, 10);
|
||||
R4(block, a, b, c, d, e, 11);
|
||||
R4(block, e, a, b, c, d, 12);
|
||||
R4(block, d, e, a, b, c, 13);
|
||||
R4(block, c, d, e, a, b, 14);
|
||||
R4(block, b, c, d, e, a, 15);
|
||||
|
||||
digest[0] += a;
|
||||
digest[1] += b;
|
||||
digest[2] += c;
|
||||
digest[3] += d;
|
||||
digest[4] += e;
|
||||
}
|
||||
|
||||
} // sha1
|
||||
|
||||
struct sha1_context
|
||||
@ -230,84 +49,29 @@ struct sha1_context
|
||||
std::uint8_t buf[block_size];
|
||||
};
|
||||
|
||||
template<class = void>
|
||||
BOOST_BEAST_DECL
|
||||
void
|
||||
init(sha1_context& ctx) noexcept
|
||||
{
|
||||
ctx.buflen = 0;
|
||||
ctx.blocks = 0;
|
||||
ctx.digest[0] = 0x67452301;
|
||||
ctx.digest[1] = 0xefcdab89;
|
||||
ctx.digest[2] = 0x98badcfe;
|
||||
ctx.digest[3] = 0x10325476;
|
||||
ctx.digest[4] = 0xc3d2e1f0;
|
||||
}
|
||||
init(sha1_context& ctx) noexcept;
|
||||
|
||||
template<class = void>
|
||||
BOOST_BEAST_DECL
|
||||
void
|
||||
update(sha1_context& ctx,
|
||||
void const* message, std::size_t size) noexcept
|
||||
{
|
||||
auto p = static_cast<
|
||||
std::uint8_t const*>(message);
|
||||
for(;;)
|
||||
{
|
||||
auto const n = (std::min)(
|
||||
size, sizeof(ctx.buf) - ctx.buflen);
|
||||
std::memcpy(ctx.buf + ctx.buflen, p, n);
|
||||
ctx.buflen += n;
|
||||
if(ctx.buflen != 64)
|
||||
return;
|
||||
p += n;
|
||||
size -= n;
|
||||
ctx.buflen = 0;
|
||||
std::uint32_t block[sha1::BLOCK_INTS];
|
||||
sha1::make_block(ctx.buf, block);
|
||||
sha1::transform(ctx.digest, block);
|
||||
++ctx.blocks;
|
||||
}
|
||||
}
|
||||
update(
|
||||
sha1_context& ctx,
|
||||
void const* message,
|
||||
std::size_t size) noexcept;
|
||||
|
||||
template<class = void>
|
||||
BOOST_BEAST_DECL
|
||||
void
|
||||
finish(sha1_context& ctx, void* digest) noexcept
|
||||
{
|
||||
using sha1::BLOCK_INTS;
|
||||
using sha1::BLOCK_BYTES;
|
||||
|
||||
std::uint64_t total_bits =
|
||||
(ctx.blocks*64 + ctx.buflen) * 8;
|
||||
// pad
|
||||
ctx.buf[ctx.buflen++] = 0x80;
|
||||
auto const buflen = ctx.buflen;
|
||||
while(ctx.buflen < 64)
|
||||
ctx.buf[ctx.buflen++] = 0x00;
|
||||
std::uint32_t block[BLOCK_INTS];
|
||||
sha1::make_block(ctx.buf, block);
|
||||
if(buflen > BLOCK_BYTES - 8)
|
||||
{
|
||||
sha1::transform(ctx.digest, block);
|
||||
for(size_t i = 0; i < BLOCK_INTS - 2; i++)
|
||||
block[i] = 0;
|
||||
}
|
||||
|
||||
/* Append total_bits, split this uint64_t into two uint32_t */
|
||||
block[BLOCK_INTS - 1] = total_bits & 0xffffffff;
|
||||
block[BLOCK_INTS - 2] = (total_bits >> 32);
|
||||
sha1::transform(ctx.digest, block);
|
||||
for(std::size_t i = 0; i < sha1::DIGEST_BYTES/4; i++)
|
||||
{
|
||||
std::uint8_t* d =
|
||||
static_cast<std::uint8_t*>(digest) + 4 * i;
|
||||
d[3] = ctx.digest[i] & 0xff;
|
||||
d[2] = (ctx.digest[i] >> 8) & 0xff;
|
||||
d[1] = (ctx.digest[i] >> 16) & 0xff;
|
||||
d[0] = (ctx.digest[i] >> 24) & 0xff;
|
||||
}
|
||||
}
|
||||
finish(
|
||||
sha1_context& ctx,
|
||||
void* digest) noexcept;
|
||||
|
||||
} // detail
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#ifdef BOOST_BEAST_HEADER_ONLY
|
||||
#include <boost/beast/core/detail/sha1.ipp>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
301
include/boost/beast/core/detail/sha1.ipp
Normal file
301
include/boost/beast/core/detail/sha1.ipp
Normal file
@ -0,0 +1,301 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_DETAIL_SHA1_IPP
|
||||
#define BOOST_BEAST_DETAIL_SHA1_IPP
|
||||
|
||||
#include <boost/beast/core/detail/sha1.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
|
||||
// Based on https://github.com/vog/sha1
|
||||
/*
|
||||
Original authors:
|
||||
Steve Reid (Original C Code)
|
||||
Bruce Guenter (Small changes to fit into bglibs)
|
||||
Volker Grabsch (Translation to simpler C++ Code)
|
||||
Eugene Hopkinson (Safety improvements)
|
||||
Vincent Falco (beast adaptation)
|
||||
*/
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
namespace sha1 {
|
||||
|
||||
inline
|
||||
std::uint32_t
|
||||
rol(std::uint32_t value, std::size_t bits)
|
||||
{
|
||||
return (value << bits) | (value >> (32 - bits));
|
||||
}
|
||||
|
||||
inline
|
||||
std::uint32_t
|
||||
blk(std::uint32_t block[BLOCK_INTS], std::size_t i)
|
||||
{
|
||||
return rol(
|
||||
block[(i+13)&15] ^ block[(i+8)&15] ^
|
||||
block[(i+2)&15] ^ block[i], 1);
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
R0(std::uint32_t block[BLOCK_INTS], std::uint32_t v,
|
||||
std::uint32_t &w, std::uint32_t x, std::uint32_t y,
|
||||
std::uint32_t &z, std::size_t i)
|
||||
{
|
||||
z += ((w&(x^y))^y) + block[i] + 0x5a827999 + rol(v, 5);
|
||||
w = rol(w, 30);
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void
|
||||
R1(std::uint32_t block[BLOCK_INTS], std::uint32_t v,
|
||||
std::uint32_t &w, std::uint32_t x, std::uint32_t y,
|
||||
std::uint32_t &z, std::size_t i)
|
||||
{
|
||||
block[i] = blk(block, i);
|
||||
z += ((w&(x^y))^y) + block[i] + 0x5a827999 + rol(v, 5);
|
||||
w = rol(w, 30);
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
R2(std::uint32_t block[BLOCK_INTS], std::uint32_t v,
|
||||
std::uint32_t &w, std::uint32_t x, std::uint32_t y,
|
||||
std::uint32_t &z, std::size_t i)
|
||||
{
|
||||
block[i] = blk(block, i);
|
||||
z += (w^x^y) + block[i] + 0x6ed9eba1 + rol(v, 5);
|
||||
w = rol(w, 30);
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
R3(std::uint32_t block[BLOCK_INTS], std::uint32_t v,
|
||||
std::uint32_t &w, std::uint32_t x, std::uint32_t y,
|
||||
std::uint32_t &z, std::size_t i)
|
||||
{
|
||||
block[i] = blk(block, i);
|
||||
z += (((w|x)&y)|(w&x)) + block[i] + 0x8f1bbcdc + rol(v, 5);
|
||||
w = rol(w, 30);
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
R4(std::uint32_t block[BLOCK_INTS], std::uint32_t v,
|
||||
std::uint32_t &w, std::uint32_t x, std::uint32_t y,
|
||||
std::uint32_t &z, std::size_t i)
|
||||
{
|
||||
block[i] = blk(block, i);
|
||||
z += (w^x^y) + block[i] + 0xca62c1d6 + rol(v, 5);
|
||||
w = rol(w, 30);
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
make_block(std::uint8_t const* p,
|
||||
std::uint32_t block[BLOCK_INTS])
|
||||
{
|
||||
for(std::size_t i = 0; i < BLOCK_INTS; i++)
|
||||
block[i] =
|
||||
(static_cast<std::uint32_t>(p[4*i+3])) |
|
||||
(static_cast<std::uint32_t>(p[4*i+2]))<< 8 |
|
||||
(static_cast<std::uint32_t>(p[4*i+1]))<<16 |
|
||||
(static_cast<std::uint32_t>(p[4*i+0]))<<24;
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
transform(
|
||||
std::uint32_t digest[], std::uint32_t block[BLOCK_INTS])
|
||||
{
|
||||
std::uint32_t a = digest[0];
|
||||
std::uint32_t b = digest[1];
|
||||
std::uint32_t c = digest[2];
|
||||
std::uint32_t d = digest[3];
|
||||
std::uint32_t e = digest[4];
|
||||
|
||||
R0(block, a, b, c, d, e, 0);
|
||||
R0(block, e, a, b, c, d, 1);
|
||||
R0(block, d, e, a, b, c, 2);
|
||||
R0(block, c, d, e, a, b, 3);
|
||||
R0(block, b, c, d, e, a, 4);
|
||||
R0(block, a, b, c, d, e, 5);
|
||||
R0(block, e, a, b, c, d, 6);
|
||||
R0(block, d, e, a, b, c, 7);
|
||||
R0(block, c, d, e, a, b, 8);
|
||||
R0(block, b, c, d, e, a, 9);
|
||||
R0(block, a, b, c, d, e, 10);
|
||||
R0(block, e, a, b, c, d, 11);
|
||||
R0(block, d, e, a, b, c, 12);
|
||||
R0(block, c, d, e, a, b, 13);
|
||||
R0(block, b, c, d, e, a, 14);
|
||||
R0(block, a, b, c, d, e, 15);
|
||||
R1(block, e, a, b, c, d, 0);
|
||||
R1(block, d, e, a, b, c, 1);
|
||||
R1(block, c, d, e, a, b, 2);
|
||||
R1(block, b, c, d, e, a, 3);
|
||||
R2(block, a, b, c, d, e, 4);
|
||||
R2(block, e, a, b, c, d, 5);
|
||||
R2(block, d, e, a, b, c, 6);
|
||||
R2(block, c, d, e, a, b, 7);
|
||||
R2(block, b, c, d, e, a, 8);
|
||||
R2(block, a, b, c, d, e, 9);
|
||||
R2(block, e, a, b, c, d, 10);
|
||||
R2(block, d, e, a, b, c, 11);
|
||||
R2(block, c, d, e, a, b, 12);
|
||||
R2(block, b, c, d, e, a, 13);
|
||||
R2(block, a, b, c, d, e, 14);
|
||||
R2(block, e, a, b, c, d, 15);
|
||||
R2(block, d, e, a, b, c, 0);
|
||||
R2(block, c, d, e, a, b, 1);
|
||||
R2(block, b, c, d, e, a, 2);
|
||||
R2(block, a, b, c, d, e, 3);
|
||||
R2(block, e, a, b, c, d, 4);
|
||||
R2(block, d, e, a, b, c, 5);
|
||||
R2(block, c, d, e, a, b, 6);
|
||||
R2(block, b, c, d, e, a, 7);
|
||||
R3(block, a, b, c, d, e, 8);
|
||||
R3(block, e, a, b, c, d, 9);
|
||||
R3(block, d, e, a, b, c, 10);
|
||||
R3(block, c, d, e, a, b, 11);
|
||||
R3(block, b, c, d, e, a, 12);
|
||||
R3(block, a, b, c, d, e, 13);
|
||||
R3(block, e, a, b, c, d, 14);
|
||||
R3(block, d, e, a, b, c, 15);
|
||||
R3(block, c, d, e, a, b, 0);
|
||||
R3(block, b, c, d, e, a, 1);
|
||||
R3(block, a, b, c, d, e, 2);
|
||||
R3(block, e, a, b, c, d, 3);
|
||||
R3(block, d, e, a, b, c, 4);
|
||||
R3(block, c, d, e, a, b, 5);
|
||||
R3(block, b, c, d, e, a, 6);
|
||||
R3(block, a, b, c, d, e, 7);
|
||||
R3(block, e, a, b, c, d, 8);
|
||||
R3(block, d, e, a, b, c, 9);
|
||||
R3(block, c, d, e, a, b, 10);
|
||||
R3(block, b, c, d, e, a, 11);
|
||||
R4(block, a, b, c, d, e, 12);
|
||||
R4(block, e, a, b, c, d, 13);
|
||||
R4(block, d, e, a, b, c, 14);
|
||||
R4(block, c, d, e, a, b, 15);
|
||||
R4(block, b, c, d, e, a, 0);
|
||||
R4(block, a, b, c, d, e, 1);
|
||||
R4(block, e, a, b, c, d, 2);
|
||||
R4(block, d, e, a, b, c, 3);
|
||||
R4(block, c, d, e, a, b, 4);
|
||||
R4(block, b, c, d, e, a, 5);
|
||||
R4(block, a, b, c, d, e, 6);
|
||||
R4(block, e, a, b, c, d, 7);
|
||||
R4(block, d, e, a, b, c, 8);
|
||||
R4(block, c, d, e, a, b, 9);
|
||||
R4(block, b, c, d, e, a, 10);
|
||||
R4(block, a, b, c, d, e, 11);
|
||||
R4(block, e, a, b, c, d, 12);
|
||||
R4(block, d, e, a, b, c, 13);
|
||||
R4(block, c, d, e, a, b, 14);
|
||||
R4(block, b, c, d, e, a, 15);
|
||||
|
||||
digest[0] += a;
|
||||
digest[1] += b;
|
||||
digest[2] += c;
|
||||
digest[3] += d;
|
||||
digest[4] += e;
|
||||
}
|
||||
|
||||
} // sha1
|
||||
|
||||
void
|
||||
init(sha1_context& ctx) noexcept
|
||||
{
|
||||
ctx.buflen = 0;
|
||||
ctx.blocks = 0;
|
||||
ctx.digest[0] = 0x67452301;
|
||||
ctx.digest[1] = 0xefcdab89;
|
||||
ctx.digest[2] = 0x98badcfe;
|
||||
ctx.digest[3] = 0x10325476;
|
||||
ctx.digest[4] = 0xc3d2e1f0;
|
||||
}
|
||||
|
||||
void
|
||||
update(
|
||||
sha1_context& ctx,
|
||||
void const* message,
|
||||
std::size_t size) noexcept
|
||||
{
|
||||
auto p = static_cast<
|
||||
std::uint8_t const*>(message);
|
||||
for(;;)
|
||||
{
|
||||
auto const n = (std::min)(
|
||||
size, sizeof(ctx.buf) - ctx.buflen);
|
||||
std::memcpy(ctx.buf + ctx.buflen, p, n);
|
||||
ctx.buflen += n;
|
||||
if(ctx.buflen != 64)
|
||||
return;
|
||||
p += n;
|
||||
size -= n;
|
||||
ctx.buflen = 0;
|
||||
std::uint32_t block[sha1::BLOCK_INTS];
|
||||
sha1::make_block(ctx.buf, block);
|
||||
sha1::transform(ctx.digest, block);
|
||||
++ctx.blocks;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
finish(
|
||||
sha1_context& ctx,
|
||||
void* digest) noexcept
|
||||
{
|
||||
using sha1::BLOCK_INTS;
|
||||
using sha1::BLOCK_BYTES;
|
||||
|
||||
std::uint64_t total_bits =
|
||||
(ctx.blocks*64 + ctx.buflen) * 8;
|
||||
// pad
|
||||
ctx.buf[ctx.buflen++] = 0x80;
|
||||
auto const buflen = ctx.buflen;
|
||||
while(ctx.buflen < 64)
|
||||
ctx.buf[ctx.buflen++] = 0x00;
|
||||
std::uint32_t block[BLOCK_INTS];
|
||||
sha1::make_block(ctx.buf, block);
|
||||
if(buflen > BLOCK_BYTES - 8)
|
||||
{
|
||||
sha1::transform(ctx.digest, block);
|
||||
for(size_t i = 0; i < BLOCK_INTS - 2; i++)
|
||||
block[i] = 0;
|
||||
}
|
||||
|
||||
/* Append total_bits, split this uint64_t into two uint32_t */
|
||||
block[BLOCK_INTS - 1] = total_bits & 0xffffffff;
|
||||
block[BLOCK_INTS - 2] = (total_bits >> 32);
|
||||
sha1::transform(ctx.digest, block);
|
||||
for(std::size_t i = 0; i < sha1::DIGEST_BYTES/4; i++)
|
||||
{
|
||||
std::uint8_t* d =
|
||||
static_cast<std::uint8_t*>(digest) + 4 * i;
|
||||
d[3] = ctx.digest[i] & 0xff;
|
||||
d[2] = (ctx.digest[i] >> 8) & 0xff;
|
||||
d[1] = (ctx.digest[i] >> 16) & 0xff;
|
||||
d[0] = (ctx.digest[i] >> 24) & 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
} // detail
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#endif
|
@ -184,7 +184,9 @@ public:
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#include <boost/beast/core/impl/file_posix.hpp>
|
||||
#ifdef BOOST_BEAST_HEADER_ONLY
|
||||
#include <boost/beast/core/impl/file_posix.ipp>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -164,6 +164,8 @@ public:
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#include <boost/beast/core/impl/file_stdio.hpp>
|
||||
#ifdef BOOST_BEAST_HEADER_ONLY
|
||||
#include <boost/beast/core/impl/file_stdio.ipp>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -181,7 +181,9 @@ public:
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#include <boost/beast/core/impl/file_win32.hpp>
|
||||
#ifdef BOOST_BEAST_HEADER_ONLY
|
||||
#include <boost/beast/core/impl/file_win32.ipp>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -329,6 +329,8 @@ public:
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#include <boost/beast/core/impl/flat_static_buffer.hpp>
|
||||
#ifdef BOOST_BEAST_HEADER_ONLY
|
||||
#include <boost/beast/core/impl/flat_static_buffer.ipp>
|
||||
#endif
|
||||
|
||||
#endif
|
@ -15,53 +15,20 @@
|
||||
namespace boost {
|
||||
namespace system {
|
||||
template<>
|
||||
struct is_error_code_enum<beast::error>
|
||||
struct is_error_code_enum<::boost::beast::error>
|
||||
{
|
||||
static bool const value = true;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_error_condition_enum<beast::condition>
|
||||
struct is_error_condition_enum<::boost::beast::condition>
|
||||
{
|
||||
static bool const value = true;
|
||||
};
|
||||
|
||||
} // system
|
||||
} // boost
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
class error_codes : public error_category
|
||||
{
|
||||
public:
|
||||
BOOST_BEAST_DECL
|
||||
const char*
|
||||
name() const noexcept override;
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
std::string
|
||||
message(int ev) const override;
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
error_condition
|
||||
default_error_condition(int ev) const noexcept override;
|
||||
};
|
||||
|
||||
class error_conditions : public error_category
|
||||
{
|
||||
public:
|
||||
BOOST_BEAST_DECL
|
||||
const char*
|
||||
name() const noexcept override;
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
std::string
|
||||
message(int cv) const override;
|
||||
};
|
||||
|
||||
} // detail
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
error_code
|
||||
@ -74,6 +41,8 @@ make_error_condition(condition c);
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#ifdef BOOST_BEAST_HEADER_ONLY
|
||||
#include <boost/beast/core/impl/error.ipp>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -10,63 +10,70 @@
|
||||
#ifndef BOOST_BEAST_IMPL_ERROR_IPP
|
||||
#define BOOST_BEAST_IMPL_ERROR_IPP
|
||||
|
||||
#include <boost/beast/core/error.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
|
||||
namespace detail {
|
||||
|
||||
const char*
|
||||
error_codes::
|
||||
name() const noexcept
|
||||
class error_codes : public error_category
|
||||
{
|
||||
return "boost.beast";
|
||||
}
|
||||
|
||||
std::string
|
||||
error_codes::
|
||||
message(int ev) const
|
||||
{
|
||||
switch(static_cast<error>(ev))
|
||||
public:
|
||||
const char*
|
||||
name() const noexcept override
|
||||
{
|
||||
default:
|
||||
case error::timeout: return
|
||||
"The socket was closed due to a timeout";
|
||||
return "boost.beast";
|
||||
}
|
||||
}
|
||||
|
||||
error_condition
|
||||
error_codes::
|
||||
default_error_condition(int ev) const noexcept
|
||||
{
|
||||
switch(static_cast<error>(ev))
|
||||
BOOST_BEAST_DECL
|
||||
std::string
|
||||
message(int ev) const override
|
||||
{
|
||||
default:
|
||||
// return {ev, *this};
|
||||
case error::timeout:
|
||||
return condition::timeout;
|
||||
switch(static_cast<error>(ev))
|
||||
{
|
||||
default:
|
||||
case error::timeout: return
|
||||
"The socket was closed due to a timeout";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const char*
|
||||
error_conditions::
|
||||
name() const noexcept
|
||||
{
|
||||
return "boost.beast";
|
||||
}
|
||||
|
||||
std::string
|
||||
error_conditions::
|
||||
message(int cv) const
|
||||
{
|
||||
switch(static_cast<condition>(cv))
|
||||
BOOST_BEAST_DECL
|
||||
error_condition
|
||||
default_error_condition(int ev) const noexcept override
|
||||
{
|
||||
default:
|
||||
case condition::timeout:
|
||||
return "The operation timed out";
|
||||
switch(static_cast<error>(ev))
|
||||
{
|
||||
default:
|
||||
// return {ev, *this};
|
||||
case error::timeout:
|
||||
return condition::timeout;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class error_conditions : public error_category
|
||||
{
|
||||
public:
|
||||
BOOST_BEAST_DECL
|
||||
const char*
|
||||
name() const noexcept override
|
||||
{
|
||||
return "boost.beast";
|
||||
}
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
std::string
|
||||
message(int cv) const override
|
||||
{
|
||||
switch(static_cast<condition>(cv))
|
||||
{
|
||||
default:
|
||||
case condition::timeout:
|
||||
return "The operation timed out";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // detail
|
||||
|
||||
|
@ -7,8 +7,21 @@
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_CORE_IMPL_FILE_POSIX_HPP
|
||||
#define BOOST_BEAST_CORE_IMPL_FILE_POSIX_HPP
|
||||
#ifndef BOOST_BEAST_CORE_IMPL_FILE_POSIX_IPP
|
||||
#define BOOST_BEAST_CORE_IMPL_FILE_POSIX_IPP
|
||||
|
||||
#include <boost/beast/core/file_posix.hpp>
|
||||
|
||||
#if BOOST_BEAST_USE_POSIX_FILE
|
||||
|
||||
#include <boost/core/exchange.hpp>
|
||||
#include <limits>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
|
||||
#if ! defined(BOOST_BEAST_NO_POSIX_FADVISE)
|
||||
# if defined(__APPLE__) || (defined(ANDROID) && (__ANDROID_API__ < 21))
|
||||
@ -24,15 +37,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <boost/core/exchange.hpp>
|
||||
#include <limits>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
|
||||
@ -323,3 +327,5 @@ write(void const* buffer, std::size_t n, error_code& ec)
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -7,9 +7,10 @@
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_CORE_IMPL_FILE_STDIO_HPP
|
||||
#define BOOST_BEAST_CORE_IMPL_FILE_STDIO_HPP
|
||||
#ifndef BOOST_BEAST_CORE_IMPL_FILE_STDIO_IPP
|
||||
#define BOOST_BEAST_CORE_IMPL_FILE_STDIO_IPP
|
||||
|
||||
#include <boost/beast/core/file_stdio.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
#include <boost/core/exchange.hpp>
|
||||
#include <limits>
|
@ -7,8 +7,12 @@
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_CORE_IMPL_FILE_WIN32_HPP
|
||||
#define BOOST_BEAST_CORE_IMPL_FILE_WIN32_HPP
|
||||
#ifndef BOOST_BEAST_CORE_IMPL_FILE_WIN32_IPP
|
||||
#define BOOST_BEAST_CORE_IMPL_FILE_WIN32_IPP
|
||||
|
||||
#include <boost/beast/core/file_win32.hpp>
|
||||
|
||||
#if BOOST_BEAST_USE_WIN32_FILE
|
||||
|
||||
#include <boost/core/exchange.hpp>
|
||||
#include <boost/winapi/access_rights.hpp>
|
||||
@ -25,7 +29,7 @@ namespace detail {
|
||||
|
||||
// VFALCO Can't seem to get boost/detail/winapi to work with
|
||||
// this so use the non-Ex version for now.
|
||||
inline
|
||||
BOOST_BEAST_DECL
|
||||
boost::winapi::BOOL_
|
||||
set_file_pointer_ex(
|
||||
boost::winapi::HANDLE_ hFile,
|
||||
@ -345,3 +349,5 @@ write(void const* buffer, std::size_t n, error_code& ec)
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -7,15 +7,15 @@
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_IMPL_FLAT_STATIC_BUFFER_HPP
|
||||
#define BOOST_BEAST_IMPL_FLAT_STATIC_BUFFER_HPP
|
||||
#ifndef BOOST_BEAST_IMPL_FLAT_STATIC_BUFFER_IPP
|
||||
#define BOOST_BEAST_IMPL_FLAT_STATIC_BUFFER_IPP
|
||||
|
||||
#include <boost/beast/core/detail/type_traits.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/beast/core/flat_static_buffer.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace boost {
|
@ -21,113 +21,6 @@
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
|
||||
static_buffer_base::
|
||||
static_buffer_base(
|
||||
void* p, std::size_t size) noexcept
|
||||
: begin_(static_cast<char*>(p))
|
||||
, capacity_(size)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
static_buffer_base::
|
||||
clear() noexcept
|
||||
{
|
||||
in_off_ = 0;
|
||||
in_size_ = 0;
|
||||
out_size_ = 0;
|
||||
}
|
||||
|
||||
auto
|
||||
static_buffer_base::
|
||||
data() const noexcept ->
|
||||
const_buffers_type
|
||||
{
|
||||
if(in_off_ + in_size_ <= capacity_)
|
||||
return {
|
||||
net::const_buffer{
|
||||
begin_ + in_off_, in_size_},
|
||||
net::const_buffer{
|
||||
begin_, 0}};
|
||||
return {
|
||||
net::const_buffer{
|
||||
begin_ + in_off_, capacity_ - in_off_},
|
||||
net::const_buffer{
|
||||
begin_, in_size_ - (capacity_ - in_off_)}};
|
||||
}
|
||||
|
||||
auto
|
||||
static_buffer_base::
|
||||
data() noexcept ->
|
||||
mutable_data_type
|
||||
{
|
||||
if(in_off_ + in_size_ <= capacity_)
|
||||
return {
|
||||
net::mutable_buffer{
|
||||
begin_ + in_off_, in_size_},
|
||||
net::mutable_buffer{
|
||||
begin_, 0}};
|
||||
return {
|
||||
net::mutable_buffer{
|
||||
begin_ + in_off_, capacity_ - in_off_},
|
||||
net::mutable_buffer{
|
||||
begin_, in_size_ - (capacity_ - in_off_)}};
|
||||
}
|
||||
|
||||
auto
|
||||
static_buffer_base::
|
||||
prepare(std::size_t n) ->
|
||||
mutable_buffers_type
|
||||
{
|
||||
using net::mutable_buffer;
|
||||
if(n > capacity_ - in_size_)
|
||||
BOOST_THROW_EXCEPTION(std::length_error{
|
||||
"static_buffer overflow"});
|
||||
out_size_ = n;
|
||||
auto const out_off =
|
||||
(in_off_ + in_size_) % capacity_;
|
||||
if(out_off + out_size_ <= capacity_ )
|
||||
return {
|
||||
net::mutable_buffer{
|
||||
begin_ + out_off, out_size_},
|
||||
net::mutable_buffer{
|
||||
begin_, 0}};
|
||||
return {
|
||||
net::mutable_buffer{
|
||||
begin_ + out_off, capacity_ - out_off},
|
||||
net::mutable_buffer{
|
||||
begin_, out_size_ - (capacity_ - out_off)}};
|
||||
}
|
||||
|
||||
void
|
||||
static_buffer_base::
|
||||
commit(std::size_t n) noexcept
|
||||
{
|
||||
in_size_ += (std::min)(n, out_size_);
|
||||
out_size_ = 0;
|
||||
}
|
||||
|
||||
void
|
||||
static_buffer_base::
|
||||
consume(std::size_t n) noexcept
|
||||
{
|
||||
if(n < in_size_)
|
||||
{
|
||||
in_off_ = (in_off_ + n) % capacity_;
|
||||
in_size_ -= n;
|
||||
}
|
||||
else
|
||||
{
|
||||
// rewind the offset, so the next call to prepare
|
||||
// can have a longer contiguous segment. this helps
|
||||
// algorithms optimized for larger buffers.
|
||||
in_off_ = 0;
|
||||
in_size_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<std::size_t N>
|
||||
static_buffer<N>::
|
||||
static_buffer(static_buffer const& other) noexcept
|
||||
|
133
include/boost/beast/core/impl/static_buffer.ipp
Normal file
133
include/boost/beast/core/impl/static_buffer.ipp
Normal file
@ -0,0 +1,133 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_IMPL_STATIC_BUFFER_IPP
|
||||
#define BOOST_BEAST_IMPL_STATIC_BUFFER_IPP
|
||||
|
||||
#include <boost/beast/core/static_buffer.hpp>
|
||||
#include <boost/beast/core/detail/type_traits.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <iterator>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
|
||||
static_buffer_base::
|
||||
static_buffer_base(
|
||||
void* p, std::size_t size) noexcept
|
||||
: begin_(static_cast<char*>(p))
|
||||
, capacity_(size)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
static_buffer_base::
|
||||
clear() noexcept
|
||||
{
|
||||
in_off_ = 0;
|
||||
in_size_ = 0;
|
||||
out_size_ = 0;
|
||||
}
|
||||
|
||||
auto
|
||||
static_buffer_base::
|
||||
data() const noexcept ->
|
||||
const_buffers_type
|
||||
{
|
||||
if(in_off_ + in_size_ <= capacity_)
|
||||
return {
|
||||
net::const_buffer{
|
||||
begin_ + in_off_, in_size_},
|
||||
net::const_buffer{
|
||||
begin_, 0}};
|
||||
return {
|
||||
net::const_buffer{
|
||||
begin_ + in_off_, capacity_ - in_off_},
|
||||
net::const_buffer{
|
||||
begin_, in_size_ - (capacity_ - in_off_)}};
|
||||
}
|
||||
|
||||
auto
|
||||
static_buffer_base::
|
||||
data() noexcept ->
|
||||
mutable_data_type
|
||||
{
|
||||
if(in_off_ + in_size_ <= capacity_)
|
||||
return {
|
||||
net::mutable_buffer{
|
||||
begin_ + in_off_, in_size_},
|
||||
net::mutable_buffer{
|
||||
begin_, 0}};
|
||||
return {
|
||||
net::mutable_buffer{
|
||||
begin_ + in_off_, capacity_ - in_off_},
|
||||
net::mutable_buffer{
|
||||
begin_, in_size_ - (capacity_ - in_off_)}};
|
||||
}
|
||||
|
||||
auto
|
||||
static_buffer_base::
|
||||
prepare(std::size_t n) ->
|
||||
mutable_buffers_type
|
||||
{
|
||||
using net::mutable_buffer;
|
||||
if(n > capacity_ - in_size_)
|
||||
BOOST_THROW_EXCEPTION(std::length_error{
|
||||
"static_buffer overflow"});
|
||||
out_size_ = n;
|
||||
auto const out_off =
|
||||
(in_off_ + in_size_) % capacity_;
|
||||
if(out_off + out_size_ <= capacity_ )
|
||||
return {
|
||||
net::mutable_buffer{
|
||||
begin_ + out_off, out_size_},
|
||||
net::mutable_buffer{
|
||||
begin_, 0}};
|
||||
return {
|
||||
net::mutable_buffer{
|
||||
begin_ + out_off, capacity_ - out_off},
|
||||
net::mutable_buffer{
|
||||
begin_, out_size_ - (capacity_ - out_off)}};
|
||||
}
|
||||
|
||||
void
|
||||
static_buffer_base::
|
||||
commit(std::size_t n) noexcept
|
||||
{
|
||||
in_size_ += (std::min)(n, out_size_);
|
||||
out_size_ = 0;
|
||||
}
|
||||
|
||||
void
|
||||
static_buffer_base::
|
||||
consume(std::size_t n) noexcept
|
||||
{
|
||||
if(n < in_size_)
|
||||
{
|
||||
in_off_ = (in_off_ + n) % capacity_;
|
||||
in_size_ -= n;
|
||||
}
|
||||
else
|
||||
{
|
||||
// rewind the offset, so the next call to prepare
|
||||
// can have a longer contiguous segment. this helps
|
||||
// algorithms optimized for larger buffers.
|
||||
in_off_ = 0;
|
||||
in_size_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#endif
|
@ -173,7 +173,7 @@ class simple_rate_policy
|
||||
}
|
||||
|
||||
void
|
||||
transfer_read_bytes(std::size_t n)
|
||||
transfer_read_bytes(std::size_t n) noexcept
|
||||
{
|
||||
if( rd_remain_ != all)
|
||||
rd_remain_ =
|
||||
@ -181,7 +181,7 @@ class simple_rate_policy
|
||||
}
|
||||
|
||||
void
|
||||
transfer_write_bytes(std::size_t n)
|
||||
transfer_write_bytes(std::size_t n) noexcept
|
||||
{
|
||||
if( wr_remain_ != all)
|
||||
wr_remain_ =
|
||||
@ -189,7 +189,7 @@ class simple_rate_policy
|
||||
}
|
||||
|
||||
void
|
||||
on_timer()
|
||||
on_timer() noexcept
|
||||
{
|
||||
rd_remain_ = rd_limit_;
|
||||
wr_remain_ = wr_limit_;
|
||||
@ -198,7 +198,7 @@ class simple_rate_policy
|
||||
public:
|
||||
/// Set the limit of bytes per second to read
|
||||
void
|
||||
read_limit(std::size_t bytes_per_second)
|
||||
read_limit(std::size_t bytes_per_second) noexcept
|
||||
{
|
||||
rd_limit_ = bytes_per_second;
|
||||
if( rd_remain_ > bytes_per_second)
|
||||
@ -207,7 +207,7 @@ public:
|
||||
|
||||
/// Set the limit of bytes per second to write
|
||||
void
|
||||
write_limit(std::size_t bytes_per_second)
|
||||
write_limit(std::size_t bytes_per_second) noexcept
|
||||
{
|
||||
wr_limit_ = bytes_per_second;
|
||||
if( wr_remain_ > bytes_per_second)
|
||||
|
@ -294,5 +294,8 @@ public:
|
||||
} // boost
|
||||
|
||||
#include <boost/beast/core/impl/static_buffer.hpp>
|
||||
#ifdef BOOST_BEAST_HEADER_ONLY
|
||||
#include <boost/beast/core/impl/static_buffer.ipp>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -616,6 +616,6 @@ private:
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#include <boost/beast/http/impl/basic_parser.ipp>
|
||||
#include <boost/beast/http/impl/basic_parser.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -732,6 +732,6 @@ make_chunk_last(
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#include <boost/beast/http/impl/chunk_encode.ipp>
|
||||
#include <boost/beast/http/impl/chunk_encode.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -151,6 +151,6 @@ enum class error
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#include <boost/beast/http/impl/error.ipp>
|
||||
#include <boost/beast/http/impl/error.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -380,6 +380,7 @@ enum class field : unsigned short
|
||||
|
||||
@param f The field to convert
|
||||
*/
|
||||
BOOST_BEAST_DECL
|
||||
string_view
|
||||
to_string(field f);
|
||||
|
||||
@ -390,6 +391,7 @@ to_string(field f);
|
||||
@return The corresponding field, or @ref field::unknown
|
||||
if no known field matches.
|
||||
*/
|
||||
BOOST_BEAST_DECL
|
||||
field
|
||||
string_to_field(string_view s);
|
||||
|
||||
@ -405,6 +407,8 @@ operator<<(std::ostream& os, field f)
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#ifdef BOOST_BEAST_HEADER_ONLY
|
||||
#include <boost/beast/http/impl/field.ipp>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -768,6 +768,6 @@ using fields = basic_fields<std::allocator<char>>;
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#include <boost/beast/http/impl/fields.ipp>
|
||||
#include <boost/beast/http/impl/fields.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -31,7 +31,7 @@ using file_body = basic_file_body<file>;
|
||||
} // boost
|
||||
|
||||
#ifndef BOOST_BEAST_NO_FILE_BODY_WIN32
|
||||
#include <boost/beast/http/impl/file_body_win32.ipp>
|
||||
#include <boost/beast/http/impl/file_body_win32.hpp>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -7,8 +7,8 @@
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_BASIC_PARSER_IPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_BASIC_PARSER_IPP
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_BASIC_PARSER_HPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_BASIC_PARSER_HPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/static_string.hpp>
|
@ -7,8 +7,8 @@
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_CHUNK_ENCODE_IPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_CHUNK_ENCODE_IPP
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_CHUNK_ENCODE_HPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_CHUNK_ENCODE_HPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/detail/varint.hpp>
|
||||
@ -681,7 +681,6 @@ insert(string_view name, string_view value)
|
||||
}
|
||||
|
||||
template<class Allocator>
|
||||
inline
|
||||
auto
|
||||
basic_chunk_extensions<Allocator>::
|
||||
begin() const ->
|
||||
@ -691,7 +690,6 @@ begin() const ->
|
||||
}
|
||||
|
||||
template<class Allocator>
|
||||
inline
|
||||
auto
|
||||
basic_chunk_extensions<Allocator>::
|
||||
end() const ->
|
41
include/boost/beast/http/impl/error.hpp
Normal file
41
include/boost/beast/http/impl/error.hpp
Normal file
@ -0,0 +1,41 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_ERROR_HPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_ERROR_HPP
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost {
|
||||
namespace system {
|
||||
template<>
|
||||
struct is_error_code_enum<::boost::beast::http::error>
|
||||
{
|
||||
static bool const value = true;
|
||||
};
|
||||
} // system
|
||||
} // boost
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
namespace http {
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
error_code
|
||||
make_error_code(error ev);
|
||||
|
||||
} // http
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#ifdef BOOST_BEAST_HEADER_ONLY
|
||||
#include <boost/beast/http/impl/error.ipp>
|
||||
#endif
|
||||
|
||||
#endif
|
@ -10,18 +10,10 @@
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_ERROR_IPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_ERROR_IPP
|
||||
|
||||
#include <boost/beast/http/error.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace system {
|
||||
template<>
|
||||
struct is_error_code_enum<beast::http::error>
|
||||
{
|
||||
static bool const value = true;
|
||||
};
|
||||
} // system
|
||||
|
||||
namespace beast {
|
||||
namespace http {
|
||||
namespace detail {
|
||||
@ -96,7 +88,6 @@ public:
|
||||
|
||||
} // detail
|
||||
|
||||
inline
|
||||
error_code
|
||||
make_error_code(error ev)
|
||||
{
|
||||
|
@ -10,11 +10,9 @@
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_FIELD_IPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_FIELD_IPP
|
||||
|
||||
#include <boost/beast/core/string.hpp>
|
||||
#include <boost/beast/http/field.hpp>
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <cstring>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
@ -516,7 +514,7 @@ struct field_table
|
||||
}
|
||||
};
|
||||
|
||||
inline
|
||||
BOOST_BEAST_DECL
|
||||
field_table const&
|
||||
get_field_table()
|
||||
{
|
||||
@ -524,7 +522,7 @@ get_field_table()
|
||||
return tab;
|
||||
}
|
||||
|
||||
template<class = void>
|
||||
BOOST_BEAST_DECL
|
||||
string_view
|
||||
to_string(field f)
|
||||
{
|
||||
@ -535,14 +533,12 @@ to_string(field f)
|
||||
|
||||
} // detail
|
||||
|
||||
inline
|
||||
string_view
|
||||
to_string(field f)
|
||||
{
|
||||
return detail::to_string(f);
|
||||
}
|
||||
|
||||
inline
|
||||
field
|
||||
string_to_field(string_view s)
|
||||
{
|
||||
|
@ -7,8 +7,8 @@
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_FIELDS_IPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_FIELDS_IPP
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_FIELDS_HPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_FIELDS_HPP
|
||||
|
||||
#include <boost/beast/core/buffers_cat.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
@ -7,8 +7,8 @@
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_FILE_BODY_WIN32_IPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_FILE_BODY_WIN32_IPP
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_FILE_BODY_WIN32_HPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_FILE_BODY_WIN32_HPP
|
||||
|
||||
#if BOOST_BEAST_USE_WIN32_FILE
|
||||
|
@ -7,8 +7,8 @@
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_MESSAGE_IPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_MESSAGE_IPP
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_MESSAGE_HPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_MESSAGE_HPP
|
||||
|
||||
#include <boost/beast/core/error.hpp>
|
||||
#include <boost/beast/core/detail/type_traits.hpp>
|
||||
@ -30,7 +30,6 @@ header(Arg1&& arg1, ArgN&&... argn)
|
||||
}
|
||||
|
||||
template<class Fields>
|
||||
inline
|
||||
verb
|
||||
header<true, Fields>::
|
||||
method() const
|
||||
@ -73,7 +72,6 @@ method_string(string_view s)
|
||||
}
|
||||
|
||||
template<class Fields>
|
||||
inline
|
||||
string_view
|
||||
header<true, Fields>::
|
||||
target() const
|
||||
@ -82,7 +80,6 @@ target() const
|
||||
}
|
||||
|
||||
template<class Fields>
|
||||
inline
|
||||
void
|
||||
header<true, Fields>::
|
||||
target(string_view s)
|
||||
@ -116,7 +113,6 @@ header(Arg1&& arg1, ArgN&&... argn)
|
||||
}
|
||||
|
||||
template<class Fields>
|
||||
inline
|
||||
status
|
||||
header<false, Fields>::
|
||||
result() const
|
||||
@ -126,7 +122,6 @@ result() const
|
||||
}
|
||||
|
||||
template<class Fields>
|
||||
inline
|
||||
void
|
||||
header<false, Fields>::
|
||||
result(status v)
|
||||
@ -135,7 +130,6 @@ result(status v)
|
||||
}
|
||||
|
||||
template<class Fields>
|
||||
inline
|
||||
void
|
||||
header<false, Fields>::
|
||||
result(unsigned v)
|
||||
@ -148,7 +142,6 @@ result(unsigned v)
|
||||
}
|
||||
|
||||
template<class Fields>
|
||||
inline
|
||||
unsigned
|
||||
header<false, Fields>::
|
||||
result_int() const
|
||||
@ -168,7 +161,6 @@ reason() const
|
||||
}
|
||||
|
||||
template<class Fields>
|
||||
inline
|
||||
void
|
||||
header<false, Fields>::
|
||||
reason(string_view s)
|
@ -7,8 +7,8 @@
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_PARSER_IPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_PARSER_IPP
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_PARSER_HPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_PARSER_HPP
|
||||
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <stdexcept>
|
@ -7,8 +7,8 @@
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_READ_IPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_READ_IPP
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_READ_HPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_READ_HPP
|
||||
|
||||
#include <boost/beast/http/type_traits.hpp>
|
||||
#include <boost/beast/http/error.hpp>
|
@ -7,8 +7,8 @@
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_RFC7230_IPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_RFC7230_IPP
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_RFC7230_HPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_RFC7230_HPP
|
||||
|
||||
#include <boost/beast/http/detail/rfc7230.hpp>
|
||||
#include <iterator>
|
@ -7,8 +7,8 @@
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_SERIALIZER_IPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_SERIALIZER_IPP
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_SERIALIZER_HPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_SERIALIZER_HPP
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/detail/buffers_ref.hpp>
|
@ -10,15 +10,13 @@
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_STATUS_IPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_STATUS_IPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/http/status.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
namespace http {
|
||||
namespace detail {
|
||||
|
||||
template<class = void>
|
||||
status
|
||||
int_to_status(unsigned v)
|
||||
{
|
||||
@ -107,9 +105,30 @@ int_to_status(unsigned v)
|
||||
return status::unknown;
|
||||
}
|
||||
|
||||
template<class = void>
|
||||
status_class
|
||||
to_status_class(unsigned v)
|
||||
{
|
||||
switch(v / 100)
|
||||
{
|
||||
case 1: return status_class::informational;
|
||||
case 2: return status_class::successful;
|
||||
case 3: return status_class::redirection;
|
||||
case 4: return status_class::client_error;
|
||||
case 5: return status_class::server_error;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return status_class::unknown;
|
||||
}
|
||||
|
||||
status_class
|
||||
to_status_class(status v)
|
||||
{
|
||||
return to_status_class(static_cast<int>(v));
|
||||
}
|
||||
|
||||
string_view
|
||||
status_to_string(unsigned v)
|
||||
obsolete_reason(status v)
|
||||
{
|
||||
switch(static_cast<status>(v))
|
||||
{
|
||||
@ -190,55 +209,6 @@ status_to_string(unsigned v)
|
||||
return "<unknown-status>";
|
||||
}
|
||||
|
||||
template<class = void>
|
||||
status_class
|
||||
to_status_class(unsigned v)
|
||||
{
|
||||
switch(v / 100)
|
||||
{
|
||||
case 1: return status_class::informational;
|
||||
case 2: return status_class::successful;
|
||||
case 3: return status_class::redirection;
|
||||
case 4: return status_class::client_error;
|
||||
case 5: return status_class::server_error;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return status_class::unknown;
|
||||
}
|
||||
|
||||
} // detail
|
||||
|
||||
inline
|
||||
status
|
||||
int_to_status(unsigned v)
|
||||
{
|
||||
return detail::int_to_status(v);
|
||||
}
|
||||
|
||||
inline
|
||||
status_class
|
||||
to_status_class(unsigned v)
|
||||
{
|
||||
return detail::to_status_class(v);
|
||||
}
|
||||
|
||||
inline
|
||||
status_class
|
||||
to_status_class(status v)
|
||||
{
|
||||
return to_status_class(static_cast<int>(v));
|
||||
}
|
||||
|
||||
inline
|
||||
string_view
|
||||
obsolete_reason(status v)
|
||||
{
|
||||
return detail::status_to_string(
|
||||
static_cast<unsigned>(v));
|
||||
}
|
||||
|
||||
inline
|
||||
std::ostream&
|
||||
operator<<(std::ostream& os, status v)
|
||||
{
|
||||
|
@ -10,7 +10,7 @@
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_VERB_IPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_VERB_IPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/http/verb.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <stdexcept>
|
||||
|
||||
@ -18,12 +18,8 @@ namespace boost {
|
||||
namespace beast {
|
||||
namespace http {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class = void>
|
||||
inline
|
||||
string_view
|
||||
verb_to_string(verb v)
|
||||
to_string(verb v)
|
||||
{
|
||||
switch(v)
|
||||
{
|
||||
@ -74,7 +70,6 @@ verb_to_string(verb v)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument{"unknown verb"});
|
||||
}
|
||||
|
||||
template<class = void>
|
||||
verb
|
||||
string_to_verb(string_view v)
|
||||
{
|
||||
@ -314,22 +309,6 @@ string_to_verb(string_view v)
|
||||
return verb::unknown;
|
||||
}
|
||||
|
||||
} // detail
|
||||
|
||||
inline
|
||||
string_view
|
||||
to_string(verb v)
|
||||
{
|
||||
return detail::verb_to_string(v);
|
||||
}
|
||||
|
||||
inline
|
||||
verb
|
||||
string_to_verb(string_view s)
|
||||
{
|
||||
return detail::string_to_verb(s);
|
||||
}
|
||||
|
||||
} // http
|
||||
} // beast
|
||||
} // boost
|
||||
|
@ -7,8 +7,8 @@
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_WRITE_IPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_WRITE_IPP
|
||||
#ifndef BOOST_BEAST_HTTP_IMPL_WRITE_HPP
|
||||
#define BOOST_BEAST_HTTP_IMPL_WRITE_HPP
|
||||
|
||||
#include <boost/beast/http/type_traits.hpp>
|
||||
#include <boost/beast/core/async_op_base.hpp>
|
@ -1001,6 +1001,6 @@ swap(
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#include <boost/beast/http/impl/message.ipp>
|
||||
#include <boost/beast/http/impl/message.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -460,6 +460,6 @@ using response_parser = parser<false, Body, Allocator>;
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#include <boost/beast/http/impl/parser.ipp>
|
||||
#include <boost/beast/http/impl/parser.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -812,6 +812,6 @@ async_read(
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#include <boost/beast/http/impl/read.ipp>
|
||||
#include <boost/beast/http/impl/read.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -324,6 +324,6 @@ validate_list(detail::basic_parsed_list<
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#include <boost/beast/http/impl/rfc7230.ipp>
|
||||
#include <boost/beast/http/impl/rfc7230.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -365,6 +365,6 @@ using response_serializer = serializer<false, Body, Fields>;
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#include <boost/beast/http/impl/serializer.ipp>
|
||||
#include <boost/beast/http/impl/serializer.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -134,6 +134,7 @@ enum class status_class : unsigned
|
||||
If the integer does not match a known status code,
|
||||
@ref status::unknown is returned.
|
||||
*/
|
||||
BOOST_BEAST_DECL
|
||||
status
|
||||
int_to_status(unsigned v);
|
||||
|
||||
@ -144,6 +145,7 @@ int_to_status(unsigned v);
|
||||
@return The status class. If the integer does not match
|
||||
a known status class, @ref status_class::unknown is returned.
|
||||
*/
|
||||
BOOST_BEAST_DECL
|
||||
status_class
|
||||
to_status_class(unsigned v);
|
||||
|
||||
@ -153,6 +155,7 @@ to_status_class(unsigned v);
|
||||
|
||||
@return The status class.
|
||||
*/
|
||||
BOOST_BEAST_DECL
|
||||
status_class
|
||||
to_status_class(status v);
|
||||
|
||||
@ -160,10 +163,12 @@ to_status_class(status v);
|
||||
|
||||
@param v The status code to use.
|
||||
*/
|
||||
BOOST_BEAST_DECL
|
||||
string_view
|
||||
obsolete_reason(status v);
|
||||
|
||||
/// Outputs the standard reason phrase of a status code to a stream.
|
||||
BOOST_BEAST_DECL
|
||||
std::ostream&
|
||||
operator<<(std::ostream&, status);
|
||||
|
||||
@ -171,6 +176,8 @@ operator<<(std::ostream&, status);
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#ifdef BOOST_BEAST_HEADER_ONLY
|
||||
#include <boost/beast/http/impl/status.ipp>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -133,10 +133,12 @@ enum class verb
|
||||
If the string does not match a known request method,
|
||||
@ref verb::unknown is returned.
|
||||
*/
|
||||
BOOST_BEAST_DECL
|
||||
verb
|
||||
string_to_verb(string_view s);
|
||||
|
||||
/// Returns the text representation of a request method verb.
|
||||
BOOST_BEAST_DECL
|
||||
string_view
|
||||
to_string(verb v);
|
||||
|
||||
@ -152,6 +154,8 @@ operator<<(std::ostream& os, verb v)
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#ifdef BOOST_BEAST_HEADER_ONLY
|
||||
#include <boost/beast/http/impl/verb.ipp>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -754,6 +754,6 @@ operator<<(std::ostream& os,
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#include <boost/beast/http/impl/write.ipp>
|
||||
#include <boost/beast/http/impl/write.hpp>
|
||||
|
||||
#endif
|
||||
|
51
include/boost/beast/src.hpp
Normal file
51
include/boost/beast/src.hpp
Normal file
@ -0,0 +1,51 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_SRC_HPP
|
||||
#define BOOST_BEAST_SRC_HPP
|
||||
|
||||
/*
|
||||
|
||||
This file is meant to be included once, in a translation unit of
|
||||
the program, with the macro BOOST_BEAST_SPLIT_COMPILATION defined.
|
||||
|
||||
*/
|
||||
|
||||
#define BOOST_BEAST_SOURCE
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
|
||||
#if defined(BOOST_BEAST_HEADER_ONLY)
|
||||
# error Do not compile Beast library source with BOOST_BEAST_HEADER_ONLY defined
|
||||
#endif
|
||||
|
||||
#include <boost/beast/_experimental/test/impl/error.ipp>
|
||||
#include <boost/beast/_experimental/test/impl/stream.ipp>
|
||||
|
||||
#include <boost/beast/core/detail/base64.ipp>
|
||||
#include <boost/beast/core/detail/sha1.ipp>
|
||||
#include <boost/beast/core/impl/error.ipp>
|
||||
#include <boost/beast/core/impl/file_posix.ipp>
|
||||
#include <boost/beast/core/impl/file_stdio.ipp>
|
||||
#include <boost/beast/core/impl/file_win32.ipp>
|
||||
#include <boost/beast/core/impl/static_buffer.ipp>
|
||||
|
||||
#include <boost/beast/http/impl/error.ipp>
|
||||
#include <boost/beast/http/impl/field.ipp>
|
||||
#include <boost/beast/http/impl/status.ipp>
|
||||
#include <boost/beast/http/impl/verb.ipp>
|
||||
|
||||
#include <boost/beast/websocket/detail/prng.ipp>
|
||||
#include <boost/beast/websocket/impl/error.ipp>
|
||||
|
||||
#include <boost/beast/zlib/detail/deflate_stream.ipp>
|
||||
#include <boost/beast/zlib/detail/inflate_stream.ipp>
|
||||
#include <boost/beast/zlib/impl/error.ipp>
|
||||
|
||||
#endif
|
@ -1,78 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_WEBSOCKET_DETAIL_ERROR_HPP
|
||||
#define BOOST_BEAST_WEBSOCKET_DETAIL_ERROR_HPP
|
||||
|
||||
#include <boost/beast/core/error.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace beast {
|
||||
namespace websocket {
|
||||
enum class error;
|
||||
enum class condition;
|
||||
} // websocket
|
||||
} // beast
|
||||
|
||||
namespace system {
|
||||
template<>
|
||||
struct is_error_code_enum<beast::websocket::error>
|
||||
{
|
||||
static bool const value = true;
|
||||
};
|
||||
template<>
|
||||
struct is_error_condition_enum<beast::websocket::condition>
|
||||
{
|
||||
static bool const value = true;
|
||||
};
|
||||
} // system
|
||||
|
||||
namespace beast {
|
||||
namespace websocket {
|
||||
namespace detail {
|
||||
|
||||
class error_codes : public error_category
|
||||
{
|
||||
public:
|
||||
const char*
|
||||
name() const noexcept override;
|
||||
|
||||
std::string
|
||||
message(int ev) const override;
|
||||
|
||||
error_condition
|
||||
default_error_condition(int ev) const noexcept override;
|
||||
};
|
||||
|
||||
class error_conditions : public error_category
|
||||
{
|
||||
public:
|
||||
const char*
|
||||
name() const noexcept override;
|
||||
|
||||
std::string
|
||||
message(int cv) const override;
|
||||
};
|
||||
|
||||
} // detail
|
||||
|
||||
error_code
|
||||
make_error_code(error e);
|
||||
|
||||
error_condition
|
||||
make_error_condition(condition c);
|
||||
|
||||
} // websocket
|
||||
} // beast
|
||||
|
||||
} // boost
|
||||
|
||||
#endif
|
@ -116,6 +116,8 @@ make_prng(bool secure);
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#include <boost/beast/websocket/detail/impl/prng.ipp>
|
||||
#ifdef BOOST_BEAST_HEADER_ONLY
|
||||
#include <boost/beast/websocket/detail/prng.ipp>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -7,9 +7,10 @@
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_WEBSOCKET_DETAIL_IMPL_PRNG_IPP
|
||||
#define BOOST_BEAST_WEBSOCKET_DETAIL_IMPL_PRNG_IPP
|
||||
#ifndef BOOST_BEAST_WEBSOCKET_DETAIL_PRNG_IPP
|
||||
#define BOOST_BEAST_WEBSOCKET_DETAIL_PRNG_IPP
|
||||
|
||||
#include <boost/beast/websocket/detail/prng.hpp>
|
||||
#include <boost/beast/core/detail/chacha.hpp>
|
||||
#include <boost/beast/core/detail/pcg.hpp>
|
||||
#include <boost/align/aligned_alloc.hpp>
|
@ -10,7 +10,6 @@
|
||||
#ifndef BOOST_BEAST_WEBSOCKET_ERROR_HPP
|
||||
#define BOOST_BEAST_WEBSOCKET_ERROR_HPP
|
||||
|
||||
#include <boost/beast/websocket/detail/error.hpp>
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/error.hpp>
|
||||
|
||||
|
@ -10,153 +10,39 @@
|
||||
#ifndef BOOST_BEAST_WEBSOCKET_IMPL_ERROR_HPP
|
||||
#define BOOST_BEAST_WEBSOCKET_IMPL_ERROR_HPP
|
||||
|
||||
namespace boost {
|
||||
namespace system {
|
||||
template<>
|
||||
struct is_error_code_enum<::boost::beast::websocket::error>
|
||||
{
|
||||
static bool const value = true;
|
||||
};
|
||||
template<>
|
||||
struct is_error_condition_enum<::boost::beast::websocket::condition>
|
||||
{
|
||||
static bool const value = true;
|
||||
};
|
||||
} // system
|
||||
} // boost
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
namespace websocket {
|
||||
namespace detail {
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
const char*
|
||||
error_codes::
|
||||
name() const noexcept
|
||||
{
|
||||
return "boost.beast.websocket";
|
||||
}
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
std::string
|
||||
error_codes::
|
||||
message(int ev) const
|
||||
{
|
||||
switch(static_cast<error>(ev))
|
||||
{
|
||||
default:
|
||||
case error::closed: return "The WebSocket stream was gracefully closed at both endpoints";
|
||||
case error::buffer_overflow: return "The WebSocket operation caused a dynamic buffer overflow";
|
||||
case error::partial_deflate_block: return "The WebSocket stream produced an incomplete deflate block";
|
||||
case error::message_too_big: return "The WebSocket message exceeded the locally configured limit";
|
||||
|
||||
case error::bad_http_version: return "The WebSocket handshake was not HTTP/1.1";
|
||||
case error::bad_method: return "The WebSocket handshake method was not GET";
|
||||
case error::no_host: return "The WebSocket handshake Host field is missing";
|
||||
case error::no_connection: return "The WebSocket handshake Connection field is missing";
|
||||
case error::no_connection_upgrade: return "The WebSocket handshake Connection field is missing the upgrade token";
|
||||
case error::no_upgrade: return "The WebSocket handshake Upgrade field is missing";
|
||||
case error::no_upgrade_websocket: return "The WebSocket handshake Upgrade field is missing the websocket token";
|
||||
case error::no_sec_key: return "The WebSocket handshake Sec-WebSocket-Key field is missing";
|
||||
case error::bad_sec_key: return "The WebSocket handshake Sec-WebSocket-Key field is invalid";
|
||||
case error::no_sec_version: return "The WebSocket handshake Sec-WebSocket-Version field is missing";
|
||||
case error::bad_sec_version: return "The WebSocket handshake Sec-WebSocket-Version field is invalid";
|
||||
case error::no_sec_accept: return "The WebSocket handshake Sec-WebSocket-Accept field is missing";
|
||||
case error::bad_sec_accept: return "The WebSocket handshake Sec-WebSocket-Accept field is invalid";
|
||||
case error::upgrade_declined: return "The WebSocket handshake was declined by the remote peer";
|
||||
|
||||
case error::bad_opcode: return "The WebSocket frame contained an illegal opcode";
|
||||
case error::bad_data_frame: return "The WebSocket data frame was unexpected";
|
||||
case error::bad_continuation: return "The WebSocket continuation frame was unexpected";
|
||||
case error::bad_reserved_bits: return "The WebSocket frame contained illegal reserved bits";
|
||||
case error::bad_control_fragment: return "The WebSocket control frame was fragmented";
|
||||
case error::bad_control_size: return "The WebSocket control frame size was invalid";
|
||||
case error::bad_unmasked_frame: return "The WebSocket frame was unmasked";
|
||||
case error::bad_masked_frame: return "The WebSocket frame was masked";
|
||||
case error::bad_size: return "The WebSocket frame size was not canonical";
|
||||
case error::bad_frame_payload: return "The WebSocket frame payload was not valid utf8";
|
||||
case error::bad_close_code: return "The WebSocket close frame reason code was invalid";
|
||||
case error::bad_close_size: return "The WebSocket close frame payload size was invalid";
|
||||
case error::bad_close_payload: return "The WebSocket close frame payload was not valid utf8";
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
error_condition
|
||||
error_codes::
|
||||
default_error_condition(int ev) const noexcept
|
||||
{
|
||||
switch(static_cast<error>(ev))
|
||||
{
|
||||
default:
|
||||
case error::closed:
|
||||
case error::buffer_overflow:
|
||||
case error::partial_deflate_block:
|
||||
case error::message_too_big:
|
||||
return {ev, *this};
|
||||
|
||||
case error::bad_http_version:
|
||||
case error::bad_method:
|
||||
case error::no_host:
|
||||
case error::no_connection:
|
||||
case error::no_connection_upgrade:
|
||||
case error::no_upgrade:
|
||||
case error::no_upgrade_websocket:
|
||||
case error::no_sec_key:
|
||||
case error::bad_sec_key:
|
||||
case error::no_sec_version:
|
||||
case error::bad_sec_version:
|
||||
case error::no_sec_accept:
|
||||
case error::bad_sec_accept:
|
||||
case error::upgrade_declined:
|
||||
return condition::handshake_failed;
|
||||
|
||||
case error::bad_opcode:
|
||||
case error::bad_data_frame:
|
||||
case error::bad_continuation:
|
||||
case error::bad_reserved_bits:
|
||||
case error::bad_control_fragment:
|
||||
case error::bad_control_size:
|
||||
case error::bad_unmasked_frame:
|
||||
case error::bad_masked_frame:
|
||||
case error::bad_size:
|
||||
case error::bad_frame_payload:
|
||||
case error::bad_close_code:
|
||||
case error::bad_close_size:
|
||||
case error::bad_close_payload:
|
||||
return condition::protocol_violation;
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
const char*
|
||||
error_conditions::
|
||||
name() const noexcept
|
||||
{
|
||||
return "boost.beast.websocket";
|
||||
}
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
std::string
|
||||
error_conditions::
|
||||
message(int cv) const
|
||||
{
|
||||
switch(static_cast<condition>(cv))
|
||||
{
|
||||
default:
|
||||
case condition::handshake_failed: return "The WebSocket handshake failed";
|
||||
case condition::protocol_violation: return "A WebSocket protocol violation occurred";
|
||||
}
|
||||
}
|
||||
|
||||
} // detail
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
error_code
|
||||
make_error_code(error e)
|
||||
{
|
||||
static detail::error_codes const cat{};
|
||||
return error_code{static_cast<
|
||||
std::underlying_type<error>::type>(e), cat};
|
||||
}
|
||||
make_error_code(error e);
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
error_condition
|
||||
make_error_condition(condition c)
|
||||
{
|
||||
static detail::error_conditions const cat{};
|
||||
return error_condition{static_cast<
|
||||
std::underlying_type<condition>::type>(c), cat};
|
||||
}
|
||||
make_error_condition(condition c);
|
||||
|
||||
} // websocket
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#ifdef BOOST_BEAST_HEADER_ONLY
|
||||
#include <boost/beast/websocket/impl/error.ipp>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
160
include/boost/beast/websocket/impl/error.ipp
Normal file
160
include/boost/beast/websocket/impl/error.ipp
Normal file
@ -0,0 +1,160 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_WEBSOCKET_IMPL_ERROR_IPP
|
||||
#define BOOST_BEAST_WEBSOCKET_IMPL_ERROR_IPP
|
||||
|
||||
#include <boost/beast/websocket/error.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
namespace websocket {
|
||||
namespace detail {
|
||||
|
||||
class error_codes : public error_category
|
||||
{
|
||||
public:
|
||||
const char*
|
||||
name() const noexcept override
|
||||
{
|
||||
return "boost.beast.websocket";
|
||||
}
|
||||
|
||||
std::string
|
||||
message(int ev) const override
|
||||
{
|
||||
switch(static_cast<error>(ev))
|
||||
{
|
||||
default:
|
||||
case error::closed: return "The WebSocket stream was gracefully closed at both endpoints";
|
||||
case error::buffer_overflow: return "The WebSocket operation caused a dynamic buffer overflow";
|
||||
case error::partial_deflate_block: return "The WebSocket stream produced an incomplete deflate block";
|
||||
case error::message_too_big: return "The WebSocket message exceeded the locally configured limit";
|
||||
|
||||
case error::bad_http_version: return "The WebSocket handshake was not HTTP/1.1";
|
||||
case error::bad_method: return "The WebSocket handshake method was not GET";
|
||||
case error::no_host: return "The WebSocket handshake Host field is missing";
|
||||
case error::no_connection: return "The WebSocket handshake Connection field is missing";
|
||||
case error::no_connection_upgrade: return "The WebSocket handshake Connection field is missing the upgrade token";
|
||||
case error::no_upgrade: return "The WebSocket handshake Upgrade field is missing";
|
||||
case error::no_upgrade_websocket: return "The WebSocket handshake Upgrade field is missing the websocket token";
|
||||
case error::no_sec_key: return "The WebSocket handshake Sec-WebSocket-Key field is missing";
|
||||
case error::bad_sec_key: return "The WebSocket handshake Sec-WebSocket-Key field is invalid";
|
||||
case error::no_sec_version: return "The WebSocket handshake Sec-WebSocket-Version field is missing";
|
||||
case error::bad_sec_version: return "The WebSocket handshake Sec-WebSocket-Version field is invalid";
|
||||
case error::no_sec_accept: return "The WebSocket handshake Sec-WebSocket-Accept field is missing";
|
||||
case error::bad_sec_accept: return "The WebSocket handshake Sec-WebSocket-Accept field is invalid";
|
||||
case error::upgrade_declined: return "The WebSocket handshake was declined by the remote peer";
|
||||
|
||||
case error::bad_opcode: return "The WebSocket frame contained an illegal opcode";
|
||||
case error::bad_data_frame: return "The WebSocket data frame was unexpected";
|
||||
case error::bad_continuation: return "The WebSocket continuation frame was unexpected";
|
||||
case error::bad_reserved_bits: return "The WebSocket frame contained illegal reserved bits";
|
||||
case error::bad_control_fragment: return "The WebSocket control frame was fragmented";
|
||||
case error::bad_control_size: return "The WebSocket control frame size was invalid";
|
||||
case error::bad_unmasked_frame: return "The WebSocket frame was unmasked";
|
||||
case error::bad_masked_frame: return "The WebSocket frame was masked";
|
||||
case error::bad_size: return "The WebSocket frame size was not canonical";
|
||||
case error::bad_frame_payload: return "The WebSocket frame payload was not valid utf8";
|
||||
case error::bad_close_code: return "The WebSocket close frame reason code was invalid";
|
||||
case error::bad_close_size: return "The WebSocket close frame payload size was invalid";
|
||||
case error::bad_close_payload: return "The WebSocket close frame payload was not valid utf8";
|
||||
}
|
||||
}
|
||||
|
||||
error_condition
|
||||
default_error_condition(int ev) const noexcept override
|
||||
{
|
||||
switch(static_cast<error>(ev))
|
||||
{
|
||||
default:
|
||||
case error::closed:
|
||||
case error::buffer_overflow:
|
||||
case error::partial_deflate_block:
|
||||
case error::message_too_big:
|
||||
return {ev, *this};
|
||||
|
||||
case error::bad_http_version:
|
||||
case error::bad_method:
|
||||
case error::no_host:
|
||||
case error::no_connection:
|
||||
case error::no_connection_upgrade:
|
||||
case error::no_upgrade:
|
||||
case error::no_upgrade_websocket:
|
||||
case error::no_sec_key:
|
||||
case error::bad_sec_key:
|
||||
case error::no_sec_version:
|
||||
case error::bad_sec_version:
|
||||
case error::no_sec_accept:
|
||||
case error::bad_sec_accept:
|
||||
case error::upgrade_declined:
|
||||
return condition::handshake_failed;
|
||||
|
||||
case error::bad_opcode:
|
||||
case error::bad_data_frame:
|
||||
case error::bad_continuation:
|
||||
case error::bad_reserved_bits:
|
||||
case error::bad_control_fragment:
|
||||
case error::bad_control_size:
|
||||
case error::bad_unmasked_frame:
|
||||
case error::bad_masked_frame:
|
||||
case error::bad_size:
|
||||
case error::bad_frame_payload:
|
||||
case error::bad_close_code:
|
||||
case error::bad_close_size:
|
||||
case error::bad_close_payload:
|
||||
return condition::protocol_violation;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class error_conditions : public error_category
|
||||
{
|
||||
public:
|
||||
const char*
|
||||
name() const noexcept override
|
||||
{
|
||||
return "boost.beast.websocket";
|
||||
}
|
||||
|
||||
std::string
|
||||
message(int cv) const override
|
||||
{
|
||||
switch(static_cast<condition>(cv))
|
||||
{
|
||||
default:
|
||||
case condition::handshake_failed: return "The WebSocket handshake failed";
|
||||
case condition::protocol_violation: return "A WebSocket protocol violation occurred";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // detail
|
||||
|
||||
error_code
|
||||
make_error_code(error e)
|
||||
{
|
||||
static detail::error_codes const cat{};
|
||||
return error_code{static_cast<
|
||||
std::underlying_type<error>::type>(e), cat};
|
||||
}
|
||||
|
||||
error_condition
|
||||
make_error_condition(condition c)
|
||||
{
|
||||
static detail::error_conditions const cat{};
|
||||
return error_condition{static_cast<
|
||||
std::underlying_type<condition>::type>(c), cat};
|
||||
}
|
||||
|
||||
} // websocket
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#endif
|
@ -124,7 +124,6 @@ public:
|
||||
};
|
||||
|
||||
template<class FwdIt>
|
||||
inline
|
||||
bool
|
||||
bitstream::
|
||||
fill(std::size_t n, FwdIt& first, FwdIt const& last)
|
||||
@ -140,7 +139,6 @@ fill(std::size_t n, FwdIt& first, FwdIt const& last)
|
||||
}
|
||||
|
||||
template<class FwdIt>
|
||||
inline
|
||||
void
|
||||
bitstream::
|
||||
fill_8(FwdIt& it)
|
||||
@ -150,7 +148,6 @@ fill_8(FwdIt& it)
|
||||
}
|
||||
|
||||
template<class FwdIt>
|
||||
inline
|
||||
void
|
||||
bitstream::
|
||||
fill_16(FwdIt& it)
|
||||
@ -162,7 +159,6 @@ fill_16(FwdIt& it)
|
||||
}
|
||||
|
||||
template<class Unsigned>
|
||||
inline
|
||||
void
|
||||
bitstream::
|
||||
peek(Unsigned& value, std::size_t n)
|
||||
@ -174,7 +170,6 @@ peek(Unsigned& value, std::size_t n)
|
||||
}
|
||||
|
||||
template<class Unsigned>
|
||||
inline
|
||||
void
|
||||
bitstream::
|
||||
read(Unsigned& value, std::size_t n)
|
||||
@ -188,7 +183,6 @@ read(Unsigned& value, std::size_t n)
|
||||
}
|
||||
|
||||
template<class BidirIt>
|
||||
inline
|
||||
void
|
||||
bitstream::
|
||||
rewind(BidirIt& it)
|
||||
|
File diff suppressed because it is too large
Load Diff
2292
include/boost/beast/zlib/detail/deflate_stream.ipp
Normal file
2292
include/boost/beast/zlib/detail/deflate_stream.ipp
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1118
include/boost/beast/zlib/detail/inflate_stream.ipp
Normal file
1118
include/boost/beast/zlib/detail/inflate_stream.ipp
Normal file
File diff suppressed because it is too large
Load Diff
@ -87,9 +87,7 @@ struct ranges
|
||||
|
||||
// Clamp u to v where u and v are different types
|
||||
template<class U, class V>
|
||||
inline
|
||||
U
|
||||
clamp(U u, V v)
|
||||
U clamp(U u, V v)
|
||||
{
|
||||
if(u > v)
|
||||
u = static_cast<U>(v);
|
||||
|
@ -76,88 +76,72 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
reset(int bits);
|
||||
|
||||
void
|
||||
read(std::uint8_t* out, std::size_t pos, std::size_t n);
|
||||
|
||||
template<class = void>
|
||||
void
|
||||
write(std::uint8_t const* in, std::size_t n);
|
||||
};
|
||||
|
||||
inline
|
||||
void
|
||||
window::
|
||||
reset(int bits)
|
||||
{
|
||||
if(bits_ != bits)
|
||||
{
|
||||
p_.reset();
|
||||
bits_ = static_cast<std::uint8_t>(bits);
|
||||
capacity_ = 1U << bits_;
|
||||
}
|
||||
i_ = 0;
|
||||
size_ = 0;
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
window::
|
||||
read(std::uint8_t* out, std::size_t pos, std::size_t n)
|
||||
{
|
||||
if(i_ >= size_)
|
||||
{
|
||||
// window is contiguous
|
||||
std::memcpy(out, &p_[i_ - pos], n);
|
||||
return;
|
||||
}
|
||||
auto i = ((i_ - pos) + capacity_) % capacity_;
|
||||
auto m = capacity_ - i;
|
||||
if(n <= m)
|
||||
{
|
||||
std::memcpy(out, &p_[i], n);
|
||||
return;
|
||||
}
|
||||
std::memcpy(out, &p_[i], m);
|
||||
out += m;
|
||||
std::memcpy(out, &p_[0], n - m);
|
||||
}
|
||||
|
||||
template<class>
|
||||
void
|
||||
window::
|
||||
write(std::uint8_t const* in, std::size_t n)
|
||||
{
|
||||
if(! p_)
|
||||
p_ = boost::make_unique<
|
||||
std::uint8_t[]>(capacity_);
|
||||
if(n >= capacity_)
|
||||
reset(int bits)
|
||||
{
|
||||
if(bits_ != bits)
|
||||
{
|
||||
p_.reset();
|
||||
bits_ = static_cast<std::uint8_t>(bits);
|
||||
capacity_ = 1U << bits_;
|
||||
}
|
||||
i_ = 0;
|
||||
size_ = capacity_;
|
||||
std::memcpy(&p_[0], in + (n - size_), size_);
|
||||
return;
|
||||
size_ = 0;
|
||||
}
|
||||
if(i_ + n <= capacity_)
|
||||
{
|
||||
std::memcpy(&p_[i_], in, n);
|
||||
if(size_ >= capacity_ - n)
|
||||
size_ = capacity_;
|
||||
else
|
||||
size_ = static_cast<std::uint16_t>(size_ + n);
|
||||
|
||||
i_ = static_cast<std::uint16_t>(
|
||||
(i_ + n) % capacity_);
|
||||
return;
|
||||
void
|
||||
read(std::uint8_t* out, std::size_t pos, std::size_t n)
|
||||
{
|
||||
if(i_ >= size_)
|
||||
{
|
||||
// window is contiguous
|
||||
std::memcpy(out, &p_[i_ - pos], n);
|
||||
return;
|
||||
}
|
||||
auto i = ((i_ - pos) + capacity_) % capacity_;
|
||||
auto m = capacity_ - i;
|
||||
if(n <= m)
|
||||
{
|
||||
std::memcpy(out, &p_[i], n);
|
||||
return;
|
||||
}
|
||||
std::memcpy(out, &p_[i], m);
|
||||
out += m;
|
||||
std::memcpy(out, &p_[0], n - m);
|
||||
}
|
||||
auto m = capacity_ - i_;
|
||||
std::memcpy(&p_[i_], in, m);
|
||||
in += m;
|
||||
i_ = static_cast<std::uint16_t>(n - m);
|
||||
std::memcpy(&p_[0], in, i_);
|
||||
size_ = capacity_;
|
||||
}
|
||||
|
||||
void
|
||||
write(std::uint8_t const* in, std::size_t n)
|
||||
{
|
||||
if(! p_)
|
||||
p_ = boost::make_unique<
|
||||
std::uint8_t[]>(capacity_);
|
||||
if(n >= capacity_)
|
||||
{
|
||||
i_ = 0;
|
||||
size_ = capacity_;
|
||||
std::memcpy(&p_[0], in + (n - size_), size_);
|
||||
return;
|
||||
}
|
||||
if(i_ + n <= capacity_)
|
||||
{
|
||||
std::memcpy(&p_[i_], in, n);
|
||||
if(size_ >= capacity_ - n)
|
||||
size_ = capacity_;
|
||||
else
|
||||
size_ = static_cast<std::uint16_t>(size_ + n);
|
||||
|
||||
i_ = static_cast<std::uint16_t>(
|
||||
(i_ + n) % capacity_);
|
||||
return;
|
||||
}
|
||||
auto m = capacity_ - i_;
|
||||
std::memcpy(&p_[i_], in, m);
|
||||
in += m;
|
||||
i_ = static_cast<std::uint16_t>(n - m);
|
||||
std::memcpy(&p_[0], in, i_);
|
||||
size_ = capacity_;
|
||||
}
|
||||
};
|
||||
|
||||
} // detail
|
||||
} // zlib
|
||||
|
@ -6,17 +6,6 @@
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_ZLIB_ERROR_HPP
|
||||
#define BOOST_BEAST_ZLIB_ERROR_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/error.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
namespace zlib {
|
||||
|
||||
// This is a derivative work based on Zlib, copyright below:
|
||||
/*
|
||||
Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
@ -45,7 +34,17 @@ namespace zlib {
|
||||
(zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
|
||||
*/
|
||||
|
||||
/** Error codes returned by the codec.
|
||||
#ifndef BOOST_BEAST_ZLIB_ERROR_HPP
|
||||
#define BOOST_BEAST_ZLIB_ERROR_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/error.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
namespace zlib {
|
||||
|
||||
/** Error codes returned by the deflate codecs.
|
||||
*/
|
||||
enum class error
|
||||
{
|
||||
@ -133,7 +132,7 @@ enum class error
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#include <boost/beast/zlib/impl/error.ipp>
|
||||
#include <boost/beast/zlib/impl/error.hpp>
|
||||
|
||||
#endif
|
||||
|
||||
|
67
include/boost/beast/zlib/impl/error.hpp
Normal file
67
include/boost/beast/zlib/impl/error.hpp
Normal file
@ -0,0 +1,67 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
// This is a derivative work based on Zlib, copyright below:
|
||||
/*
|
||||
Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Jean-loup Gailly Mark Adler
|
||||
jloup@gzip.org madler@alumni.caltech.edu
|
||||
|
||||
The data format used by the zlib library is described by RFCs (Request for
|
||||
Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950
|
||||
(zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
|
||||
*/
|
||||
|
||||
#ifndef BOOST_BEAST_ZLIB_IMPL_ERROR_HPP
|
||||
#define BOOST_BEAST_ZLIB_IMPL_ERROR_HPP
|
||||
|
||||
namespace boost {
|
||||
namespace system {
|
||||
template<>
|
||||
struct is_error_code_enum<::boost::beast::zlib::error>
|
||||
{
|
||||
static bool const value = true;
|
||||
};
|
||||
} // system
|
||||
} // boost
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
namespace zlib {
|
||||
|
||||
BOOST_BEAST_DECL
|
||||
error_code
|
||||
make_error_code(error ev);
|
||||
|
||||
} // zlib
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
#ifdef BOOST_BEAST_HEADER_ONLY
|
||||
#include <boost/beast/zlib/impl/error.ipp>
|
||||
#endif
|
||||
|
||||
#endif
|
@ -6,6 +6,7 @@
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
// This is a derivative work based on Zlib, copyright below:
|
||||
/*
|
||||
Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
@ -37,30 +38,21 @@
|
||||
#ifndef BOOST_BEAST_ZLIB_IMPL_ERROR_IPP
|
||||
#define BOOST_BEAST_ZLIB_IMPL_ERROR_IPP
|
||||
|
||||
#include <boost/beast/core/error.hpp>
|
||||
#include <boost/beast/zlib/error.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace system {
|
||||
template<>
|
||||
struct is_error_code_enum<beast::zlib::error>
|
||||
{
|
||||
static bool const value = true;
|
||||
};
|
||||
} // system
|
||||
|
||||
namespace beast {
|
||||
namespace zlib {
|
||||
namespace detail {
|
||||
|
||||
class zlib_error_category : public error_category
|
||||
class error_codes : public error_category
|
||||
{
|
||||
public:
|
||||
const char*
|
||||
name() const noexcept override
|
||||
{
|
||||
return "beast.zlib";
|
||||
return "boost.beast.zlib";
|
||||
}
|
||||
|
||||
std::string
|
||||
@ -114,23 +106,14 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
inline
|
||||
error_category const&
|
||||
get_error_category()
|
||||
{
|
||||
static zlib_error_category const cat{};
|
||||
return cat;
|
||||
}
|
||||
|
||||
} // detail
|
||||
|
||||
inline
|
||||
error_code
|
||||
make_error_code(error ev)
|
||||
{
|
||||
return error_code{
|
||||
static_cast<std::underlying_type<error>::type>(ev),
|
||||
detail::get_error_category()};
|
||||
static detail::error_codes const cat{};
|
||||
return error_code{static_cast<
|
||||
std::underlying_type<error>::type>(ev), cat};
|
||||
}
|
||||
|
||||
} // zlib
|
||||
|
@ -6,13 +6,6 @@
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_ZLIB_INFLATE_STREAM_HPP
|
||||
#define BOOST_BEAST_ZLIB_INFLATE_STREAM_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/zlib/detail/inflate_stream.hpp>
|
||||
|
||||
// This is a derivative work based on Zlib, copyright below:
|
||||
/*
|
||||
Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
@ -41,6 +34,12 @@
|
||||
(zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
|
||||
*/
|
||||
|
||||
#ifndef BOOST_BEAST_ZLIB_INFLATE_STREAM_HPP
|
||||
#define BOOST_BEAST_ZLIB_INFLATE_STREAM_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/zlib/detail/inflate_stream.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
namespace zlib {
|
||||
|
@ -6,14 +6,6 @@
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#ifndef BOOST_BEAST_ZLIB_ZLIB_HPP
|
||||
#define BOOST_BEAST_ZLIB_ZLIB_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
|
||||
// This is a derivative work based on Zlib, copyright below:
|
||||
/*
|
||||
Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
@ -42,6 +34,13 @@
|
||||
(zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
|
||||
*/
|
||||
|
||||
#ifndef BOOST_BEAST_ZLIB_ZLIB_HPP
|
||||
#define BOOST_BEAST_ZLIB_ZLIB_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
namespace zlib {
|
||||
|
@ -7,6 +7,7 @@
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/detail/sha1.hpp>
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||
#include <array>
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||
#include <boost/beast/core/flat_buffer.hpp>
|
||||
#include <boost/beast/core/stream_traits.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
#include <boost/beast/core/tcp_stream.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
#include <boost/beast/http/empty_body.hpp>
|
||||
@ -24,6 +25,7 @@
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <boost/asio/spawn.hpp>
|
||||
#include <boost/asio/strand.hpp>
|
||||
#include <boost/asio/write.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <array>
|
||||
#include <thread>
|
||||
@ -1218,7 +1220,6 @@ public:
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
void process_http_1 (tcp_stream& stream, net::yield_context yield)
|
||||
{
|
||||
flat_buffer buffer;
|
||||
|
@ -24,11 +24,12 @@ public:
|
||||
check(char const* name, error ev)
|
||||
{
|
||||
auto const ec = make_error_code(ev);
|
||||
auto const& cat =
|
||||
make_error_code(static_cast<http::error>(0)).category();
|
||||
auto const& cat = make_error_code(
|
||||
static_cast<http::error>(0)).category();
|
||||
BEAST_EXPECT(std::string(ec.category().name()) == name);
|
||||
BEAST_EXPECT(! ec.message().empty());
|
||||
BEAST_EXPECT(std::addressof(ec.category()) == std::addressof(cat));
|
||||
BEAST_EXPECT(
|
||||
std::addressof(ec.category()) == std::addressof(cat));
|
||||
BEAST_EXPECT(cat.equivalent(
|
||||
static_cast<std::underlying_type<error>::type>(ev),
|
||||
ec.category().default_error_condition(
|
||||
|
@ -470,8 +470,9 @@ public:
|
||||
if(se.code() == test::error::test_failure)
|
||||
throw;
|
||||
BEAST_EXPECTS(se.code().category() ==
|
||||
zlib::detail::get_error_category(),
|
||||
se.code().message());
|
||||
make_error_code(static_cast<
|
||||
zlib::error>(0)).category(),
|
||||
se.code().message());
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
|
@ -23,38 +23,40 @@ public:
|
||||
void check(char const* name, error ev)
|
||||
{
|
||||
auto const ec = make_error_code(ev);
|
||||
auto const& cat = make_error_code(
|
||||
static_cast<zlib::error>(0)).category();
|
||||
BEAST_EXPECT(std::string{ec.category().name()} == name);
|
||||
BEAST_EXPECT(! ec.message().empty());
|
||||
BEAST_EXPECT(std::addressof(ec.category()) ==
|
||||
std::addressof(detail::get_error_category()));
|
||||
BEAST_EXPECT(detail::get_error_category().equivalent(
|
||||
BEAST_EXPECT(
|
||||
std::addressof(ec.category()) == std::addressof(cat));
|
||||
BEAST_EXPECT(cat.equivalent(
|
||||
static_cast<std::underlying_type<error>::type>(ev),
|
||||
ec.category().default_error_condition(
|
||||
static_cast<std::underlying_type<error>::type>(ev))));
|
||||
BEAST_EXPECT(detail::get_error_category().equivalent(
|
||||
ec, static_cast<std::underlying_type<error>::type>(ev)));
|
||||
BEAST_EXPECT(cat.equivalent(ec,
|
||||
static_cast<std::underlying_type<error>::type>(ev)));
|
||||
}
|
||||
|
||||
void run() override
|
||||
{
|
||||
check("beast.zlib", error::need_buffers);
|
||||
check("beast.zlib", error::end_of_stream);
|
||||
check("beast.zlib", error::stream_error);
|
||||
check("boost.beast.zlib", error::need_buffers);
|
||||
check("boost.beast.zlib", error::end_of_stream);
|
||||
check("boost.beast.zlib", error::stream_error);
|
||||
|
||||
check("beast.zlib", error::invalid_block_type);
|
||||
check("beast.zlib", error::invalid_stored_length);
|
||||
check("beast.zlib", error::too_many_symbols);
|
||||
check("beast.zlib", error::invalid_code_lenths);
|
||||
check("beast.zlib", error::invalid_bit_length_repeat);
|
||||
check("beast.zlib", error::missing_eob);
|
||||
check("beast.zlib", error::invalid_literal_length);
|
||||
check("beast.zlib", error::invalid_distance_code);
|
||||
check("beast.zlib", error::invalid_distance);
|
||||
check("boost.beast.zlib", error::invalid_block_type);
|
||||
check("boost.beast.zlib", error::invalid_stored_length);
|
||||
check("boost.beast.zlib", error::too_many_symbols);
|
||||
check("boost.beast.zlib", error::invalid_code_lenths);
|
||||
check("boost.beast.zlib", error::invalid_bit_length_repeat);
|
||||
check("boost.beast.zlib", error::missing_eob);
|
||||
check("boost.beast.zlib", error::invalid_literal_length);
|
||||
check("boost.beast.zlib", error::invalid_distance_code);
|
||||
check("boost.beast.zlib", error::invalid_distance);
|
||||
|
||||
check("beast.zlib", error::over_subscribed_length);
|
||||
check("beast.zlib", error::incomplete_length_set);
|
||||
check("boost.beast.zlib", error::over_subscribed_length);
|
||||
check("boost.beast.zlib", error::incomplete_length_set);
|
||||
|
||||
check("beast.zlib", error::general);
|
||||
check("boost.beast.zlib", error::general);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
15
test/lib_beast.cpp
Normal file
15
test/lib_beast.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
// This file is used to build the asio stbeastatic library,
|
||||
// used with BOOST_BEAST_SPLIT_COMPILATION which helps
|
||||
// reduce compilation time
|
||||
|
||||
#include <boost/beast/src.hpp>
|
||||
//#include <boost/beast/ssl/impl/src.hpp>
|
Reference in New Issue
Block a user