Remove accept_ex and handshake_ex (API Change):

API Changes:

* The following deprecated functions have been removed:
  - websocket::async_accept_ex
  - websocket::async_handshake_ex
  - websocket::accept_ex
  - websocket::handshake_ex

Programs still using these names should be refactored to use the `decorator` feature and
the remaining handshake and accept functions.

refs #1934
This commit is contained in:
Richard Hodges
2020-06-01 18:52:39 +02:00
parent abd3b88539
commit 24d0b1f7bd
4 changed files with 10 additions and 525 deletions

View File

@ -1,7 +1,17 @@
* Remove accept_ex and handshake_ex variants (API Change)
* Rename to BOOST_BEAST_ALLOW_DEPRECATED (API Change)
API Changes:
* The following deprecated functions have been removed:
- websocket::async_accept_ex
- websocket::async_handshake_ex
- websocket::accept_ex
- websocket::handshake_ex
Programs still using these names should be refactored to use the `decorator` feature and
the remaining handshake and accept functions.
* The macro BOOST_BEAST_NO_DEPRECATED will no longer be noticed by Beast. The only way to
enable deprecated functionality is now the macro BOOST_BEAST_ALLOW_DEPRECATED which is
undefined by default. That is, all deprecated behaviour is disabled by default.

View File

