mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Update to Beast 1.0.0-b34:
Merge commit 'd8dea963fa5dc26b4be699ce6d4bf699a429ca92' into develop
This commit is contained in:
27
src/beast/include/beast/config.hpp
Normal file
27
src/beast/include/beast/config.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// Copyright (c) 2013-2017 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)
|
||||
//
|
||||
|
||||
#ifndef BEAST_CONFIG_HPP
|
||||
#define BEAST_CONFIG_HPP
|
||||
|
||||
/*
|
||||
_MSC_VER and _MSC_FULL_VER by version:
|
||||
|
||||
14.0 (2015) 1900 190023026
|
||||
14.0 (2015 Update 1) 1900 190023506
|
||||
14.0 (2015 Update 2) 1900 190023918
|
||||
14.0 (2015 Update 3) 1900 190024210
|
||||
*/
|
||||
|
||||
#if defined(_MSC_FULL_VER)
|
||||
#if _MSC_FULL_VER < 190024210
|
||||
static_assert(false,
|
||||
"This library requires Visual Studio 2015 Update 3 or later");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -8,6 +8,8 @@
|
||||
#ifndef BEAST_CORE_HPP
|
||||
#define BEAST_CORE_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
|
||||
#include <beast/core/async_completion.hpp>
|
||||
#include <beast/core/bind_handler.hpp>
|
||||
#include <beast/core/buffer_cat.hpp>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_ASYNC_COMPLETION_HPP
|
||||
#define BEAST_ASYNC_COMPLETION_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/handler_concepts.hpp>
|
||||
#include <boost/asio/async_result.hpp>
|
||||
#include <boost/asio/handler_type.hpp>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_BIND_HANDLER_HPP
|
||||
#define BEAST_BIND_HANDLER_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/handler_concepts.hpp>
|
||||
#include <beast/core/detail/bind_handler.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_BUFFER_CAT_HPP
|
||||
#define BEAST_BUFFER_CAT_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/detail/buffer_cat.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_BUFFER_CONCEPTS_HPP
|
||||
#define BEAST_BUFFER_CONCEPTS_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/detail/buffer_concepts.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_BUFFERS_ADAPTER_HPP
|
||||
#define BEAST_BUFFERS_ADAPTER_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/buffer_concepts.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_CONSUMING_BUFFERS_HPP
|
||||
#define BEAST_CONSUMING_BUFFERS_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/buffer_concepts.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_DYNABUF_READSTREAM_HPP
|
||||
#define BEAST_DYNABUF_READSTREAM_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/async_completion.hpp>
|
||||
#include <beast/core/buffer_concepts.hpp>
|
||||
#include <beast/core/error.hpp>
|
||||
@@ -145,6 +146,13 @@ public:
|
||||
return next_layer_;
|
||||
}
|
||||
|
||||
/// Get a const reference to the next layer.
|
||||
next_layer_type const&
|
||||
next_layer() const
|
||||
{
|
||||
return next_layer_;
|
||||
}
|
||||
|
||||
/// Get a reference to the lowest layer.
|
||||
lowest_layer_type&
|
||||
lowest_layer()
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_ERROR_HPP
|
||||
#define BEAST_ERROR_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <boost/system/error_code.hpp>
|
||||
#include <boost/system/system_error.hpp>
|
||||
|
||||
@@ -22,6 +23,14 @@ using system_error = boost::system::system_error;
|
||||
/// The type of error category used by the library
|
||||
using error_category = boost::system::error_category;
|
||||
|
||||
/// A function to return the system error category used by the library
|
||||
#if GENERATING_DOCS
|
||||
error_category const&
|
||||
system_category();
|
||||
#else
|
||||
using boost::system::system_category;
|
||||
#endif
|
||||
|
||||
/// The type of error condition used by the library
|
||||
using error_condition = boost::system::error_condition;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_HANDLER_ALLOC_HPP
|
||||
#define BEAST_HANDLER_ALLOC_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/handler_helpers.hpp>
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_HANDLER_CONCEPTS_HPP
|
||||
#define BEAST_HANDLER_CONCEPTS_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/detail/is_call_possible.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_HANDLER_HELPERS_HPP
|
||||
#define BEAST_HANDLER_HELPERS_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <boost/asio/handler_alloc_hook.hpp>
|
||||
#include <boost/asio/handler_continuation_hook.hpp>
|
||||
#include <boost/asio/handler_invoke_hook.hpp>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_HANDLER_PTR_HPP
|
||||
#define BEAST_HANDLER_PTR_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/detail/type_traits.hpp>
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_PLACEHOLDERS_HPP
|
||||
#define BEAST_PLACEHOLDERS_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <functional>
|
||||
|
||||
namespace beast {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_PREPARE_BUFFER_HPP
|
||||
#define BEAST_PREPARE_BUFFER_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_PREPARE_BUFFERS_HPP
|
||||
#define BEAST_PREPARE_BUFFERS_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/detail/prepare_buffers.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_STATIC_STREAMBUF_HPP
|
||||
#define BEAST_STATIC_STREAMBUF_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <boost/utility/base_from_member.hpp>
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_WEBSOCKET_STATIC_STRING_HPP
|
||||
#define BEAST_WEBSOCKET_STATIC_STRING_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/detail/type_traits.hpp>
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_STREAM_CONCEPTS_HPP
|
||||
#define BEAST_STREAM_CONCEPTS_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/detail/stream_concepts.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_STREAMBUF_HPP
|
||||
#define BEAST_STREAMBUF_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/detail/empty_base_optimization.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/intrusive/list.hpp>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_TO_STRING_HPP
|
||||
#define BEAST_TO_STRING_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/buffer_concepts.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <string>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_WRITE_DYNABUF_HPP
|
||||
#define BEAST_WRITE_DYNABUF_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/buffer_concepts.hpp>
|
||||
#include <beast/core/detail/write_dynabuf.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#ifndef BEAST_HTTP_HPP
|
||||
#define BEAST_HTTP_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
|
||||
#include <beast/http/basic_fields.hpp>
|
||||
#include <beast/http/basic_parser_v1.hpp>
|
||||
#include <beast/http/chunk_encode.hpp>
|
||||
@@ -19,7 +21,6 @@
|
||||
#include <beast/http/parser_v1.hpp>
|
||||
#include <beast/http/read.hpp>
|
||||
#include <beast/http/reason.hpp>
|
||||
#include <beast/http/resume_context.hpp>
|
||||
#include <beast/http/rfc7230.hpp>
|
||||
#include <beast/http/streambuf_body.hpp>
|
||||
#include <beast/http/string_body.hpp>
|
||||
|
||||
@@ -8,12 +8,11 @@
|
||||
#ifndef BEAST_HTTP_BASIC_DYNABUF_BODY_HPP
|
||||
#define BEAST_HTTP_BASIC_DYNABUF_BODY_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/error.hpp>
|
||||
#include <beast/http/message.hpp>
|
||||
#include <beast/http/resume_context.hpp>
|
||||
#include <beast/core/detail/type_traits.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/logic/tribool.hpp>
|
||||
|
||||
namespace beast {
|
||||
namespace http {
|
||||
@@ -87,9 +86,8 @@ private:
|
||||
}
|
||||
|
||||
template<class WriteFunction>
|
||||
boost::tribool
|
||||
write(resume_context&&, error_code&,
|
||||
WriteFunction&& wf) noexcept
|
||||
bool
|
||||
write(error_code&, WriteFunction&& wf) noexcept
|
||||
{
|
||||
wf(body_.data());
|
||||
return true;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_HTTP_BASIC_FIELDS_HPP
|
||||
#define BEAST_HTTP_BASIC_FIELDS_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/detail/empty_base_optimization.hpp>
|
||||
#include <beast/http/detail/basic_fields.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_HTTP_BASIC_PARSER_v1_HPP
|
||||
#define BEAST_HTTP_BASIC_PARSER_v1_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/http/message.hpp>
|
||||
#include <beast/http/parse_error.hpp>
|
||||
#include <beast/http/rfc7230.hpp>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_HTTP_CHUNK_ENCODE_HPP
|
||||
#define BEAST_HTTP_CHUNK_ENCODE_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/buffer_cat.hpp>
|
||||
#include <beast/http/detail/chunk_encode.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
|
||||
@@ -8,11 +8,10 @@
|
||||
#ifndef BEAST_HTTP_TYPE_CHECK_HPP
|
||||
#define BEAST_HTTP_TYPE_CHECK_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/error.hpp>
|
||||
#include <beast/core/detail/type_traits.hpp>
|
||||
#include <beast/http/resume_context.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/logic/tribool.hpp>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
@@ -50,38 +49,6 @@ struct has_content_length<T, beast::detail::void_t<decltype(
|
||||
"Writer::content_length requirements not met");
|
||||
};
|
||||
|
||||
#if 0
|
||||
template<class T, class M, class = beast::detail::void_t<>>
|
||||
struct is_Writer : std::false_type {};
|
||||
|
||||
template<class T, class M>
|
||||
struct is_Writer<T, M, beast::detail::void_t<decltype(
|
||||
std::declval<T>().init(
|
||||
std::declval<error_code&>())
|
||||
// VFALCO This is unfortunate, we have to provide the template
|
||||
// argument type because this is not a deduced context?
|
||||
//
|
||||
,std::declval<T>().template write<detail::write_function>(
|
||||
std::declval<resume_context>(),
|
||||
std::declval<error_code&>(),
|
||||
std::declval<detail::write_function>())
|
||||
)> > : std::integral_constant<bool,
|
||||
std::is_nothrow_constructible<T, M const&>::value &&
|
||||
std::is_convertible<decltype(
|
||||
std::declval<T>().template write<detail::write_function>(
|
||||
std::declval<resume_context>(),
|
||||
std::declval<error_code&>(),
|
||||
std::declval<detail::write_function>())),
|
||||
boost::tribool>::value
|
||||
>
|
||||
{
|
||||
static_assert(std::is_same<
|
||||
typename M::body_type::writer, T>::value,
|
||||
"Mismatched writer and message");
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template<class T, class M>
|
||||
class is_Writer
|
||||
{
|
||||
@@ -99,10 +66,9 @@ class is_Writer
|
||||
template<class U, class R =
|
||||
std::is_convertible<decltype(
|
||||
std::declval<U>().template write<detail::write_function>(
|
||||
std::declval<resume_context>(),
|
||||
std::declval<error_code&>(),
|
||||
std::declval<detail::write_function>()))
|
||||
, boost::tribool>>
|
||||
, bool>>
|
||||
static R check2(int);
|
||||
template<class>
|
||||
static std::false_type check2(...);
|
||||
@@ -120,8 +86,6 @@ public:
|
||||
>;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
template<class T>
|
||||
class is_Parser
|
||||
{
|
||||
|
||||
@@ -8,12 +8,11 @@
|
||||
#ifndef BEAST_HTTP_EMPTY_BODY_HPP
|
||||
#define BEAST_HTTP_EMPTY_BODY_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/error.hpp>
|
||||
#include <beast/http/message.hpp>
|
||||
#include <beast/http/resume_context.hpp>
|
||||
#include <beast/core/detail/type_traits.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/logic/tribool.hpp>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
@@ -59,9 +58,8 @@ private:
|
||||
}
|
||||
|
||||
template<class WriteFunction>
|
||||
boost::tribool
|
||||
write(resume_context&&, error_code&,
|
||||
WriteFunction&& wf) noexcept
|
||||
bool
|
||||
write(error_code&, WriteFunction&& wf) noexcept
|
||||
{
|
||||
wf(boost::asio::null_buffers{});
|
||||
return true;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_HTTP_FIELDS_HPP
|
||||
#define BEAST_HTTP_FIELDS_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/http/basic_fields.hpp>
|
||||
#include <memory>
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_HTTP_HEADERS_PARSER_V1_HPP
|
||||
#define BEAST_HTTP_HEADERS_PARSER_V1_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/http/basic_parser_v1.hpp>
|
||||
#include <beast/http/concepts.hpp>
|
||||
#include <beast/http/message.hpp>
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#define BEAST_HTTP_IMPL_WRITE_IPP
|
||||
|
||||
#include <beast/http/concepts.hpp>
|
||||
#include <beast/http/resume_context.hpp>
|
||||
#include <beast/http/chunk_encode.hpp>
|
||||
#include <beast/core/buffer_cat.hpp>
|
||||
#include <beast/core/bind_handler.hpp>
|
||||
@@ -21,7 +20,6 @@
|
||||
#include <beast/core/write_dynabuf.hpp>
|
||||
#include <beast/core/detail/sync_ostream.hpp>
|
||||
#include <boost/asio/write.hpp>
|
||||
#include <boost/logic/tribool.hpp>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include <ostream>
|
||||
@@ -296,8 +294,6 @@ class write_op
|
||||
// VFALCO How do we use handler_alloc in write_preparation?
|
||||
write_preparation<
|
||||
isRequest, Body, Fields> wp;
|
||||
resume_context resume;
|
||||
resume_context copy;
|
||||
int state = 0;
|
||||
|
||||
data(Handler& handler, Stream& s_,
|
||||
@@ -375,27 +371,9 @@ public:
|
||||
: d_(std::forward<DeducedHandler>(h),
|
||||
s, std::forward<Args>(args)...)
|
||||
{
|
||||
auto& d = *d_;
|
||||
auto sp = d_;
|
||||
d.resume = {
|
||||
[sp]() mutable
|
||||
{
|
||||
write_op self{std::move(sp)};
|
||||
self.d_->cont = false;
|
||||
auto& ios = self.d_->s.get_io_service();
|
||||
ios.dispatch(bind_handler(std::move(self),
|
||||
error_code{}, 0, false));
|
||||
}};
|
||||
d.copy = d.resume;
|
||||
(*this)(error_code{}, 0, false);
|
||||
}
|
||||
|
||||
explicit
|
||||
write_op(handler_ptr<data, Handler> d)
|
||||
: d_(std::move(d))
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
operator()(error_code ec,
|
||||
std::size_t bytes_transferred, bool again = true);
|
||||
@@ -460,8 +438,9 @@ operator()(error_code ec, std::size_t, bool again)
|
||||
|
||||
case 1:
|
||||
{
|
||||
boost::tribool const result = d.wp.w.write(
|
||||
std::move(d.copy), ec, writef0_lambda{*this});
|
||||
auto const result =
|
||||
d.wp.w.write(ec,
|
||||
writef0_lambda{*this});
|
||||
if(ec)
|
||||
{
|
||||
// call handler
|
||||
@@ -470,12 +449,6 @@ operator()(error_code ec, std::size_t, bool again)
|
||||
std::move(*this), ec, false));
|
||||
return;
|
||||
}
|
||||
if(boost::indeterminate(result))
|
||||
{
|
||||
// suspend
|
||||
d.copy = d.resume;
|
||||
return;
|
||||
}
|
||||
if(result)
|
||||
d.state = d.wp.chunked ? 4 : 5;
|
||||
else
|
||||
@@ -491,20 +464,15 @@ operator()(error_code ec, std::size_t, bool again)
|
||||
|
||||
case 3:
|
||||
{
|
||||
boost::tribool result = d.wp.w.write(
|
||||
std::move(d.copy), ec, writef_lambda{*this});
|
||||
auto const result =
|
||||
d.wp.w.write(ec,
|
||||
writef_lambda{*this});
|
||||
if(ec)
|
||||
{
|
||||
// call handler
|
||||
d.state = 99;
|
||||
break;
|
||||
}
|
||||
if(boost::indeterminate(result))
|
||||
{
|
||||
// suspend
|
||||
d.copy = d.resume;
|
||||
return;
|
||||
}
|
||||
if(result)
|
||||
d.state = d.wp.chunked ? 4 : 5;
|
||||
else
|
||||
@@ -533,8 +501,6 @@ operator()(error_code ec, std::size_t, bool again)
|
||||
break;
|
||||
}
|
||||
}
|
||||
d.copy = {};
|
||||
d.resume = {};
|
||||
d_.invoke(ec);
|
||||
}
|
||||
|
||||
@@ -640,37 +606,12 @@ write(SyncWriteStream& stream,
|
||||
wp.init(ec);
|
||||
if(ec)
|
||||
return;
|
||||
std::mutex m;
|
||||
std::condition_variable cv;
|
||||
bool ready = false;
|
||||
resume_context resume{
|
||||
[&]
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m);
|
||||
ready = true;
|
||||
cv.notify_one();
|
||||
}};
|
||||
auto copy = resume;
|
||||
boost::tribool result =
|
||||
wp.w.write(std::move(copy), ec,
|
||||
detail::writef0_lambda<SyncWriteStream,
|
||||
decltype(wp.sb)>{stream,
|
||||
wp.sb, wp.chunked, ec});
|
||||
auto result = wp.w.write(
|
||||
ec, detail::writef0_lambda<
|
||||
SyncWriteStream, decltype(wp.sb)>{
|
||||
stream, wp.sb, wp.chunked, ec});
|
||||
if(ec)
|
||||
return;
|
||||
if(boost::indeterminate(result))
|
||||
{
|
||||
copy = resume;
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m);
|
||||
cv.wait(lock, [&]{ return ready; });
|
||||
ready = false;
|
||||
}
|
||||
boost::asio::write(stream, wp.sb.data(), ec);
|
||||
if(ec)
|
||||
return;
|
||||
result = false;
|
||||
}
|
||||
wp.sb.consume(wp.sb.size());
|
||||
if(! result)
|
||||
{
|
||||
@@ -678,17 +619,11 @@ write(SyncWriteStream& stream,
|
||||
stream, wp.chunked, ec};
|
||||
for(;;)
|
||||
{
|
||||
result = wp.w.write(std::move(copy), ec, wf);
|
||||
result = wp.w.write(ec, wf);
|
||||
if(ec)
|
||||
return;
|
||||
if(result)
|
||||
break;
|
||||
if(! result)
|
||||
continue;
|
||||
copy = resume;
|
||||
std::unique_lock<std::mutex> lock(m);
|
||||
cv.wait(lock, [&]{ return ready; });
|
||||
ready = false;
|
||||
}
|
||||
}
|
||||
if(wp.chunked)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_HTTP_MESSAGE_HPP
|
||||
#define BEAST_HTTP_MESSAGE_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/http/fields.hpp>
|
||||
#include <beast/core/detail/integer_sequence.hpp>
|
||||
#include <memory>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_HTTP_PARSE_HPP
|
||||
#define BEAST_HTTP_PARSE_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/error.hpp>
|
||||
#include <beast/core/async_completion.hpp>
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_HTTP_PARSE_ERROR_HPP
|
||||
#define BEAST_HTTP_PARSE_ERROR_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/error.hpp>
|
||||
|
||||
namespace beast {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_HTTP_PARSER_V1_HPP
|
||||
#define BEAST_HTTP_PARSER_V1_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/http/concepts.hpp>
|
||||
#include <beast/http/header_parser_v1.hpp>
|
||||
#include <beast/http/message.hpp>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_HTTP_READ_HPP
|
||||
#define BEAST_HTTP_READ_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/async_completion.hpp>
|
||||
#include <beast/core/error.hpp>
|
||||
#include <beast/http/message.hpp>
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#ifndef BEAST_HTTP_REASON_HPP
|
||||
#define BEAST_HTTP_REASON_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
|
||||
namespace beast {
|
||||
namespace http {
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2013-2017 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)
|
||||
//
|
||||
|
||||
#ifndef BEAST_HTTP_RESUME_CONTEXT_HPP
|
||||
#define BEAST_HTTP_RESUME_CONTEXT_HPP
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace beast {
|
||||
namespace http {
|
||||
|
||||
/** A functor that resumes a write operation.
|
||||
|
||||
An rvalue reference to an object of this type is provided by the
|
||||
write implementation to the `writer` associated with the body of
|
||||
a message being sent.
|
||||
|
||||
If it is desired that the `writer` suspend the write operation (for
|
||||
example, to wait until data is ready), it can take ownership of
|
||||
the resume context using a move. Then, it returns `boost::indeterminate`
|
||||
to indicate that the write operation should suspend. Later, the calling
|
||||
code invokes the resume function and the write operation continues
|
||||
from where it left off.
|
||||
*/
|
||||
using resume_context = std::function<void(void)>;
|
||||
|
||||
} // http
|
||||
} // beast
|
||||
|
||||
#endif
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_HTTP_RFC7230_HPP
|
||||
#define BEAST_HTTP_RFC7230_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/http/detail/rfc7230.hpp>
|
||||
|
||||
namespace beast {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_HTTP_STREAMBUF_BODY_HPP
|
||||
#define BEAST_HTTP_STREAMBUF_BODY_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/http/basic_dynabuf_body.hpp>
|
||||
#include <beast/core/streambuf.hpp>
|
||||
|
||||
|
||||
@@ -8,12 +8,11 @@
|
||||
#ifndef BEAST_HTTP_STRING_BODY_HPP
|
||||
#define BEAST_HTTP_STRING_BODY_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/error.hpp>
|
||||
#include <beast/http/message.hpp>
|
||||
#include <beast/http/resume_context.hpp>
|
||||
#include <beast/core/detail/type_traits.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/logic/tribool.hpp>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
@@ -87,9 +86,8 @@ private:
|
||||
}
|
||||
|
||||
template<class WriteFunction>
|
||||
boost::tribool
|
||||
write(resume_context&&, error_code&,
|
||||
WriteFunction&& wf) noexcept
|
||||
bool
|
||||
write(error_code&, WriteFunction&& wf) noexcept
|
||||
{
|
||||
wf(boost::asio::buffer(body_));
|
||||
return true;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_HTTP_WRITE_HPP
|
||||
#define BEAST_HTTP_WRITE_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/http/message.hpp>
|
||||
#include <beast/core/error.hpp>
|
||||
#include <beast/core/async_completion.hpp>
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#ifndef BEAST_VERSION_HPP
|
||||
#define BEAST_VERSION_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
|
||||
// follows http://semver.org
|
||||
|
||||
// BEAST_VERSION % 100 is the patch level
|
||||
@@ -16,6 +18,6 @@
|
||||
//
|
||||
#define BEAST_VERSION 100000
|
||||
|
||||
#define BEAST_VERSION_STRING "1.0.0-b30"
|
||||
#define BEAST_VERSION_STRING "1.0.0-b34"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#ifndef BEAST_WEBSOCKET_HPP
|
||||
#define BEAST_WEBSOCKET_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
|
||||
#include <beast/websocket/error.hpp>
|
||||
#include <beast/websocket/option.hpp>
|
||||
#include <beast/websocket/rfc6455.hpp>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_WEBSOCKET_ERROR_HPP
|
||||
#define BEAST_WEBSOCKET_ERROR_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/error.hpp>
|
||||
|
||||
namespace beast {
|
||||
|
||||
@@ -1059,15 +1059,8 @@ operator()(error_code const& ec, bool again)
|
||||
case 0:
|
||||
// read payload
|
||||
d.state = 1;
|
||||
#if 0
|
||||
// VFALCO This causes dereference of null, because
|
||||
// the handler is moved from the data block
|
||||
// before asio_handler_deallocate is called.
|
||||
d.ws.async_read_frame(
|
||||
d.fi, d.db, std::move(*this));
|
||||
#else
|
||||
d.ws.async_read_frame(d.fi, d.db, *this);
|
||||
#endif
|
||||
return;
|
||||
|
||||
// got payload
|
||||
|
||||
@@ -770,6 +770,7 @@ write_frame(bool fin,
|
||||
fh.len = n;
|
||||
remain -= n;
|
||||
fh.fin = fin ? remain == 0 : false;
|
||||
wr_.cont = ! fh.fin;
|
||||
detail::fh_streambuf fh_buf;
|
||||
detail::write<static_streambuf>(fh_buf, fh);
|
||||
boost::asio::write(stream_,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_WEBSOCKET_OPTION_HPP
|
||||
#define BEAST_WEBSOCKET_OPTION_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/websocket/rfc6455.hpp>
|
||||
#include <beast/websocket/detail/decorator.hpp>
|
||||
#include <beast/core/detail/type_traits.hpp>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_WEBSOCKET_RFC6455_HPP
|
||||
#define BEAST_WEBSOCKET_RFC6455_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/static_string.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <array>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_WEBSOCKET_SSL_HPP
|
||||
#define BEAST_WEBSOCKET_SSL_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/websocket/teardown.hpp>
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <boost/asio/ssl/stream.hpp>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_WEBSOCKET_STREAM_HPP
|
||||
#define BEAST_WEBSOCKET_STREAM_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/websocket/option.hpp>
|
||||
#include <beast/websocket/detail/stream_base.hpp>
|
||||
#include <beast/http/message.hpp>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#ifndef BEAST_WEBSOCKET_TEARDOWN_HPP
|
||||
#define BEAST_WEBSOCKET_TEARDOWN_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/websocket/error.hpp>
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#ifndef BEAST_ZLIB_HPP
|
||||
#define BEAST_ZLIB_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
|
||||
#include <beast/zlib/deflate_stream.hpp>
|
||||
#include <beast/zlib/inflate_stream.hpp>
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#ifndef BEAST_ZLIB_DEFLATE_STREAM_HPP
|
||||
#define BEAST_ZLIB_DEFLATE_STREAM_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/zlib/error.hpp>
|
||||
#include <beast/zlib/zlib.hpp>
|
||||
#include <beast/zlib/detail/deflate_stream.hpp>
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#ifndef BEAST_ZLIB_ERROR_HPP
|
||||
#define BEAST_ZLIB_ERROR_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/core/error.hpp>
|
||||
|
||||
namespace beast {
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#ifndef BEAST_ZLIB_INFLATE_STREAM_HPP
|
||||
#define BEAST_ZLIB_INFLATE_STREAM_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <beast/zlib/detail/inflate_stream.hpp>
|
||||
|
||||
namespace beast {
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#ifndef BEAST_ZLIB_ZLIB_HPP
|
||||
#define BEAST_ZLIB_ZLIB_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user