mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-19 06:57:51 +08:00
1467 lines
49 KiB
Diff
1467 lines
49 KiB
Diff
|
diff -aruN a/include/boost/beast/core/detail/impl/read.hpp b/include/boost/beast/core/detail/impl/read.hpp
|
||
|
--- a/include/boost/beast/core/detail/impl/read.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/core/detail/impl/read.hpp 2020-05-02 13:50:11.141761700 -0400
|
||
|
@@ -214,7 +214,7 @@
|
||
|
class AsyncReadStream,
|
||
|
class DynamicBuffer,
|
||
|
class CompletionCondition,
|
||
|
- class ReadHandler,
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM2 ReadHandler,
|
||
|
class>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(ReadHandler)
|
||
|
async_read(
|
||
|
diff -aruN a/include/boost/beast/core/detail/is_invocable.hpp b/include/boost/beast/core/detail/is_invocable.hpp
|
||
|
--- a/include/boost/beast/core/detail/is_invocable.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/core/detail/is_invocable.hpp 2020-05-02 13:50:11.141761700 -0400
|
||
|
@@ -10,6 +10,8 @@
|
||
|
#ifndef BOOST_BEAST_DETAIL_IS_INVOCABLE_HPP
|
||
|
#define BOOST_BEAST_DETAIL_IS_INVOCABLE_HPP
|
||
|
|
||
|
+#include <boost/asio/async_result.hpp>
|
||
|
+#include <boost/type_traits/make_void.hpp>
|
||
|
#include <type_traits>
|
||
|
#include <utility>
|
||
|
|
||
|
@@ -51,6 +53,26 @@
|
||
|
};
|
||
|
/** @} */
|
||
|
|
||
|
+template<class CompletionToken, class Signature, class = void>
|
||
|
+struct is_completion_token_for : std::false_type
|
||
|
+{
|
||
|
+};
|
||
|
+
|
||
|
+struct any_initiation
|
||
|
+{
|
||
|
+ template<class...AnyArgs>
|
||
|
+ void operator()(AnyArgs&&...);
|
||
|
+};
|
||
|
+
|
||
|
+template<class CompletionToken, class R, class...Args>
|
||
|
+struct is_completion_token_for<
|
||
|
+ CompletionToken, R(Args...), boost::void_t<decltype(
|
||
|
+ boost::asio::async_initiate<CompletionToken, R(Args...)>(
|
||
|
+ any_initiation(), std::declval<CompletionToken&>())
|
||
|
+ )>> : std::true_type
|
||
|
+{
|
||
|
+};
|
||
|
+
|
||
|
} // detail
|
||
|
} // beast
|
||
|
} // boost
|
||
|
diff -aruN a/include/boost/beast/core/detail/read.hpp b/include/boost/beast/core/detail/read.hpp
|
||
|
--- a/include/boost/beast/core/detail/read.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/core/detail/read.hpp 2020-05-02 13:50:11.142761711 -0400
|
||
|
@@ -219,7 +219,7 @@
|
||
|
class AsyncReadStream,
|
||
|
class DynamicBuffer,
|
||
|
class CompletionCondition,
|
||
|
- class ReadHandler
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM2 ReadHandler
|
||
|
#if ! BOOST_BEAST_DOXYGEN
|
||
|
, class = typename std::enable_if<
|
||
|
is_async_read_stream<AsyncReadStream>::value &&
|
||
|
diff -aruN a/include/boost/beast/core/detect_ssl.hpp b/include/boost/beast/core/detect_ssl.hpp
|
||
|
--- a/include/boost/beast/core/detect_ssl.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/core/detect_ssl.hpp 2020-05-02 13:50:11.143761722 -0400
|
||
|
@@ -374,13 +374,13 @@
|
||
|
void operator()(
|
||
|
DetectHandler&& h,
|
||
|
AsyncReadStream* s, // references are passed as pointers
|
||
|
- DynamicBuffer& b)
|
||
|
+ DynamicBuffer* b)
|
||
|
{
|
||
|
detect_ssl_op<
|
||
|
typename std::decay<DetectHandler>::type,
|
||
|
AsyncReadStream,
|
||
|
DynamicBuffer>(
|
||
|
- std::forward<DetectHandler>(h), *s, b);
|
||
|
+ std::forward<DetectHandler>(h), *s, *b);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
@@ -439,7 +439,7 @@
|
||
|
detail::run_detect_ssl_op{},
|
||
|
token,
|
||
|
&stream, // pass the reference by pointer
|
||
|
- buffer);
|
||
|
+ &buffer);
|
||
|
}
|
||
|
|
||
|
//]
|
||
|
diff -aruN a/include/boost/beast/core/impl/basic_stream.hpp b/include/boost/beast/core/impl/basic_stream.hpp
|
||
|
--- a/include/boost/beast/core/impl/basic_stream.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/core/impl/basic_stream.hpp 2020-05-02 13:50:11.144761733 -0400
|
||
|
@@ -776,7 +776,7 @@
|
||
|
//------------------------------------------------------------------------------
|
||
|
|
||
|
template<class Protocol, class Executor, class RatePolicy>
|
||
|
-template<class ConnectHandler>
|
||
|
+template<BOOST_BEAST_ASYNC_TPARAM1 ConnectHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT1(ConnectHandler)
|
||
|
basic_stream<Protocol, Executor, RatePolicy>::
|
||
|
async_connect(
|
||
|
@@ -795,7 +795,7 @@
|
||
|
template<class Protocol, class Executor, class RatePolicy>
|
||
|
template<
|
||
|
class EndpointSequence,
|
||
|
- class RangeConnectHandler,
|
||
|
+ BOOST_ASIO_COMPLETION_TOKEN_FOR(void(error_code, typename Protocol::endpoint)) RangeConnectHandler,
|
||
|
class>
|
||
|
BOOST_ASIO_INITFN_RESULT_TYPE(RangeConnectHandler,void(error_code, typename Protocol::endpoint))
|
||
|
basic_stream<Protocol, Executor, RatePolicy>::
|
||
|
@@ -817,7 +817,7 @@
|
||
|
template<
|
||
|
class EndpointSequence,
|
||
|
class ConnectCondition,
|
||
|
- class RangeConnectHandler,
|
||
|
+ BOOST_ASIO_COMPLETION_TOKEN_FOR(void(error_code, typename Protocol::endpoint)) RangeConnectHandler,
|
||
|
class>
|
||
|
BOOST_ASIO_INITFN_RESULT_TYPE(RangeConnectHandler,void (error_code, typename Protocol::endpoint))
|
||
|
basic_stream<Protocol, Executor, RatePolicy>::
|
||
|
@@ -839,7 +839,7 @@
|
||
|
template<class Protocol, class Executor, class RatePolicy>
|
||
|
template<
|
||
|
class Iterator,
|
||
|
- class IteratorConnectHandler>
|
||
|
+ BOOST_ASIO_COMPLETION_TOKEN_FOR(void(error_code, Iterator)) IteratorConnectHandler>
|
||
|
BOOST_ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler,void (error_code, Iterator))
|
||
|
basic_stream<Protocol, Executor, RatePolicy>::
|
||
|
async_connect(
|
||
|
@@ -860,7 +860,7 @@
|
||
|
template<
|
||
|
class Iterator,
|
||
|
class ConnectCondition,
|
||
|
- class IteratorConnectHandler>
|
||
|
+ BOOST_ASIO_COMPLETION_TOKEN_FOR(void(error_code, Iterator)) IteratorConnectHandler>
|
||
|
BOOST_ASIO_INITFN_RESULT_TYPE(IteratorConnectHandler,void (error_code, Iterator))
|
||
|
basic_stream<Protocol, Executor, RatePolicy>::
|
||
|
async_connect(
|
||
|
@@ -881,7 +881,7 @@
|
||
|
//------------------------------------------------------------------------------
|
||
|
|
||
|
template<class Protocol, class Executor, class RatePolicy>
|
||
|
-template<class MutableBufferSequence, class ReadHandler>
|
||
|
+template<class MutableBufferSequence, BOOST_BEAST_ASYNC_TPARAM2 ReadHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(ReadHandler)
|
||
|
basic_stream<Protocol, Executor, RatePolicy>::
|
||
|
async_read_some(
|
||
|
@@ -901,7 +901,7 @@
|
||
|
}
|
||
|
|
||
|
template<class Protocol, class Executor, class RatePolicy>
|
||
|
-template<class ConstBufferSequence, class WriteHandler>
|
||
|
+template<class ConstBufferSequence, BOOST_BEAST_ASYNC_TPARAM2 WriteHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(WriteHandler)
|
||
|
basic_stream<Protocol, Executor, RatePolicy>::
|
||
|
async_write_some(
|
||
|
diff -aruN a/include/boost/beast/core/impl/buffered_read_stream.hpp b/include/boost/beast/core/impl/buffered_read_stream.hpp
|
||
|
--- a/include/boost/beast/core/impl/buffered_read_stream.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/core/impl/buffered_read_stream.hpp 2020-05-02 13:50:11.144761733 -0400
|
||
|
@@ -110,7 +110,7 @@
|
||
|
operator()(
|
||
|
ReadHandler&& h,
|
||
|
buffered_read_stream* s,
|
||
|
- Buffers const& b)
|
||
|
+ Buffers const* b)
|
||
|
{
|
||
|
// If you get an error on the following line it means
|
||
|
// that your handler does not meet the documented type
|
||
|
@@ -124,7 +124,7 @@
|
||
|
read_op<
|
||
|
Buffers,
|
||
|
typename std::decay<ReadHandler>::type>(
|
||
|
- std::forward<ReadHandler>(h), *s, b);
|
||
|
+ std::forward<ReadHandler>(h), *s, *b);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
@@ -141,7 +141,7 @@
|
||
|
}
|
||
|
|
||
|
template<class Stream, class DynamicBuffer>
|
||
|
-template<class ConstBufferSequence, class WriteHandler>
|
||
|
+template<class ConstBufferSequence, BOOST_BEAST_ASYNC_TPARAM2 WriteHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(WriteHandler)
|
||
|
buffered_read_stream<Stream, DynamicBuffer>::
|
||
|
async_write_some(
|
||
|
@@ -153,7 +153,7 @@
|
||
|
static_assert(net::is_const_buffer_sequence<
|
||
|
ConstBufferSequence>::value,
|
||
|
"ConstBufferSequence type requirements not met");
|
||
|
- static_assert(detail::is_invocable<WriteHandler,
|
||
|
+ static_assert(detail::is_completion_token_for<WriteHandler,
|
||
|
void(error_code, std::size_t)>::value,
|
||
|
"WriteHandler type requirements not met");
|
||
|
return next_layer_.async_write_some(buffers,
|
||
|
@@ -212,7 +212,7 @@
|
||
|
}
|
||
|
|
||
|
template<class Stream, class DynamicBuffer>
|
||
|
-template<class MutableBufferSequence, class ReadHandler>
|
||
|
+template<class MutableBufferSequence, BOOST_BEAST_ASYNC_TPARAM2 ReadHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(ReadHandler)
|
||
|
buffered_read_stream<Stream, DynamicBuffer>::
|
||
|
async_read_some(
|
||
|
@@ -233,7 +233,7 @@
|
||
|
typename ops::run_read_op{},
|
||
|
handler,
|
||
|
this,
|
||
|
- buffers);
|
||
|
+ &buffers);
|
||
|
}
|
||
|
|
||
|
} // beast
|
||
|
diff -aruN a/include/boost/beast/core/impl/flat_stream.hpp b/include/boost/beast/core/impl/flat_stream.hpp
|
||
|
--- a/include/boost/beast/core/impl/flat_stream.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/core/impl/flat_stream.hpp 2020-05-02 13:50:11.145761743 -0400
|
||
|
@@ -144,7 +144,7 @@
|
||
|
template<class NextLayer>
|
||
|
template<
|
||
|
class MutableBufferSequence,
|
||
|
- class ReadHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM2 ReadHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(ReadHandler)
|
||
|
flat_stream<NextLayer>::
|
||
|
async_read_some(
|
||
|
@@ -225,7 +225,7 @@
|
||
|
template<class NextLayer>
|
||
|
template<
|
||
|
class ConstBufferSequence,
|
||
|
- class WriteHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM2 WriteHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(WriteHandler)
|
||
|
flat_stream<NextLayer>::
|
||
|
async_write_some(
|
||
|
diff -aruN a/include/boost/beast/_experimental/http/impl/icy_stream.hpp b/include/boost/beast/_experimental/http/impl/icy_stream.hpp
|
||
|
--- a/include/boost/beast/_experimental/http/impl/icy_stream.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/_experimental/http/impl/icy_stream.hpp 2020-05-02 13:50:11.146761754 -0400
|
||
|
@@ -259,7 +259,7 @@
|
||
|
template<class NextLayer>
|
||
|
template<
|
||
|
class MutableBufferSequence,
|
||
|
- class ReadHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM2 ReadHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(ReadHandler)
|
||
|
icy_stream<NextLayer>::
|
||
|
async_read_some(
|
||
|
@@ -311,7 +311,7 @@
|
||
|
template<class NextLayer>
|
||
|
template<
|
||
|
class MutableBufferSequence,
|
||
|
- class WriteHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM2 WriteHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(WriteHandler)
|
||
|
icy_stream<NextLayer>::
|
||
|
async_write_some(
|
||
|
diff -aruN a/include/boost/beast/_experimental/test/impl/stream.hpp b/include/boost/beast/_experimental/test/impl/stream.hpp
|
||
|
--- a/include/boost/beast/_experimental/test/impl/stream.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/_experimental/test/impl/stream.hpp 2020-05-02 13:50:11.147761765 -0400
|
||
|
@@ -306,7 +306,7 @@
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
-template<class MutableBufferSequence, class ReadHandler>
|
||
|
+template<class MutableBufferSequence, BOOST_BEAST_ASYNC_TPARAM2 ReadHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(ReadHandler)
|
||
|
stream::
|
||
|
async_read_some(
|
||
|
@@ -386,7 +386,7 @@
|
||
|
return n;
|
||
|
}
|
||
|
|
||
|
-template<class ConstBufferSequence, class WriteHandler>
|
||
|
+template<class ConstBufferSequence, BOOST_BEAST_ASYNC_TPARAM2 WriteHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(WriteHandler)
|
||
|
stream::
|
||
|
async_write_some(
|
||
|
diff -aruN a/include/boost/beast/http/field.hpp b/include/boost/beast/http/field.hpp
|
||
|
--- a/include/boost/beast/http/field.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/http/field.hpp 2020-05-02 13:50:11.149761786 -0400
|
||
|
@@ -396,12 +396,9 @@
|
||
|
string_to_field(string_view s);
|
||
|
|
||
|
/// Write the text for a field name to an output stream.
|
||
|
-inline
|
||
|
+BOOST_BEAST_DECL
|
||
|
std::ostream&
|
||
|
-operator<<(std::ostream& os, field f)
|
||
|
-{
|
||
|
- return os << to_string(f);
|
||
|
-}
|
||
|
+operator<<(std::ostream& os, field f);
|
||
|
|
||
|
} // http
|
||
|
} // beast
|
||
|
diff -aruN a/include/boost/beast/http/impl/field.ipp b/include/boost/beast/http/impl/field.ipp
|
||
|
--- a/include/boost/beast/http/impl/field.ipp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/http/impl/field.ipp 2020-05-02 13:50:11.150761798 -0400
|
||
|
@@ -11,10 +11,12 @@
|
||
|
#define BOOST_BEAST_HTTP_IMPL_FIELD_IPP
|
||
|
|
||
|
#include <boost/beast/http/field.hpp>
|
||
|
+#include <boost/assert.hpp>
|
||
|
#include <algorithm>
|
||
|
#include <array>
|
||
|
#include <cstring>
|
||
|
-#include <boost/assert.hpp>
|
||
|
+#include <ostream>
|
||
|
+
|
||
|
|
||
|
namespace boost {
|
||
|
namespace beast {
|
||
|
@@ -565,6 +567,12 @@
|
||
|
return detail::get_field_table().string_to_field(s);
|
||
|
}
|
||
|
|
||
|
+std::ostream&
|
||
|
+operator<<(std::ostream& os, field f)
|
||
|
+{
|
||
|
+ return os << to_string(f);
|
||
|
+}
|
||
|
+
|
||
|
} // http
|
||
|
} // beast
|
||
|
} // boost
|
||
|
diff -aruN a/include/boost/beast/http/impl/file_body_win32.hpp b/include/boost/beast/http/impl/file_body_win32.hpp
|
||
|
--- a/include/boost/beast/http/impl/file_body_win32.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/http/impl/file_body_win32.hpp 2020-05-02 13:50:11.150761798 -0400
|
||
|
@@ -597,7 +597,7 @@
|
||
|
template<
|
||
|
class Protocol, class Executor,
|
||
|
bool isRequest, class Fields,
|
||
|
- class WriteHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM2 WriteHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(WriteHandler)
|
||
|
async_write_some(
|
||
|
net::basic_stream_socket<
|
||
|
diff -aruN a/include/boost/beast/http/impl/read.hpp b/include/boost/beast/http/impl/read.hpp
|
||
|
--- a/include/boost/beast/http/impl/read.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/http/impl/read.hpp 2020-05-02 13:50:11.150761798 -0400
|
||
|
@@ -304,7 +304,7 @@
|
||
|
class AsyncReadStream,
|
||
|
class DynamicBuffer,
|
||
|
bool isRequest,
|
||
|
- class ReadHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM2 ReadHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(ReadHandler)
|
||
|
async_read_some(
|
||
|
AsyncReadStream& stream,
|
||
|
@@ -373,7 +373,7 @@
|
||
|
class AsyncReadStream,
|
||
|
class DynamicBuffer,
|
||
|
bool isRequest,
|
||
|
- class ReadHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM2 ReadHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(ReadHandler)
|
||
|
async_read_header(
|
||
|
AsyncReadStream& stream,
|
||
|
@@ -443,7 +443,7 @@
|
||
|
class AsyncReadStream,
|
||
|
class DynamicBuffer,
|
||
|
bool isRequest,
|
||
|
- class ReadHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM2 ReadHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(ReadHandler)
|
||
|
async_read(
|
||
|
AsyncReadStream& stream,
|
||
|
@@ -531,7 +531,7 @@
|
||
|
class AsyncReadStream,
|
||
|
class DynamicBuffer,
|
||
|
bool isRequest, class Body, class Allocator,
|
||
|
- class ReadHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM2 ReadHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(ReadHandler)
|
||
|
async_read(
|
||
|
AsyncReadStream& stream,
|
||
|
diff -aruN a/include/boost/beast/http/impl/write.hpp b/include/boost/beast/http/impl/write.hpp
|
||
|
--- a/include/boost/beast/http/impl/write.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/http/impl/write.hpp 2020-05-02 13:50:11.150761798 -0400
|
||
|
@@ -463,7 +463,7 @@
|
||
|
template<
|
||
|
class AsyncWriteStream,
|
||
|
bool isRequest, class Body, class Fields,
|
||
|
- class WriteHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM2 WriteHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(WriteHandler)
|
||
|
async_write_some_impl(
|
||
|
AsyncWriteStream& stream,
|
||
|
@@ -526,7 +526,7 @@
|
||
|
template<
|
||
|
class AsyncWriteStream,
|
||
|
bool isRequest, class Body, class Fields,
|
||
|
- class WriteHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM2 WriteHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(WriteHandler)
|
||
|
async_write_some(
|
||
|
AsyncWriteStream& stream,
|
||
|
@@ -608,7 +608,7 @@
|
||
|
template<
|
||
|
class AsyncWriteStream,
|
||
|
bool isRequest, class Body, class Fields,
|
||
|
- class WriteHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM2 WriteHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(WriteHandler)
|
||
|
async_write_header(
|
||
|
AsyncWriteStream& stream,
|
||
|
@@ -681,7 +681,7 @@
|
||
|
template<
|
||
|
class AsyncWriteStream,
|
||
|
bool isRequest, class Body, class Fields,
|
||
|
- class WriteHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM2 WriteHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(WriteHandler)
|
||
|
async_write(
|
||
|
AsyncWriteStream& stream,
|
||
|
@@ -801,7 +801,7 @@
|
||
|
template<
|
||
|
class AsyncWriteStream,
|
||
|
bool isRequest, class Body, class Fields,
|
||
|
- class WriteHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM2 WriteHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(WriteHandler)
|
||
|
async_write(
|
||
|
AsyncWriteStream& stream,
|
||
|
@@ -830,7 +830,7 @@
|
||
|
template<
|
||
|
class AsyncWriteStream,
|
||
|
bool isRequest, class Body, class Fields,
|
||
|
- class WriteHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM2 WriteHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(WriteHandler)
|
||
|
async_write(
|
||
|
AsyncWriteStream& stream,
|
||
|
diff -aruN a/include/boost/beast/http/span_body.hpp b/include/boost/beast/http/span_body.hpp
|
||
|
--- a/include/boost/beast/http/span_body.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/http/span_body.hpp 2020-05-02 13:50:11.151761808 -0400
|
||
|
@@ -36,8 +36,10 @@
|
||
|
struct span_body
|
||
|
{
|
||
|
private:
|
||
|
- static_assert(std::is_pod<T>::value,
|
||
|
- "POD requirements not met");
|
||
|
+ static_assert(
|
||
|
+ std::is_trivial<T>::value &&
|
||
|
+ std::is_standard_layout<T>::value,
|
||
|
+ "POD requirements not met");
|
||
|
|
||
|
public:
|
||
|
/** The type of container used for the body
|
||
|
diff -aruN a/include/boost/beast/ssl/ssl_stream.hpp b/include/boost/beast/ssl/ssl_stream.hpp
|
||
|
--- a/include/boost/beast/ssl/ssl_stream.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/ssl/ssl_stream.hpp 2020-05-02 13:50:11.151761808 -0400
|
||
|
@@ -555,7 +555,7 @@
|
||
|
need to ensure that all data is written before the asynchronous operation
|
||
|
completes.
|
||
|
*/
|
||
|
- template<class ConstBufferSequence, class WriteHandler>
|
||
|
+ template<class ConstBufferSequence, BOOST_BEAST_ASYNC_TPARAM2 WriteHandler>
|
||
|
BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, void(boost::system::error_code, std::size_t))
|
||
|
async_write_some(ConstBufferSequence const& buffers,
|
||
|
BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
|
||
|
@@ -636,7 +636,7 @@
|
||
|
if you need to ensure that the requested amount of data is read before
|
||
|
the asynchronous operation completes.
|
||
|
*/
|
||
|
- template<class MutableBufferSequence, class ReadHandler>
|
||
|
+ template<class MutableBufferSequence, BOOST_BEAST_ASYNC_TPARAM2 ReadHandler>
|
||
|
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, void(boost::system::error_code, std::size_t))
|
||
|
async_read_some(MutableBufferSequence const& buffers,
|
||
|
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
|
||
|
diff -aruN a/include/boost/beast/version.hpp b/include/boost/beast/version.hpp
|
||
|
--- a/include/boost/beast/version.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/version.hpp 2020-05-02 13:50:11.151761808 -0400
|
||
|
@@ -20,7 +20,7 @@
|
||
|
This is a simple integer that is incremented by one every
|
||
|
time a set of code changes is merged to the develop branch.
|
||
|
*/
|
||
|
-#define BOOST_BEAST_VERSION 290
|
||
|
+#define BOOST_BEAST_VERSION 292
|
||
|
|
||
|
#define BOOST_BEAST_VERSION_STRING "Boost.Beast/" BOOST_STRINGIZE(BOOST_BEAST_VERSION)
|
||
|
|
||
|
diff -aruN a/include/boost/beast/websocket/impl/accept.hpp b/include/boost/beast/websocket/impl/accept.hpp
|
||
|
--- a/include/boost/beast/websocket/impl/accept.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/websocket/impl/accept.hpp 2020-05-02 13:50:11.153761830 -0400
|
||
|
@@ -542,7 +542,7 @@
|
||
|
|
||
|
template<class NextLayer, bool deflateSupported>
|
||
|
template<
|
||
|
- class AcceptHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT1(AcceptHandler)
|
||
|
stream<NextLayer, deflateSupported>::
|
||
|
async_accept(
|
||
|
@@ -564,7 +564,7 @@
|
||
|
template<class NextLayer, bool deflateSupported>
|
||
|
template<
|
||
|
class ResponseDecorator,
|
||
|
- class AcceptHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT1(AcceptHandler)
|
||
|
stream<NextLayer, deflateSupported>::
|
||
|
async_accept_ex(
|
||
|
@@ -590,7 +590,7 @@
|
||
|
template<class NextLayer, bool deflateSupported>
|
||
|
template<
|
||
|
class ConstBufferSequence,
|
||
|
- class AcceptHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT1(AcceptHandler)
|
||
|
stream<NextLayer, deflateSupported>::
|
||
|
async_accept(
|
||
|
@@ -621,7 +621,7 @@
|
||
|
template<
|
||
|
class ConstBufferSequence,
|
||
|
class ResponseDecorator,
|
||
|
- class AcceptHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT1(AcceptHandler)
|
||
|
stream<NextLayer, deflateSupported>::
|
||
|
async_accept_ex(
|
||
|
@@ -654,7 +654,7 @@
|
||
|
template<class NextLayer, bool deflateSupported>
|
||
|
template<
|
||
|
class Body, class Allocator,
|
||
|
- class AcceptHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT1(AcceptHandler)
|
||
|
stream<NextLayer, deflateSupported>::
|
||
|
async_accept(
|
||
|
@@ -678,7 +678,7 @@
|
||
|
template<
|
||
|
class Body, class Allocator,
|
||
|
class ResponseDecorator,
|
||
|
- class AcceptHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT1(AcceptHandler)
|
||
|
stream<NextLayer, deflateSupported>::
|
||
|
async_accept_ex(
|
||
|
diff -aruN a/include/boost/beast/websocket/impl/close.hpp b/include/boost/beast/websocket/impl/close.hpp
|
||
|
--- a/include/boost/beast/websocket/impl/close.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/websocket/impl/close.hpp 2020-05-02 13:50:11.153761830 -0400
|
||
|
@@ -382,7 +382,7 @@
|
||
|
}
|
||
|
|
||
|
template<class NextLayer, bool deflateSupported>
|
||
|
-template<class CloseHandler>
|
||
|
+template<BOOST_BEAST_ASYNC_TPARAM1 CloseHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT1(CloseHandler)
|
||
|
stream<NextLayer, deflateSupported>::
|
||
|
async_close(close_reason const& cr, CloseHandler&& handler)
|
||
|
diff -aruN a/include/boost/beast/websocket/impl/handshake.hpp b/include/boost/beast/websocket/impl/handshake.hpp
|
||
|
--- a/include/boost/beast/websocket/impl/handshake.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/websocket/impl/handshake.hpp 2020-05-02 13:50:11.153761830 -0400
|
||
|
@@ -268,7 +268,7 @@
|
||
|
//------------------------------------------------------------------------------
|
||
|
|
||
|
template<class NextLayer, bool deflateSupported>
|
||
|
-template<class HandshakeHandler>
|
||
|
+template<BOOST_BEAST_ASYNC_TPARAM1 HandshakeHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT1(HandshakeHandler)
|
||
|
stream<NextLayer, deflateSupported>::
|
||
|
async_handshake(
|
||
|
@@ -293,7 +293,7 @@
|
||
|
}
|
||
|
|
||
|
template<class NextLayer, bool deflateSupported>
|
||
|
-template<class HandshakeHandler>
|
||
|
+template<BOOST_BEAST_ASYNC_TPARAM1 HandshakeHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT1(HandshakeHandler)
|
||
|
stream<NextLayer, deflateSupported>::
|
||
|
async_handshake(
|
||
|
diff -aruN a/include/boost/beast/websocket/impl/ping.hpp b/include/boost/beast/websocket/impl/ping.hpp
|
||
|
--- a/include/boost/beast/websocket/impl/ping.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/websocket/impl/ping.hpp 2020-05-02 13:50:11.153761830 -0400
|
||
|
@@ -288,7 +288,7 @@
|
||
|
}
|
||
|
|
||
|
template<class NextLayer, bool deflateSupported>
|
||
|
-template<class WriteHandler>
|
||
|
+template<BOOST_BEAST_ASYNC_TPARAM1 WriteHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT1(WriteHandler)
|
||
|
stream<NextLayer, deflateSupported>::
|
||
|
async_ping(ping_data const& payload, WriteHandler&& handler)
|
||
|
@@ -306,7 +306,7 @@
|
||
|
}
|
||
|
|
||
|
template<class NextLayer, bool deflateSupported>
|
||
|
-template<class WriteHandler>
|
||
|
+template<BOOST_BEAST_ASYNC_TPARAM1 WriteHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT1(WriteHandler)
|
||
|
stream<NextLayer, deflateSupported>::
|
||
|
async_pong(ping_data const& payload, WriteHandler&& handler)
|
||
|
diff -aruN a/include/boost/beast/websocket/impl/read.hpp b/include/boost/beast/websocket/impl/read.hpp
|
||
|
--- a/include/boost/beast/websocket/impl/read.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/websocket/impl/read.hpp 2020-05-02 13:50:11.153761830 -0400
|
||
|
@@ -804,7 +804,7 @@
|
||
|
}
|
||
|
|
||
|
template<class NextLayer, bool deflateSupported>
|
||
|
-template<class DynamicBuffer, class ReadHandler>
|
||
|
+template<class DynamicBuffer, BOOST_BEAST_ASYNC_TPARAM2 ReadHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(ReadHandler)
|
||
|
stream<NextLayer, deflateSupported>::
|
||
|
async_read(DynamicBuffer& buffer, ReadHandler&& handler)
|
||
|
@@ -878,7 +878,7 @@
|
||
|
}
|
||
|
|
||
|
template<class NextLayer, bool deflateSupported>
|
||
|
-template<class DynamicBuffer, class ReadHandler>
|
||
|
+template<class DynamicBuffer, BOOST_BEAST_ASYNC_TPARAM2 ReadHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(ReadHandler)
|
||
|
stream<NextLayer, deflateSupported>::
|
||
|
async_read_some(
|
||
|
@@ -1263,7 +1263,7 @@
|
||
|
}
|
||
|
|
||
|
template<class NextLayer, bool deflateSupported>
|
||
|
-template<class MutableBufferSequence, class ReadHandler>
|
||
|
+template<class MutableBufferSequence, BOOST_BEAST_ASYNC_TPARAM2 ReadHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(ReadHandler)
|
||
|
stream<NextLayer, deflateSupported>::
|
||
|
async_read_some(
|
||
|
diff -aruN a/include/boost/beast/websocket/impl/write.hpp b/include/boost/beast/websocket/impl/write.hpp
|
||
|
--- a/include/boost/beast/websocket/impl/write.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/websocket/impl/write.hpp 2020-05-02 13:50:11.153761830 -0400
|
||
|
@@ -700,7 +700,7 @@
|
||
|
}
|
||
|
|
||
|
template<class NextLayer, bool deflateSupported>
|
||
|
-template<class ConstBufferSequence, class WriteHandler>
|
||
|
+template<class ConstBufferSequence, BOOST_BEAST_ASYNC_TPARAM2 WriteHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(WriteHandler)
|
||
|
stream<NextLayer, deflateSupported>::
|
||
|
async_write_some(bool fin,
|
||
|
@@ -756,7 +756,7 @@
|
||
|
}
|
||
|
|
||
|
template<class NextLayer, bool deflateSupported>
|
||
|
-template<class ConstBufferSequence, class WriteHandler>
|
||
|
+template<class ConstBufferSequence, BOOST_BEAST_ASYNC_TPARAM2 WriteHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT2(WriteHandler)
|
||
|
stream<NextLayer, deflateSupported>::
|
||
|
async_write(
|
||
|
diff -aruN a/include/boost/beast/websocket/stream.hpp b/include/boost/beast/websocket/stream.hpp
|
||
|
--- a/include/boost/beast/websocket/stream.hpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/include/boost/beast/websocket/stream.hpp 2020-05-02 13:50:11.154761841 -0400
|
||
|
@@ -2634,7 +2634,7 @@
|
||
|
|
||
|
template<
|
||
|
class ResponseDecorator,
|
||
|
- class AcceptHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT1(AcceptHandler)
|
||
|
async_accept_ex(
|
||
|
ResponseDecorator const& decorator,
|
||
|
@@ -2643,7 +2643,7 @@
|
||
|
template<
|
||
|
class ConstBufferSequence,
|
||
|
class ResponseDecorator,
|
||
|
- class AcceptHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT1(AcceptHandler)
|
||
|
async_accept_ex(
|
||
|
ConstBufferSequence const& buffers,
|
||
|
@@ -2656,7 +2656,7 @@
|
||
|
template<
|
||
|
class Body, class Allocator,
|
||
|
class ResponseDecorator,
|
||
|
- class AcceptHandler>
|
||
|
+ BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler>
|
||
|
BOOST_BEAST_ASYNC_RESULT1(AcceptHandler)
|
||
|
async_accept_ex(
|
||
|
http::request<Body,
|
||
|
diff -aruN a/CHANGELOG.md b/CHANGELOG.md
|
||
|
--- a/CHANGELOG.md 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/CHANGELOG.md 2020-05-02 13:51:02.388315008 -0400
|
||
|
@@ -1,3 +1,25 @@
|
||
|
+Version 292:
|
||
|
+
|
||
|
+* Fix compile errors on Visual Studio with /std:c++latest
|
||
|
+* Fix standalone compilation error with std::string_view
|
||
|
+* OpenSSL 1.0.2 or later is required
|
||
|
+* Fix c++20 deprecation warning in span_body
|
||
|
+
|
||
|
+--------------------------------------------------------------------------------
|
||
|
+
|
||
|
+Version 291:
|
||
|
+
|
||
|
+* Test websocket with use_awaitable
|
||
|
+* Test http write with use_awaitable
|
||
|
+* Test http read with use_awaitable
|
||
|
+* Fix use buffered_read_stream with use_awaitable
|
||
|
+* Implement is_completion_token_for trait
|
||
|
+* Test use_awaitable with basic_stream
|
||
|
+* Fix async_detect_ssl with use_awaitable
|
||
|
+* Add clang coroutines-ts to circleci config
|
||
|
+
|
||
|
+--------------------------------------------------------------------------------
|
||
|
+
|
||
|
Version 290:
|
||
|
|
||
|
* Travis build host now bionic
|
||
|
diff -aruN a/CMakeLists.txt b/CMakeLists.txt
|
||
|
--- a/CMakeLists.txt 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/CMakeLists.txt 2020-05-02 13:51:02.389315019 -0400
|
||
|
@@ -40,7 +40,7 @@
|
||
|
#
|
||
|
#-------------------------------------------------------------------------------
|
||
|
|
||
|
-project (Beast VERSION 290)
|
||
|
+project (Beast VERSION 292)
|
||
|
|
||
|
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
|
||
|
option (Beast_BUILD_EXAMPLES "Build examples" ON)
|
||
|
diff -aruN a/doc/qbk/01_intro/_intro.qbk b/doc/qbk/01_intro/_intro.qbk
|
||
|
--- a/doc/qbk/01_intro/_intro.qbk 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/doc/qbk/01_intro/_intro.qbk 2020-05-02 13:51:02.391315040 -0400
|
||
|
@@ -58,7 +58,7 @@
|
||
|
|
||
|
* [*C++11:] Robust support for most language features.
|
||
|
* [*Boost:] Beast only works with Boost, not stand-alone Asio
|
||
|
-* [*OpenSSL:] Required to build the tests, examples, and to use TLS/Secure sockets.
|
||
|
+* [*OpenSSL:] Version 1.0.2 or higher. Required to build the tests, examples, and to use TLS/Secure sockets.
|
||
|
|
||
|
Tested with these compilers: msvc-14+, gcc 4.8.4+, clang 3.6+.
|
||
|
|
||
|
diff -aruN a/test/beast/core/async_base.cpp b/test/beast/core/async_base.cpp
|
||
|
--- a/test/beast/core/async_base.cpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/test/beast/core/async_base.cpp 2020-05-02 13:51:02.470315892 -0400
|
||
|
@@ -585,7 +585,7 @@
|
||
|
//--------------------------------------------------------------------------
|
||
|
|
||
|
// Asynchronously read into a buffer until the buffer is full, or an error occurs
|
||
|
- template<class AsyncReadStream, class ReadHandler>
|
||
|
+ template<class AsyncReadStream, BOOST_BEAST_ASYNC_TPARAM2 ReadHandler>
|
||
|
typename net::async_result<ReadHandler, void(error_code, std::size_t)>::return_type
|
||
|
async_read(AsyncReadStream& stream, net::mutable_buffer buffer, ReadHandler&& handler)
|
||
|
{
|
||
|
diff -aruN a/test/beast/core/basic_stream.cpp b/test/beast/core/basic_stream.cpp
|
||
|
--- a/test/beast/core/basic_stream.cpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/test/beast/core/basic_stream.cpp 2020-05-02 13:51:02.470315892 -0400
|
||
|
@@ -30,6 +30,13 @@
|
||
|
#include <array>
|
||
|
#include <thread>
|
||
|
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+#include <boost/asio/awaitable.hpp>
|
||
|
+#include <boost/asio/co_spawn.hpp>
|
||
|
+#include <boost/asio/use_awaitable.hpp>
|
||
|
+#endif
|
||
|
+
|
||
|
+
|
||
|
namespace boost {
|
||
|
namespace beast {
|
||
|
|
||
|
@@ -258,7 +265,7 @@
|
||
|
{
|
||
|
string_view s_;
|
||
|
net::ip::tcp::socket socket_;
|
||
|
-
|
||
|
+
|
||
|
public:
|
||
|
session(
|
||
|
string_view s,
|
||
|
@@ -1297,6 +1304,52 @@
|
||
|
|
||
|
//--------------------------------------------------------------------------
|
||
|
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ void testAwaitableCompilation(
|
||
|
+ basic_stream<net::ip::tcp>& stream,
|
||
|
+ net::mutable_buffer outbuf,
|
||
|
+ net::const_buffer inbuf,
|
||
|
+ net::ip::tcp::resolver::results_type resolve_results)
|
||
|
+ {
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ stream.async_read_some(outbuf, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ stream.async_write_some(inbuf, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<net::ip::tcp::resolver::results_type::const_iterator>, decltype(
|
||
|
+ stream.async_connect(
|
||
|
+ resolve_results.begin(),
|
||
|
+ resolve_results.end(),
|
||
|
+ net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<net::ip::tcp::endpoint>, decltype(
|
||
|
+ stream.async_connect(
|
||
|
+ resolve_results,
|
||
|
+ net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<void>, decltype(
|
||
|
+ stream.async_connect(
|
||
|
+ resolve_results.begin()->endpoint(),
|
||
|
+ net::use_awaitable))>);
|
||
|
+
|
||
|
+ auto comparison_function = [](error_code&, net::ip::tcp::endpoint) { return true; };
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<net::ip::tcp::resolver::results_type::const_iterator>, decltype(
|
||
|
+ stream.async_connect(
|
||
|
+ resolve_results.begin(),
|
||
|
+ resolve_results.end(),
|
||
|
+ comparison_function,
|
||
|
+ net::use_awaitable))>);
|
||
|
+ }
|
||
|
+#endif
|
||
|
+
|
||
|
void
|
||
|
run()
|
||
|
{
|
||
|
@@ -1307,6 +1360,11 @@
|
||
|
testMembers();
|
||
|
testJavadocs();
|
||
|
testIssue1589();
|
||
|
+
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ // test for compilation success only
|
||
|
+ boost::ignore_unused(&basic_stream_test::testAwaitableCompilation);
|
||
|
+#endif
|
||
|
}
|
||
|
};
|
||
|
|
||
|
diff -aruN a/test/beast/core/buffered_read_stream.cpp b/test/beast/core/buffered_read_stream.cpp
|
||
|
--- a/test/beast/core/buffered_read_stream.cpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/test/beast/core/buffered_read_stream.cpp 2020-05-02 13:51:02.470315892 -0400
|
||
|
@@ -21,6 +21,9 @@
|
||
|
#include <boost/asio/spawn.hpp>
|
||
|
#include <boost/asio/strand.hpp>
|
||
|
#include <boost/optional.hpp>
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+#include <boost/asio/use_awaitable.hpp>
|
||
|
+#endif
|
||
|
|
||
|
namespace boost {
|
||
|
namespace beast {
|
||
|
@@ -211,6 +214,22 @@
|
||
|
}
|
||
|
};
|
||
|
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ void testAwaitableCompiles(
|
||
|
+ buffered_read_stream<test::stream, flat_buffer>& stream,
|
||
|
+ net::mutable_buffer rxbuf,
|
||
|
+ net::const_buffer txbuf)
|
||
|
+ {
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ stream.async_read_some(rxbuf, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ stream.async_write_some(txbuf, net::use_awaitable))>);
|
||
|
+ }
|
||
|
+#endif
|
||
|
+
|
||
|
void run() override
|
||
|
{
|
||
|
testSpecialMembers();
|
||
|
@@ -221,6 +240,10 @@
|
||
|
});
|
||
|
|
||
|
testAsyncLoop();
|
||
|
+
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ boost::ignore_unused(&buffered_read_stream_test::testAwaitableCompiles);
|
||
|
+#endif
|
||
|
}
|
||
|
};
|
||
|
|
||
|
diff -aruN a/test/beast/core/detect_ssl.cpp b/test/beast/core/detect_ssl.cpp
|
||
|
--- a/test/beast/core/detect_ssl.cpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/test/beast/core/detect_ssl.cpp 2020-05-02 13:51:02.470315892 -0400
|
||
|
@@ -16,6 +16,11 @@
|
||
|
#include <boost/beast/core/flat_buffer.hpp>
|
||
|
#include <boost/beast/core/string.hpp>
|
||
|
#include <boost/core/exchange.hpp>
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+#include <boost/asio/awaitable.hpp>
|
||
|
+#include <boost/asio/co_spawn.hpp>
|
||
|
+#include <boost/asio/use_awaitable.hpp>
|
||
|
+#endif
|
||
|
namespace boost {
|
||
|
namespace beast {
|
||
|
|
||
|
@@ -166,12 +171,25 @@
|
||
|
}
|
||
|
}
|
||
|
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ void testAwaitableCompiles(test::stream& stream, flat_buffer& b)
|
||
|
+ {
|
||
|
+ static_assert(
|
||
|
+ std::is_same_v<
|
||
|
+ net::awaitable<bool>, decltype(
|
||
|
+ async_detect_ssl(stream, b, net::use_awaitable))>);
|
||
|
+ }
|
||
|
+#endif
|
||
|
+
|
||
|
void
|
||
|
run() override
|
||
|
{
|
||
|
testDetect();
|
||
|
testRead();
|
||
|
testAsyncRead();
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ boost::ignore_unused(&detect_ssl_test::testAwaitableCompiles);
|
||
|
+#endif
|
||
|
}
|
||
|
};
|
||
|
|
||
|
diff -aruN a/test/beast/core/flat_stream.cpp b/test/beast/core/flat_stream.cpp
|
||
|
--- a/test/beast/core/flat_stream.cpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/test/beast/core/flat_stream.cpp 2020-05-02 13:51:02.471315902 -0400
|
||
|
@@ -17,6 +17,9 @@
|
||
|
#include <boost/beast/core/role.hpp>
|
||
|
#include <initializer_list>
|
||
|
#include <vector>
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+#include <boost/asio/use_awaitable.hpp>
|
||
|
+#endif
|
||
|
|
||
|
namespace boost {
|
||
|
namespace beast {
|
||
|
@@ -208,11 +211,30 @@
|
||
|
check({1,2,3,4}, 3, 3, true);
|
||
|
}
|
||
|
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ void testAwaitableCompiles(
|
||
|
+ flat_stream<test::stream>& stream,
|
||
|
+ net::mutable_buffer rxbuf,
|
||
|
+ net::const_buffer txbuf)
|
||
|
+ {
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ stream.async_read_some(rxbuf, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ stream.async_write_some(txbuf, net::use_awaitable))>);
|
||
|
+ }
|
||
|
+#endif
|
||
|
+
|
||
|
void
|
||
|
run() override
|
||
|
{
|
||
|
testMembers();
|
||
|
testSplit();
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ boost::ignore_unused(&flat_stream_test::testAwaitableCompiles);
|
||
|
+#endif
|
||
|
}
|
||
|
};
|
||
|
|
||
|
diff -aruN a/test/beast/core/stream_traits.cpp b/test/beast/core/stream_traits.cpp
|
||
|
--- a/test/beast/core/stream_traits.cpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/test/beast/core/stream_traits.cpp 2020-05-02 13:51:02.471315902 -0400
|
||
|
@@ -214,14 +214,14 @@
|
||
|
struct async_read_stream
|
||
|
{
|
||
|
net::io_context::executor_type get_executor() noexcept;
|
||
|
- template<class MutableBufferSequence, class ReadHandler>
|
||
|
+ template<class MutableBufferSequence, BOOST_BEAST_ASYNC_TPARAM2 ReadHandler>
|
||
|
void async_read_some(MutableBufferSequence const&, ReadHandler&&);
|
||
|
};
|
||
|
|
||
|
struct async_write_stream
|
||
|
{
|
||
|
net::io_context::executor_type get_executor() noexcept;
|
||
|
- template<class ConstBufferSequence, class WriteHandler>
|
||
|
+ template<class ConstBufferSequence, BOOST_BEAST_ASYNC_TPARAM2 WriteHandler>
|
||
|
void async_write_some(ConstBufferSequence const&, WriteHandler&&);
|
||
|
};
|
||
|
|
||
|
@@ -232,9 +232,9 @@
|
||
|
struct async_stream : async_read_stream, async_write_stream
|
||
|
{
|
||
|
net::io_context::executor_type get_executor() noexcept;
|
||
|
- template<class MutableBufferSequence, class ReadHandler>
|
||
|
+ template<class MutableBufferSequence, BOOST_BEAST_ASYNC_TPARAM2 ReadHandler>
|
||
|
void async_read_some(MutableBufferSequence const&, ReadHandler&&);
|
||
|
- template<class ConstBufferSequence, class WriteHandler>
|
||
|
+ template<class ConstBufferSequence, BOOST_BEAST_ASYNC_TPARAM2 WriteHandler>
|
||
|
void async_write_some(ConstBufferSequence const&, WriteHandler&&);
|
||
|
};
|
||
|
|
||
|
diff -aruN a/test/beast/http/CMakeLists.txt b/test/beast/http/CMakeLists.txt
|
||
|
--- a/test/beast/http/CMakeLists.txt 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/test/beast/http/CMakeLists.txt 2020-05-02 13:51:02.472315914 -0400
|
||
|
@@ -26,6 +26,7 @@
|
||
|
empty_body.cpp
|
||
|
error.cpp
|
||
|
field.cpp
|
||
|
+ field_compiles.cpp
|
||
|
fields.cpp
|
||
|
file_body.cpp
|
||
|
message.cpp
|
||
|
diff -aruN a/test/beast/http/field_compiles.cpp b/test/beast/http/field_compiles.cpp
|
||
|
--- a/test/beast/http/field_compiles.cpp 1969-12-31 19:00:00.000000000 -0500
|
||
|
+++ b/test/beast/http/field_compiles.cpp 2020-05-02 13:51:02.473315924 -0400
|
||
|
@@ -0,0 +1,11 @@
|
||
|
+//
|
||
|
+// 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
|
||
|
+//
|
||
|
+
|
||
|
+// Test that header file is self-contained.
|
||
|
+#include <boost/beast/http/field.hpp>
|
||
|
diff -aruN a/test/beast/http/Jamfile b/test/beast/http/Jamfile
|
||
|
--- a/test/beast/http/Jamfile 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/test/beast/http/Jamfile 2020-05-02 13:51:02.472315914 -0400
|
||
|
@@ -16,6 +16,7 @@
|
||
|
dynamic_body.cpp
|
||
|
error.cpp
|
||
|
field.cpp
|
||
|
+ field_compiles.cpp
|
||
|
fields.cpp
|
||
|
file_body.cpp
|
||
|
message.cpp
|
||
|
diff -aruN a/test/beast/http/read.cpp b/test/beast/http/read.cpp
|
||
|
--- a/test/beast/http/read.cpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/test/beast/http/read.cpp 2020-05-02 13:51:02.472315914 -0400
|
||
|
@@ -25,6 +25,9 @@
|
||
|
#include <boost/asio/strand.hpp>
|
||
|
#include <boost/asio/ip/tcp.hpp>
|
||
|
#include <atomic>
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+#include <boost/asio/use_awaitable.hpp>
|
||
|
+#endif
|
||
|
|
||
|
namespace boost {
|
||
|
namespace beast {
|
||
|
@@ -529,6 +532,49 @@
|
||
|
}
|
||
|
}
|
||
|
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ void testAwaitableCompiles(
|
||
|
+ test::stream& stream,
|
||
|
+ flat_buffer& dynbuf,
|
||
|
+ parser<true, string_body>& request_parser,
|
||
|
+ request<http::string_body>& request,
|
||
|
+ parser<false, string_body>& response_parser,
|
||
|
+ response<http::string_body>& response)
|
||
|
+ {
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ http::async_read(stream, dynbuf, request, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ http::async_read(stream, dynbuf, request_parser, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ http::async_read(stream, dynbuf, response, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ http::async_read(stream, dynbuf, response_parser, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ http::async_read_some(stream, dynbuf, request_parser, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ http::async_read_some(stream, dynbuf, response_parser, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ http::async_read_header(stream, dynbuf, request_parser, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ http::async_read_header(stream, dynbuf, response_parser, net::use_awaitable))>);
|
||
|
+ }
|
||
|
+#endif
|
||
|
+
|
||
|
void
|
||
|
run() override
|
||
|
{
|
||
|
@@ -552,6 +598,9 @@
|
||
|
testRegression430();
|
||
|
testReadGrind();
|
||
|
testAsioHandlerInvoke();
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ boost::ignore_unused(&read_test::testAwaitableCompiles);
|
||
|
+#endif
|
||
|
}
|
||
|
};
|
||
|
|
||
|
diff -aruN a/test/beast/http/write.cpp b/test/beast/http/write.cpp
|
||
|
--- a/test/beast/http/write.cpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/test/beast/http/write.cpp 2020-05-02 13:51:02.473315924 -0400
|
||
|
@@ -26,6 +26,9 @@
|
||
|
#include <boost/asio/strand.hpp>
|
||
|
#include <sstream>
|
||
|
#include <string>
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+#include <boost/asio/use_awaitable.hpp>
|
||
|
+#endif
|
||
|
|
||
|
namespace boost {
|
||
|
namespace beast {
|
||
|
@@ -994,6 +997,59 @@
|
||
|
}
|
||
|
}
|
||
|
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ void testAwaitableCompiles(
|
||
|
+ test::stream& stream,
|
||
|
+ serializer<true, string_body>& request_serializer,
|
||
|
+ request<string_body>& req,
|
||
|
+ request<string_body> const& creq,
|
||
|
+ serializer<false, string_body>& response_serializer,
|
||
|
+ response<string_body>& resp,
|
||
|
+ response<string_body> const& cresp)
|
||
|
+ {
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ http::async_write(stream, request_serializer, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ http::async_write(stream, response_serializer, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ http::async_write(stream, req, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ http::async_write(stream, creq, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ http::async_write(stream, resp, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ http::async_write(stream, cresp, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ http::async_write_some(stream, request_serializer, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ http::async_write_some(stream, response_serializer, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ http::async_write_header(stream, request_serializer, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ http::async_write_header(stream, response_serializer, net::use_awaitable))>);
|
||
|
+ }
|
||
|
+#endif
|
||
|
+
|
||
|
+
|
||
|
void
|
||
|
run() override
|
||
|
{
|
||
|
@@ -1017,6 +1073,9 @@
|
||
|
});
|
||
|
testAsioHandlerInvoke();
|
||
|
testBodyWriters();
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ boost::ignore_unused(&write_test::testAwaitableCompiles);
|
||
|
+#endif
|
||
|
}
|
||
|
};
|
||
|
|
||
|
diff -aruN a/test/beast/websocket/accept.cpp b/test/beast/websocket/accept.cpp
|
||
|
--- a/test/beast/websocket/accept.cpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/test/beast/websocket/accept.cpp 2020-05-02 13:51:02.473315924 -0400
|
||
|
@@ -14,7 +14,9 @@
|
||
|
#include <boost/beast/_experimental/test/tcp.hpp>
|
||
|
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||
|
#include "test.hpp"
|
||
|
-
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+#include <boost/asio/use_awaitable.hpp>
|
||
|
+#endif
|
||
|
namespace boost {
|
||
|
namespace beast {
|
||
|
namespace websocket {
|
||
|
@@ -810,6 +812,27 @@
|
||
|
}
|
||
|
}
|
||
|
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ void testAwaitableCompiles(
|
||
|
+ stream<net::ip::tcp::socket>& s,
|
||
|
+ http::request<http::empty_body>& req,
|
||
|
+ net::mutable_buffer buf
|
||
|
+ )
|
||
|
+ {
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<void>, decltype(
|
||
|
+ s.async_accept(net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<void>, decltype(
|
||
|
+ s.async_accept(req, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<void>, decltype(
|
||
|
+ s.async_accept(buf, net::use_awaitable))>);
|
||
|
+ }
|
||
|
+#endif
|
||
|
+
|
||
|
void
|
||
|
run() override
|
||
|
{
|
||
|
@@ -820,6 +843,9 @@
|
||
|
testInvalidInputs();
|
||
|
testEndOfStream();
|
||
|
testAsync();
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ boost::ignore_unused(&accept_test::testAwaitableCompiles);
|
||
|
+#endif
|
||
|
}
|
||
|
};
|
||
|
|
||
|
diff -aruN a/test/beast/websocket/close.cpp b/test/beast/websocket/close.cpp
|
||
|
--- a/test/beast/websocket/close.cpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/test/beast/websocket/close.cpp 2020-05-02 13:51:02.473315924 -0400
|
||
|
@@ -16,6 +16,9 @@
|
||
|
|
||
|
#include <boost/asio/io_context.hpp>
|
||
|
#include <boost/asio/strand.hpp>
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+#include <boost/asio/use_awaitable.hpp>
|
||
|
+#endif
|
||
|
|
||
|
namespace boost {
|
||
|
namespace beast {
|
||
|
@@ -735,6 +738,15 @@
|
||
|
}
|
||
|
};
|
||
|
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ void testAwaitableCompiles(stream<test::stream>& s, close_reason cr )
|
||
|
+ {
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<void>, decltype(
|
||
|
+ s.async_close(cr, net::use_awaitable))>);
|
||
|
+ }
|
||
|
+#endif
|
||
|
+
|
||
|
void
|
||
|
run() override
|
||
|
{
|
||
|
@@ -742,6 +754,9 @@
|
||
|
testTimeout();
|
||
|
testSuspend();
|
||
|
testMoveOnly();
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ boost::ignore_unused(&close_test::testAwaitableCompiles);
|
||
|
+#endif
|
||
|
}
|
||
|
};
|
||
|
|
||
|
diff -aruN a/test/beast/websocket/handshake.cpp b/test/beast/websocket/handshake.cpp
|
||
|
--- a/test/beast/websocket/handshake.cpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/test/beast/websocket/handshake.cpp 2020-05-02 13:51:02.473315924 -0400
|
||
|
@@ -18,6 +18,9 @@
|
||
|
#include <boost/asio/io_context.hpp>
|
||
|
#include <boost/asio/strand.hpp>
|
||
|
#include <thread>
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+#include <boost/asio/use_awaitable.hpp>
|
||
|
+#endif
|
||
|
|
||
|
namespace boost {
|
||
|
namespace beast {
|
||
|
@@ -704,6 +707,23 @@
|
||
|
}
|
||
|
}
|
||
|
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ void testAwaitableCompiles(
|
||
|
+ stream<test::stream>& s,
|
||
|
+ std::string host,
|
||
|
+ std::string port,
|
||
|
+ response_type& resp)
|
||
|
+ {
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<void>, decltype(
|
||
|
+ s.async_handshake(host, port, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<void>, decltype(
|
||
|
+ s.async_handshake(resp, host, port, net::use_awaitable))>);
|
||
|
+ }
|
||
|
+#endif
|
||
|
+
|
||
|
void
|
||
|
run() override
|
||
|
{
|
||
|
@@ -714,6 +734,9 @@
|
||
|
testMoveOnly();
|
||
|
testAsync();
|
||
|
testIssue1460();
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ boost::ignore_unused(&handshake_test::testAwaitableCompiles);
|
||
|
+#endif
|
||
|
}
|
||
|
};
|
||
|
|
||
|
diff -aruN a/test/beast/websocket/ping.cpp b/test/beast/websocket/ping.cpp
|
||
|
--- a/test/beast/websocket/ping.cpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/test/beast/websocket/ping.cpp 2020-05-02 13:51:02.474315935 -0400
|
||
|
@@ -18,6 +18,10 @@
|
||
|
#include <boost/asio/io_context.hpp>
|
||
|
#include <boost/asio/strand.hpp>
|
||
|
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+#include <boost/asio/use_awaitable.hpp>
|
||
|
+#endif
|
||
|
+
|
||
|
namespace boost {
|
||
|
namespace beast {
|
||
|
namespace websocket {
|
||
|
@@ -483,12 +487,30 @@
|
||
|
}
|
||
|
};
|
||
|
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ void testAwaitableCompiles(
|
||
|
+ stream<test::stream>& s,
|
||
|
+ ping_data& pdat)
|
||
|
+ {
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<void>, decltype(
|
||
|
+ s.async_ping(pdat, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<void>, decltype(
|
||
|
+ s.async_pong(pdat, net::use_awaitable))>);
|
||
|
+ }
|
||
|
+#endif
|
||
|
+
|
||
|
void
|
||
|
run() override
|
||
|
{
|
||
|
testPing();
|
||
|
testSuspend();
|
||
|
testMoveOnly();
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ boost::ignore_unused(&ping_test::testAwaitableCompiles);
|
||
|
+#endif
|
||
|
}
|
||
|
};
|
||
|
|
||
|
diff -aruN a/test/beast/websocket/read2.cpp b/test/beast/websocket/read2.cpp
|
||
|
--- a/test/beast/websocket/read2.cpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/test/beast/websocket/read2.cpp 2020-05-02 13:51:02.474315935 -0400
|
||
|
@@ -14,6 +14,10 @@
|
||
|
|
||
|
#include <boost/asio/write.hpp>
|
||
|
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+#include <boost/asio/use_awaitable.hpp>
|
||
|
+#endif
|
||
|
+
|
||
|
#include <boost/config/workaround.hpp>
|
||
|
#if BOOST_WORKAROUND(BOOST_GCC, < 80200)
|
||
|
#define BOOST_BEAST_SYMBOL_HIDDEN __attribute__ ((visibility("hidden")))
|
||
|
@@ -673,10 +677,34 @@
|
||
|
}
|
||
|
}
|
||
|
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ void testAwaitableCompiles(
|
||
|
+ stream<test::stream>& s,
|
||
|
+ flat_buffer& dynbuf,
|
||
|
+ net::mutable_buffer buf,
|
||
|
+ std::size_t limit)
|
||
|
+ {
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ s.async_read(dynbuf, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ s.async_read_some(buf, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ s.async_read_some(dynbuf, limit, net::use_awaitable))>);
|
||
|
+ }
|
||
|
+#endif
|
||
|
+
|
||
|
void
|
||
|
run() override
|
||
|
{
|
||
|
testRead();
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ boost::ignore_unused(&read2_test::testAwaitableCompiles);
|
||
|
+#endif
|
||
|
}
|
||
|
};
|
||
|
|
||
|
diff -aruN a/test/beast/websocket/write.cpp b/test/beast/websocket/write.cpp
|
||
|
--- a/test/beast/websocket/write.cpp 2020-04-22 09:34:50.000000000 -0400
|
||
|
+++ b/test/beast/websocket/write.cpp 2020-05-02 13:51:02.474315935 -0400
|
||
|
@@ -13,6 +13,10 @@
|
||
|
#include <boost/asio/io_context.hpp>
|
||
|
#include <boost/asio/strand.hpp>
|
||
|
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+#include <boost/asio/use_awaitable.hpp>
|
||
|
+#endif
|
||
|
+
|
||
|
#include "test.hpp"
|
||
|
|
||
|
namespace boost {
|
||
|
@@ -716,6 +720,22 @@
|
||
|
BEAST_EXPECT(n1 < n0 + s.size());
|
||
|
}
|
||
|
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ void testAwaitableCompiles(
|
||
|
+ stream<test::stream>& s,
|
||
|
+ net::mutable_buffer buf,
|
||
|
+ bool fin)
|
||
|
+ {
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ s.async_write(buf, net::use_awaitable))>);
|
||
|
+
|
||
|
+ static_assert(std::is_same_v<
|
||
|
+ net::awaitable<std::size_t>, decltype(
|
||
|
+ s.async_write_some(fin, buf, net::use_awaitable))>);
|
||
|
+ }
|
||
|
+#endif
|
||
|
+
|
||
|
void
|
||
|
run() override
|
||
|
{
|
||
|
@@ -726,6 +746,9 @@
|
||
|
testMoveOnly();
|
||
|
testIssue300();
|
||
|
testIssue1666();
|
||
|
+#if BOOST_ASIO_HAS_CO_AWAIT
|
||
|
+ boost::ignore_unused(&write_test::testAwaitableCompiles);
|
||
|
+#endif
|
||
|
}
|
||
|
};
|
||
|
|