@ -561,32 +561,6 @@ async_accept(
net::const_buffer{});
}
template<class NextLayer, bool deflateSupported>
template<
class ResponseDecorator,
BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler>
BOOST_BEAST_ASYNC_RESULT1(AcceptHandler)
stream<NextLayer, deflateSupported>::
async_accept_ex(
ResponseDecorator const& decorator,
AcceptHandler&& handler)
{
static_assert(is_async_stream<next_layer_type>::value,
"AsyncStream type requirements not met");
static_assert(detail::is_response_decorator<
ResponseDecorator>::value,
"ResponseDecorator requirements not met");
impl_->reset();
return net::async_initiate<
AcceptHandler,
void(error_code)>(
run_accept_op{},
handler,
impl_,
decorator,
net::const_buffer{});
}
template<class NextLayer, bool deflateSupported>
template<
class ConstBufferSequence,
@ -617,40 +591,6 @@ async_accept(
buffers);
}
template<class NextLayer, bool deflateSupported>
template<
class ConstBufferSequence,
class ResponseDecorator,
BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler>
BOOST_BEAST_ASYNC_RESULT1(AcceptHandler)
stream<NextLayer, deflateSupported>::
async_accept_ex(
ConstBufferSequence const& buffers,
ResponseDecorator const& decorator,
AcceptHandler&& handler,
typename std::enable_if<
! http::detail::is_header<
ConstBufferSequence>::value>::type*)
{
static_assert(is_async_stream<next_layer_type>::value,
"AsyncStream type requirements not met");
static_assert(net::is_const_buffer_sequence<
ConstBufferSequence>::value,
"ConstBufferSequence type requirements not met");
static_assert(detail::is_response_decorator<
ResponseDecorator>::value,
"ResponseDecorator requirements not met");
impl_->reset();
return net::async_initiate<
AcceptHandler,
void(error_code)>(
run_accept_op{},
handler,
impl_,
decorator,
buffers);
}
template<class NextLayer, bool deflateSupported>
template<
class Body, class Allocator,
@ -674,184 +614,6 @@ async_accept(
&default_decorate_res);
}
template<class NextLayer, bool deflateSupported>
template<
class Body, class Allocator,
class ResponseDecorator,
BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler>
BOOST_BEAST_ASYNC_RESULT1(AcceptHandler)
stream<NextLayer, deflateSupported>::
async_accept_ex(
http::request<Body, http::basic_fields<Allocator>> const& req,
ResponseDecorator const& decorator,
AcceptHandler&& handler)
{
static_assert(is_async_stream<next_layer_type>::value,
"AsyncStream type requirements not met");
static_assert(detail::is_response_decorator<
ResponseDecorator>::value,
"ResponseDecorator requirements not met");
impl_->reset();
return net::async_initiate<
AcceptHandler,
void(error_code)>(
run_response_op{},
handler,
impl_,
&req,
decorator);
}
//------------------------------------------------------------------------------
template<class NextLayer, bool deflateSupported>
template<class ResponseDecorator>
void
stream<NextLayer, deflateSupported>::
accept_ex(ResponseDecorator const& decorator)
{
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(ResponseDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream type requirements not met");
static_assert(detail::is_response_decorator<
ResponseDecorator>::value,
"ResponseDecorator requirements not met");
error_code ec;
accept_ex(decorator, ec);
if(ec)
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer, bool deflateSupported>
template<class ResponseDecorator>
void
stream<NextLayer, deflateSupported>::
accept_ex(ResponseDecorator const& decorator, error_code& ec)
{
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(ResponseDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream type requirements not met");
static_assert(detail::is_response_decorator<
ResponseDecorator>::value,
"ResponseDecorator requirements not met");
do_accept(
net::const_buffer{},
decorator, ec);
}
template<class NextLayer, bool deflateSupported>
template<
class ConstBufferSequence,
class ResponseDecorator>
typename std::enable_if<! http::detail::is_header<
ConstBufferSequence>::value>::type
stream<NextLayer, deflateSupported>::
accept_ex(
ConstBufferSequence const& buffers,
ResponseDecorator const &decorator)
{
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(ResponseDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream type requirements not met");
static_assert(net::is_const_buffer_sequence<
ConstBufferSequence>::value,
"ConstBufferSequence type requirements not met");
static_assert(detail::is_response_decorator<
ResponseDecorator>::value,
"ResponseDecorator requirements not met");
error_code ec;
accept_ex(buffers, decorator, ec);
if(ec)
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer, bool deflateSupported>
template<
class ConstBufferSequence,
class ResponseDecorator>
typename std::enable_if<! http::detail::is_header<
ConstBufferSequence>::value>::type
stream<NextLayer, deflateSupported>::
accept_ex(
ConstBufferSequence const& buffers,
ResponseDecorator const& decorator,
error_code& ec)
{
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(ResponseDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream type requirements not met");
static_assert(net::is_const_buffer_sequence<
ConstBufferSequence>::value,
"ConstBufferSequence type requirements not met");
static_assert(net::is_const_buffer_sequence<
ConstBufferSequence>::value,
"ConstBufferSequence type requirements not met");
do_accept(buffers, decorator, ec);
}
template<class NextLayer, bool deflateSupported>
template<
class Body, class Allocator,
class ResponseDecorator>
void
stream<NextLayer, deflateSupported>::
accept_ex(
http::request<Body,
http::basic_fields<Allocator>> const& req,
ResponseDecorator const& decorator)
{
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(ResponseDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream type requirements not met");
static_assert(detail::is_response_decorator<
ResponseDecorator>::value,
"ResponseDecorator requirements not met");
error_code ec;
accept_ex(req, decorator, ec);
if(ec)
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer, bool deflateSupported>
template<
class Body, class Allocator,
class ResponseDecorator>
void
stream<NextLayer, deflateSupported>::
accept_ex(
http::request<Body,
http::basic_fields<Allocator>> const& req,
ResponseDecorator const& decorator,
error_code& ec)
{
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(ResponseDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream type requirements not met");
static_assert(detail::is_response_decorator<
ResponseDecorator>::value,
"ResponseDecorator requirements not met");
impl_->reset();
do_accept(req, decorator, ec);
}
} // websocket
} // beast
} // boost

View File

@ -374,165 +374,6 @@ handshake(response_type& res,
host, target, &default_decorate_req, ec);
}
//------------------------------------------------------------------------------
template<class NextLayer, bool deflateSupported>
template<class RequestDecorator>
void
stream<NextLayer, deflateSupported>::
handshake_ex(string_view host,
string_view target,
RequestDecorator const& decorator)
{
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(RequestDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream type requirements not met");
static_assert(detail::is_request_decorator<
RequestDecorator>::value,
"RequestDecorator requirements not met");
error_code ec;
handshake_ex(host, target, decorator, ec);
if(ec)
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer, bool deflateSupported>
template<class RequestDecorator>
void
stream<NextLayer, deflateSupported>::
handshake_ex(response_type& res,
string_view host,
string_view target,
RequestDecorator const& decorator)
{
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(RequestDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream type requirements not met");
static_assert(detail::is_request_decorator<
RequestDecorator>::value,
"RequestDecorator requirements not met");
error_code ec;
handshake_ex(res, host, target, decorator, ec);
if(ec)
BOOST_THROW_EXCEPTION(system_error{ec});
}
template<class NextLayer, bool deflateSupported>
template<class RequestDecorator>
void
stream<NextLayer, deflateSupported>::
handshake_ex(string_view host,
string_view target,
RequestDecorator const& decorator,
error_code& ec)
{
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(RequestDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream type requirements not met");
static_assert(detail::is_request_decorator<
RequestDecorator>::value,
"RequestDecorator requirements not met");
do_handshake(nullptr,
host, target, decorator, ec);
}
template<class NextLayer, bool deflateSupported>
template<class RequestDecorator>
void
stream<NextLayer, deflateSupported>::
handshake_ex(response_type& res,
string_view host,
string_view target,
RequestDecorator const& decorator,
error_code& ec)
{
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(RequestDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
static_assert(is_sync_stream<next_layer_type>::value,
"SyncStream type requirements not met");
static_assert(detail::is_request_decorator<
RequestDecorator>::value,
"RequestDecorator requirements not met");
do_handshake(&res,
host, target, decorator, ec);
}
template<class NextLayer, bool deflateSupported>
template<class RequestDecorator, class HandshakeHandler>
BOOST_BEAST_ASYNC_RESULT1(HandshakeHandler)
stream<NextLayer, deflateSupported>::
async_handshake_ex(string_view host,
string_view target,
RequestDecorator const& decorator,
HandshakeHandler&& handler)
{
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(RequestDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
static_assert(is_async_stream<next_layer_type>::value,
"AsyncStream type requirements not met");
static_assert(detail::is_request_decorator<
RequestDecorator>::value,
"RequestDecorator requirements not met");
detail::sec_ws_key_type key;
auto req = impl_->build_request(
key, host, target, decorator);
return net::async_initiate<
HandshakeHandler,
void(error_code)>(
run_handshake_op{},
handler,
impl_,
std::move(req),
key,
nullptr);
}
template<class NextLayer, bool deflateSupported>
template<class RequestDecorator, class HandshakeHandler>
BOOST_BEAST_ASYNC_RESULT1(HandshakeHandler)
stream<NextLayer, deflateSupported>::
async_handshake_ex(response_type& res,
string_view host,
string_view target,
RequestDecorator const& decorator,
HandshakeHandler&& handler)
{
#ifndef BOOST_BEAST_ALLOW_DEPRECATED
static_assert(sizeof(RequestDecorator) == 0,
BOOST_BEAST_DEPRECATION_STRING);
#endif
static_assert(is_async_stream<next_layer_type>::value,
"AsyncStream type requirements not met");
static_assert(detail::is_request_decorator<
RequestDecorator>::value,
"RequestDecorator requirements not met");
detail::sec_ws_key_type key;
auto req = impl_->build_request(
key, host, target, decorator);
return net::async_initiate<
HandshakeHandler,
void(error_code)>(
run_handshake_op{},
handler,
impl_,
std::move(req),
key,
&res);
}
} // websocket
} // beast
} // boost

View File

@ -2537,134 +2537,6 @@ public:
net::default_completion_token_t<
executor_type>{});
//
// Deprecated
//
#if ! BOOST_BEAST_DOXYGEN
template<class RequestDecorator>
void
handshake_ex(
string_view host,
string_view target,
RequestDecorator const& decorator);
template<class RequestDecorator>
void
handshake_ex(
response_type& res,
string_view host,
string_view target,
RequestDecorator const& decorator);
template<class RequestDecorator>
void
handshake_ex(
string_view host,
string_view target,
RequestDecorator const& decorator,
error_code& ec);
template<class RequestDecorator>
void
handshake_ex(
response_type& res,
string_view host,
string_view target,
RequestDecorator const& decorator,
error_code& ec);
template<class RequestDecorator, class HandshakeHandler>
BOOST_BEAST_ASYNC_RESULT1(HandshakeHandler)
async_handshake_ex(
string_view host,
string_view target,
RequestDecorator const& decorator,
HandshakeHandler&& handler);
template<class RequestDecorator, class HandshakeHandler>
BOOST_BEAST_ASYNC_RESULT1(HandshakeHandler)
async_handshake_ex(
response_type& res,
string_view host,
string_view target,
RequestDecorator const& decorator,
HandshakeHandler&& handler);
template<class ResponseDecorator>
void
accept_ex(ResponseDecorator const& decorator);
template<class ResponseDecorator>
void
accept_ex(
ResponseDecorator const& decorator,
error_code& ec);
template<class ConstBufferSequence,
class ResponseDecorator>
typename std::enable_if<! http::detail::is_header<
ConstBufferSequence>::value>::type
accept_ex(
ConstBufferSequence const& buffers,
ResponseDecorator const& decorator);
template<class ConstBufferSequence, class ResponseDecorator>
typename std::enable_if<! http::detail::is_header<
ConstBufferSequence>::value>::type
accept_ex(
ConstBufferSequence const& buffers,
ResponseDecorator const& decorator,
error_code& ec);
template<class Body, class Allocator,
class ResponseDecorator>
void
accept_ex(http::request<Body,
http::basic_fields<Allocator>> const& req,
ResponseDecorator const& decorator);
template<class Body, class Allocator,
class ResponseDecorator>
void
accept_ex(http::request<Body,
http::basic_fields<Allocator>> const& req,
ResponseDecorator const& decorator,
error_code& ec);
template<
class ResponseDecorator,
BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler>
BOOST_BEAST_ASYNC_RESULT1(AcceptHandler)
async_accept_ex(
ResponseDecorator const& decorator,
AcceptHandler&& handler);
template<
class ConstBufferSequence,
class ResponseDecorator,
BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler>
BOOST_BEAST_ASYNC_RESULT1(AcceptHandler)
async_accept_ex(
ConstBufferSequence const& buffers,
ResponseDecorator const& decorator,
AcceptHandler&& handler,
typename std::enable_if<
! http::detail::is_header<
ConstBufferSequence>::value>::type* = 0);
template<
class Body, class Allocator,
class ResponseDecorator,
BOOST_BEAST_ASYNC_TPARAM1 AcceptHandler>
BOOST_BEAST_ASYNC_RESULT1(AcceptHandler)
async_accept_ex(
http::request<Body,
http::basic_fields<Allocator>> const& req,
ResponseDecorator const& decorator,
AcceptHandler&& handler);
#endif
private:
template<class, class> class accept_op;
template<class> class close_op;