2016-10-24 08:12:09 -04:00
|
|
|
//
|
2017-07-24 09:42:36 -07:00
|
|
|
// Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
|
2016-10-24 08:12:09 -04:00
|
|
|
//
|
|
|
|
// 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)
|
|
|
|
//
|
2017-07-20 13:40:34 -07:00
|
|
|
// Official repository: https://github.com/boostorg/beast
|
|
|
|
//
|
2016-10-24 08:12:09 -04:00
|
|
|
|
2017-07-20 13:40:34 -07:00
|
|
|
#ifndef BOOST_BEAST_WEBSOCKET_IMPL_ACCEPT_IPP
|
|
|
|
#define BOOST_BEAST_WEBSOCKET_IMPL_ACCEPT_IPP
|
|
|
|
|
|
|
|
#include <boost/beast/websocket/detail/type_traits.hpp>
|
|
|
|
#include <boost/beast/http/empty_body.hpp>
|
|
|
|
#include <boost/beast/http/parser.hpp>
|
|
|
|
#include <boost/beast/http/read.hpp>
|
|
|
|
#include <boost/beast/http/string_body.hpp>
|
|
|
|
#include <boost/beast/http/write.hpp>
|
|
|
|
#include <boost/beast/core/buffer_prefix.hpp>
|
|
|
|
#include <boost/beast/core/handler_ptr.hpp>
|
|
|
|
#include <boost/beast/core/detail/type_traits.hpp>
|
2017-05-14 09:25:43 -07:00
|
|
|
#include <boost/asio/handler_alloc_hook.hpp>
|
|
|
|
#include <boost/asio/handler_continuation_hook.hpp>
|
|
|
|
#include <boost/asio/handler_invoke_hook.hpp>
|
2016-10-24 08:12:09 -04:00
|
|
|
#include <boost/assert.hpp>
|
2017-05-22 15:30:12 -07:00
|
|
|
#include <boost/throw_exception.hpp>
|
2016-10-24 08:12:09 -04:00
|
|
|
#include <memory>
|
|
|
|
#include <type_traits>
|
|
|
|
|
2017-07-20 13:40:34 -07:00
|
|
|
namespace boost {
|
2016-10-24 08:12:09 -04:00
|
|
|
namespace beast {
|
|
|
|
namespace websocket {
|
|
|
|
|
|
|
|
// Respond to an upgrade HTTP request
|
|
|
|
template<class NextLayer>
|
|
|
|
template<class Handler>
|
|
|
|
class stream<NextLayer>::response_op
|
|
|
|
{
|
|
|
|
struct data
|
|
|
|
{
|
|
|
|
stream<NextLayer>& ws;
|
2017-06-16 15:49:06 -07:00
|
|
|
response_type res;
|
2017-07-27 14:14:47 -07:00
|
|
|
int step = 0;
|
2016-10-24 08:12:09 -04:00
|
|
|
|
2017-07-14 13:00:09 -07:00
|
|
|
template<class Body, class Allocator, class Decorator>
|
|
|
|
data(Handler&, stream<NextLayer>& ws_, http::request<
|
|
|
|
Body, http::basic_fields<Allocator>> const& req,
|
2017-07-27 14:14:47 -07:00
|
|
|
Decorator const& decorator)
|
|
|
|
: ws(ws_)
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
, res(ws_.build_response(req, decorator))
|
2017-04-25 10:12:43 -07:00
|
|
|
{
|
2016-10-24 08:12:09 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-01-02 13:29:48 -05:00
|
|
|
handler_ptr<data, Handler> d_;
|
2016-10-24 08:12:09 -04:00
|
|
|
|
|
|
|
public:
|
|
|
|
response_op(response_op&&) = default;
|
|
|
|
response_op(response_op const&) = default;
|
|
|
|
|
|
|
|
template<class DeducedHandler, class... Args>
|
|
|
|
response_op(DeducedHandler&& h,
|
|
|
|
stream<NextLayer>& ws, Args&&... args)
|
2017-01-29 19:46:17 -05:00
|
|
|
: d_(std::forward<DeducedHandler>(h),
|
|
|
|
ws, std::forward<Args>(args)...)
|
2016-10-24 08:12:09 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-07-27 14:14:47 -07:00
|
|
|
template<class Buffers>
|
|
|
|
void operator()(Buffers const& buffers);
|
|
|
|
|
|
|
|
void operator()(error_code ec);
|
2016-10-24 08:12:09 -04:00
|
|
|
|
|
|
|
friend
|
|
|
|
void* asio_handler_allocate(
|
|
|
|
std::size_t size, response_op* op)
|
|
|
|
{
|
2017-05-14 09:25:43 -07:00
|
|
|
using boost::asio::asio_handler_allocate;
|
|
|
|
return asio_handler_allocate(
|
|
|
|
size, std::addressof(op->d_.handler()));
|
2016-10-24 08:12:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
friend
|
|
|
|
void asio_handler_deallocate(
|
|
|
|
void* p, std::size_t size, response_op* op)
|
|
|
|
{
|
2017-05-14 09:25:43 -07:00
|
|
|
using boost::asio::asio_handler_deallocate;
|
|
|
|
asio_handler_deallocate(
|
|
|
|
p, size, std::addressof(op->d_.handler()));
|
2016-10-24 08:12:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
friend
|
2017-08-09 17:13:56 -07:00
|
|
|
bool asio_handler_is_continuation(response_op*)
|
2016-10-24 08:12:09 -04:00
|
|
|
{
|
2017-07-27 14:14:47 -07:00
|
|
|
// VFALCO This will go away in Net-TS
|
|
|
|
return false;
|
2016-10-24 08:12:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
template<class Function>
|
|
|
|
friend
|
|
|
|
void asio_handler_invoke(Function&& f, response_op* op)
|
|
|
|
{
|
2017-05-14 09:25:43 -07:00
|
|
|
using boost::asio::asio_handler_invoke;
|
|
|
|
asio_handler_invoke(
|
|
|
|
f, std::addressof(op->d_.handler()));
|
2016-10-24 08:12:09 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-07-27 14:14:47 -07:00
|
|
|
template<class NextLayer>
|
|
|
|
template<class Handler>
|
|
|
|
template<class Buffers>
|
|
|
|
void
|
|
|
|
stream<NextLayer>::
|
|
|
|
response_op<Handler>::
|
|
|
|
operator()(Buffers const& buffers)
|
|
|
|
{
|
|
|
|
using boost::asio::buffer_copy;
|
|
|
|
using boost::asio::buffer_size;
|
|
|
|
auto& d = *d_;
|
|
|
|
error_code ec;
|
|
|
|
boost::optional<typename
|
2017-07-27 15:40:10 -07:00
|
|
|
static_buffer_base::mutable_buffers_type> mb;
|
2017-07-27 14:14:47 -07:00
|
|
|
auto const len = buffer_size(buffers);
|
|
|
|
try
|
|
|
|
{
|
2017-07-27 15:40:10 -07:00
|
|
|
mb.emplace(d.ws.rd_.buf.prepare(len));
|
2017-07-27 14:14:47 -07:00
|
|
|
}
|
|
|
|
catch(std::length_error const&)
|
|
|
|
{
|
|
|
|
d.step = 2;
|
|
|
|
ec = error::buffer_overflow;
|
|
|
|
return d.ws.get_io_service().post(
|
|
|
|
bind_handler(std::move(*this), ec));
|
|
|
|
}
|
2017-07-27 15:40:10 -07:00
|
|
|
d.ws.rd_.buf.commit(
|
2017-07-27 14:14:47 -07:00
|
|
|
buffer_copy(*mb, buffers));
|
|
|
|
(*this)(ec);
|
|
|
|
}
|
|
|
|
|
2016-10-24 08:12:09 -04:00
|
|
|
template<class NextLayer>
|
|
|
|
template<class Handler>
|
2017-02-06 20:07:03 -05:00
|
|
|
void
|
2017-07-27 14:14:47 -07:00
|
|
|
stream<NextLayer>::
|
|
|
|
response_op<Handler>::
|
|
|
|
operator()(error_code ec)
|
2016-10-24 08:12:09 -04:00
|
|
|
{
|
|
|
|
auto& d = *d_;
|
2017-07-27 14:14:47 -07:00
|
|
|
switch(d.step)
|
2016-10-24 08:12:09 -04:00
|
|
|
{
|
2017-07-27 14:14:47 -07:00
|
|
|
case 0:
|
|
|
|
// send response
|
|
|
|
d.step = 1;
|
|
|
|
http::async_write(d.ws.next_layer(),
|
|
|
|
d.res, std::move(*this));
|
|
|
|
return;
|
|
|
|
|
|
|
|
// sent response
|
|
|
|
case 1:
|
|
|
|
if(d.res.result() !=
|
|
|
|
http::status::switching_protocols)
|
|
|
|
ec = error::handshake_failed;
|
|
|
|
if(! ec)
|
2016-10-24 08:12:09 -04:00
|
|
|
{
|
2017-07-27 14:14:47 -07:00
|
|
|
pmd_read(d.ws.pmd_config_, d.res);
|
|
|
|
d.ws.open(role_type::server);
|
2016-10-24 08:12:09 -04:00
|
|
|
}
|
2017-07-27 14:14:47 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
// call handler
|
|
|
|
case 2:
|
|
|
|
break;
|
2016-10-24 08:12:09 -04:00
|
|
|
}
|
2017-01-02 13:29:48 -05:00
|
|
|
d_.invoke(ec);
|
2016-10-24 08:12:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// read and respond to an upgrade request
|
|
|
|
//
|
|
|
|
template<class NextLayer>
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
template<class Decorator, class Handler>
|
2016-10-24 08:12:09 -04:00
|
|
|
class stream<NextLayer>::accept_op
|
|
|
|
{
|
|
|
|
struct data
|
|
|
|
{
|
|
|
|
stream<NextLayer>& ws;
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
Decorator decorator;
|
2017-06-05 07:20:58 -07:00
|
|
|
http::request_parser<http::empty_body> p;
|
2017-07-27 14:14:47 -07:00
|
|
|
int step = 0;
|
2017-06-22 10:27:45 -07:00
|
|
|
data(Handler&, stream<NextLayer>& ws_,
|
2017-05-08 12:41:45 -07:00
|
|
|
Decorator const& decorator_)
|
2017-05-14 09:25:43 -07:00
|
|
|
: ws(ws_)
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
, decorator(decorator_)
|
2016-10-24 08:12:09 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-01-02 13:29:48 -05:00
|
|
|
handler_ptr<data, Handler> d_;
|
2016-10-24 08:12:09 -04:00
|
|
|
|
|
|
|
public:
|
|
|
|
accept_op(accept_op&&) = default;
|
|
|
|
accept_op(accept_op const&) = default;
|
|
|
|
|
|
|
|
template<class DeducedHandler, class... Args>
|
|
|
|
accept_op(DeducedHandler&& h,
|
|
|
|
stream<NextLayer>& ws, Args&&... args)
|
2017-01-29 19:46:17 -05:00
|
|
|
: d_(std::forward<DeducedHandler>(h),
|
|
|
|
ws, std::forward<Args>(args)...)
|
2016-10-24 08:12:09 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-07-27 14:14:47 -07:00
|
|
|
template<class Buffers>
|
|
|
|
void operator()(Buffers const& buffers);
|
2017-06-05 07:20:58 -07:00
|
|
|
|
|
|
|
void operator()(error_code ec);
|
2016-10-24 08:12:09 -04:00
|
|
|
|
|
|
|
friend
|
|
|
|
void* asio_handler_allocate(
|
|
|
|
std::size_t size, accept_op* op)
|
|
|
|
{
|
2017-05-14 09:25:43 -07:00
|
|
|
using boost::asio::asio_handler_allocate;
|
|
|
|
return asio_handler_allocate(
|
|
|
|
size, std::addressof(op->d_.handler()));
|
2016-10-24 08:12:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
friend
|
|
|
|
void asio_handler_deallocate(
|
|
|
|
void* p, std::size_t size, accept_op* op)
|
|
|
|
{
|
2017-05-14 09:25:43 -07:00
|
|
|
using boost::asio::asio_handler_deallocate;
|
|
|
|
asio_handler_deallocate(
|
|
|
|
p, size, std::addressof(op->d_.handler()));
|
2016-10-24 08:12:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
friend
|
|
|
|
bool asio_handler_is_continuation(accept_op* op)
|
|
|
|
{
|
2017-06-05 07:20:58 -07:00
|
|
|
using boost::asio::asio_handler_is_continuation;
|
|
|
|
return asio_handler_is_continuation(
|
|
|
|
std::addressof(op->d_.handler()));
|
2016-10-24 08:12:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
template<class Function>
|
|
|
|
friend
|
|
|
|
void asio_handler_invoke(Function&& f, accept_op* op)
|
|
|
|
{
|
2017-05-14 09:25:43 -07:00
|
|
|
using boost::asio::asio_handler_invoke;
|
|
|
|
asio_handler_invoke(
|
|
|
|
f, std::addressof(op->d_.handler()));
|
2016-10-24 08:12:09 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<class NextLayer>
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
template<class Decorator, class Handler>
|
2017-07-27 14:14:47 -07:00
|
|
|
template<class Buffers>
|
2016-10-24 08:12:09 -04:00
|
|
|
void
|
2017-07-27 14:14:47 -07:00
|
|
|
stream<NextLayer>::
|
|
|
|
accept_op<Decorator, Handler>::
|
|
|
|
operator()(Buffers const& buffers)
|
2016-10-24 08:12:09 -04:00
|
|
|
{
|
2017-07-27 14:14:47 -07:00
|
|
|
using boost::asio::buffer_copy;
|
|
|
|
using boost::asio::buffer_size;
|
2016-10-24 08:12:09 -04:00
|
|
|
auto& d = *d_;
|
2017-07-27 14:14:47 -07:00
|
|
|
error_code ec;
|
|
|
|
boost::optional<typename
|
2017-07-27 15:40:10 -07:00
|
|
|
static_buffer_base::mutable_buffers_type> mb;
|
2017-07-27 14:14:47 -07:00
|
|
|
auto const len = buffer_size(buffers);
|
|
|
|
try
|
|
|
|
{
|
2017-07-27 15:40:10 -07:00
|
|
|
mb.emplace(d.ws.rd_.buf.prepare(len));
|
2017-07-27 14:14:47 -07:00
|
|
|
}
|
|
|
|
catch(std::length_error const&)
|
|
|
|
{
|
|
|
|
d.step = 2;
|
|
|
|
ec = error::buffer_overflow;
|
|
|
|
return d.ws.get_io_service().post(
|
|
|
|
bind_handler(std::move(*this), ec));
|
|
|
|
}
|
2017-07-27 15:40:10 -07:00
|
|
|
d.ws.rd_.buf.commit(
|
2017-07-27 14:14:47 -07:00
|
|
|
buffer_copy(*mb, buffers));
|
|
|
|
(*this)(ec);
|
2017-06-05 07:20:58 -07:00
|
|
|
}
|
2016-10-24 08:12:09 -04:00
|
|
|
|
2017-06-05 07:20:58 -07:00
|
|
|
template<class NextLayer>
|
|
|
|
template<class Decorator, class Handler>
|
|
|
|
void
|
2017-07-27 14:14:47 -07:00
|
|
|
stream<NextLayer>::
|
|
|
|
accept_op<Decorator, Handler>::
|
2017-06-05 07:20:58 -07:00
|
|
|
operator()(error_code ec)
|
|
|
|
{
|
|
|
|
auto& d = *d_;
|
2017-07-27 14:14:47 -07:00
|
|
|
switch(d.step)
|
2016-11-20 07:32:41 -05:00
|
|
|
{
|
2017-07-27 14:14:47 -07:00
|
|
|
case 0:
|
|
|
|
d.step = 1;
|
|
|
|
return http::async_read(
|
2017-07-27 15:40:10 -07:00
|
|
|
d.ws.next_layer(), d.ws.rd_.buf,
|
2017-07-27 14:14:47 -07:00
|
|
|
d.p, std::move(*this));
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
{
|
2017-08-02 16:45:54 -07:00
|
|
|
if(ec == http::error::end_of_stream)
|
|
|
|
ec = error::closed;
|
2017-07-27 14:14:47 -07:00
|
|
|
if(ec)
|
|
|
|
break;
|
|
|
|
// Arguments from our step must be
|
2016-11-20 07:32:41 -05:00
|
|
|
// moved to the stack before releasing
|
|
|
|
// the handler.
|
|
|
|
auto& ws = d.ws;
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
auto const req = d.p.release();
|
|
|
|
auto const decorator = d.decorator;
|
|
|
|
#if 1
|
2017-07-27 14:14:47 -07:00
|
|
|
return response_op<Handler>{
|
2016-11-20 07:32:41 -05:00
|
|
|
d_.release_handler(),
|
2017-07-27 14:14:47 -07:00
|
|
|
ws, req, decorator}(ec);
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
#else
|
|
|
|
// VFALCO This *should* work but breaks
|
|
|
|
// coroutine invariants in the unit test.
|
|
|
|
// Also it calls reset() when it shouldn't.
|
2017-07-27 14:14:47 -07:00
|
|
|
return ws.async_accept_ex(
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
req, decorator, d_.release_handler());
|
|
|
|
#endif
|
2017-07-27 14:14:47 -07:00
|
|
|
}
|
2016-11-20 07:32:41 -05:00
|
|
|
}
|
2017-01-02 13:29:48 -05:00
|
|
|
d_.invoke(ec);
|
2016-10-24 08:12:09 -04:00
|
|
|
}
|
|
|
|
|
2017-04-25 10:12:43 -07:00
|
|
|
//------------------------------------------------------------------------------
|
2016-10-24 08:12:09 -04:00
|
|
|
|
|
|
|
template<class NextLayer>
|
|
|
|
void
|
|
|
|
stream<NextLayer>::
|
|
|
|
accept()
|
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_sync_stream<next_layer_type>::value,
|
2016-10-24 08:12:09 -04:00
|
|
|
"SyncStream requirements not met");
|
|
|
|
error_code ec;
|
2017-04-25 10:12:43 -07:00
|
|
|
accept(ec);
|
2016-10-24 08:12:09 -04:00
|
|
|
if(ec)
|
2017-05-22 15:30:12 -07:00
|
|
|
BOOST_THROW_EXCEPTION(system_error{ec});
|
2016-10-24 08:12:09 -04:00
|
|
|
}
|
|
|
|
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
template<class NextLayer>
|
|
|
|
template<class ResponseDecorator>
|
|
|
|
void
|
|
|
|
stream<NextLayer>::
|
|
|
|
accept_ex(ResponseDecorator const& decorator)
|
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_sync_stream<next_layer_type>::value,
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
"SyncStream requirements not met");
|
|
|
|
static_assert(detail::is_ResponseDecorator<
|
|
|
|
ResponseDecorator>::value,
|
|
|
|
"ResponseDecorator requirements not met");
|
|
|
|
error_code ec;
|
|
|
|
accept_ex(decorator, ec);
|
|
|
|
if(ec)
|
2017-05-22 15:30:12 -07:00
|
|
|
BOOST_THROW_EXCEPTION(system_error{ec});
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
}
|
|
|
|
|
2016-10-24 08:12:09 -04:00
|
|
|
template<class NextLayer>
|
|
|
|
void
|
|
|
|
stream<NextLayer>::
|
|
|
|
accept(error_code& ec)
|
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_sync_stream<next_layer_type>::value,
|
2016-10-24 08:12:09 -04:00
|
|
|
"SyncStream requirements not met");
|
2017-04-25 10:12:43 -07:00
|
|
|
reset();
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
do_accept(&default_decorate_res, ec);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class NextLayer>
|
|
|
|
template<class ResponseDecorator>
|
|
|
|
void
|
|
|
|
stream<NextLayer>::
|
|
|
|
accept_ex(ResponseDecorator const& decorator, error_code& ec)
|
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_sync_stream<next_layer_type>::value,
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
"SyncStream requirements not met");
|
|
|
|
static_assert(detail::is_ResponseDecorator<
|
|
|
|
ResponseDecorator>::value,
|
|
|
|
"ResponseDecorator requirements not met");
|
|
|
|
reset();
|
|
|
|
do_accept(decorator, ec);
|
2016-10-24 08:12:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
template<class NextLayer>
|
|
|
|
template<class ConstBufferSequence>
|
2017-05-08 12:41:45 -07:00
|
|
|
typename std::enable_if<! http::detail::is_header<
|
|
|
|
ConstBufferSequence>::value>::type
|
2016-10-24 08:12:09 -04:00
|
|
|
stream<NextLayer>::
|
|
|
|
accept(ConstBufferSequence const& buffers)
|
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_sync_stream<next_layer_type>::value,
|
2016-10-24 08:12:09 -04:00
|
|
|
"SyncStream requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
static_assert(is_const_buffer_sequence<
|
2016-10-24 08:12:09 -04:00
|
|
|
ConstBufferSequence>::value,
|
|
|
|
"ConstBufferSequence requirements not met");
|
|
|
|
error_code ec;
|
|
|
|
accept(buffers, ec);
|
|
|
|
if(ec)
|
2017-05-22 15:30:12 -07:00
|
|
|
BOOST_THROW_EXCEPTION(system_error{ec});
|
2016-10-24 08:12:09 -04:00
|
|
|
}
|
|
|
|
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
template<class NextLayer>
|
|
|
|
template<
|
|
|
|
class ConstBufferSequence, class ResponseDecorator>
|
2017-05-08 12:41:45 -07:00
|
|
|
typename std::enable_if<! http::detail::is_header<
|
|
|
|
ConstBufferSequence>::value>::type
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
stream<NextLayer>::
|
|
|
|
accept_ex(ConstBufferSequence const& buffers,
|
|
|
|
ResponseDecorator const &decorator)
|
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_sync_stream<next_layer_type>::value,
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
"SyncStream requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
static_assert(is_const_buffer_sequence<
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
ConstBufferSequence>::value,
|
|
|
|
"ConstBufferSequence requirements not met");
|
|
|
|
static_assert(detail::is_ResponseDecorator<
|
|
|
|
ResponseDecorator>::value,
|
|
|
|
"ResponseDecorator requirements not met");
|
|
|
|
error_code ec;
|
|
|
|
accept_ex(buffers, decorator, ec);
|
|
|
|
if(ec)
|
2017-05-22 15:30:12 -07:00
|
|
|
BOOST_THROW_EXCEPTION(system_error{ec});
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
}
|
|
|
|
|
2016-10-24 08:12:09 -04:00
|
|
|
template<class NextLayer>
|
|
|
|
template<class ConstBufferSequence>
|
2017-05-08 12:41:45 -07:00
|
|
|
typename std::enable_if<! http::detail::is_header<
|
|
|
|
ConstBufferSequence>::value>::type
|
2016-10-24 08:12:09 -04:00
|
|
|
stream<NextLayer>::
|
|
|
|
accept(ConstBufferSequence const& buffers, error_code& ec)
|
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_sync_stream<next_layer_type>::value,
|
2016-10-24 08:12:09 -04:00
|
|
|
"SyncStream requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
static_assert(is_const_buffer_sequence<
|
2016-10-24 08:12:09 -04:00
|
|
|
ConstBufferSequence>::value,
|
|
|
|
"ConstBufferSequence requirements not met");
|
2017-04-25 10:12:43 -07:00
|
|
|
reset();
|
2016-10-24 08:12:09 -04:00
|
|
|
using boost::asio::buffer_copy;
|
|
|
|
using boost::asio::buffer_size;
|
2017-07-27 15:40:10 -07:00
|
|
|
rd_.buf.commit(buffer_copy(
|
|
|
|
rd_.buf.prepare(
|
2016-10-24 08:12:09 -04:00
|
|
|
buffer_size(buffers)), buffers));
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
do_accept(&default_decorate_res, ec);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class NextLayer>
|
|
|
|
template<
|
|
|
|
class ConstBufferSequence, class ResponseDecorator>
|
2017-05-08 12:41:45 -07:00
|
|
|
typename std::enable_if<! http::detail::is_header<
|
|
|
|
ConstBufferSequence>::value>::type
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
stream<NextLayer>::
|
|
|
|
accept_ex(ConstBufferSequence const& buffers,
|
|
|
|
ResponseDecorator const& decorator, error_code& ec)
|
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_sync_stream<next_layer_type>::value,
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
"SyncStream requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
static_assert(is_const_buffer_sequence<
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
ConstBufferSequence>::value,
|
|
|
|
"ConstBufferSequence requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
static_assert(is_const_buffer_sequence<
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
ConstBufferSequence>::value,
|
|
|
|
"ConstBufferSequence requirements not met");
|
|
|
|
reset();
|
|
|
|
using boost::asio::buffer_copy;
|
|
|
|
using boost::asio::buffer_size;
|
2017-07-27 15:40:10 -07:00
|
|
|
rd_.buf.commit(buffer_copy(
|
|
|
|
rd_.buf.prepare(
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
buffer_size(buffers)), buffers));
|
|
|
|
do_accept(decorator, ec);
|
2016-10-24 08:12:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
template<class NextLayer>
|
2017-07-14 13:00:09 -07:00
|
|
|
template<class Body, class Allocator>
|
2016-10-24 08:12:09 -04:00
|
|
|
void
|
|
|
|
stream<NextLayer>::
|
2017-07-14 13:00:09 -07:00
|
|
|
accept(http::request<Body,
|
2017-06-19 13:01:59 -07:00
|
|
|
http::basic_fields<Allocator>> const& req)
|
2016-10-24 08:12:09 -04:00
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_sync_stream<next_layer_type>::value,
|
2016-10-24 08:12:09 -04:00
|
|
|
"SyncStream requirements not met");
|
|
|
|
error_code ec;
|
2017-04-25 10:12:43 -07:00
|
|
|
accept(req, ec);
|
2016-10-24 08:12:09 -04:00
|
|
|
if(ec)
|
2017-05-22 15:30:12 -07:00
|
|
|
BOOST_THROW_EXCEPTION(system_error{ec});
|
2016-10-24 08:12:09 -04:00
|
|
|
}
|
|
|
|
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
template<class NextLayer>
|
2017-07-14 13:00:09 -07:00
|
|
|
template<class Body,
|
|
|
|
class Allocator, class ResponseDecorator>
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
void
|
|
|
|
stream<NextLayer>::
|
2017-07-14 13:00:09 -07:00
|
|
|
accept_ex(http::request<Body,
|
2017-06-19 13:01:59 -07:00
|
|
|
http::basic_fields<Allocator>> const& req,
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
ResponseDecorator const& decorator)
|
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_sync_stream<next_layer_type>::value,
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
"SyncStream requirements not met");
|
|
|
|
static_assert(detail::is_ResponseDecorator<
|
|
|
|
ResponseDecorator>::value,
|
|
|
|
"ResponseDecorator requirements not met");
|
|
|
|
error_code ec;
|
|
|
|
accept_ex(req, decorator, ec);
|
|
|
|
if(ec)
|
2017-05-22 15:30:12 -07:00
|
|
|
BOOST_THROW_EXCEPTION(system_error{ec});
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
}
|
|
|
|
|
2016-10-24 08:12:09 -04:00
|
|
|
template<class NextLayer>
|
2017-07-14 13:00:09 -07:00
|
|
|
template<class Body, class Allocator>
|
2016-10-24 08:12:09 -04:00
|
|
|
void
|
|
|
|
stream<NextLayer>::
|
2017-07-14 13:00:09 -07:00
|
|
|
accept(http::request<Body,
|
2017-06-19 13:01:59 -07:00
|
|
|
http::basic_fields<Allocator>> const& req,
|
|
|
|
error_code& ec)
|
2016-10-24 08:12:09 -04:00
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_sync_stream<next_layer_type>::value,
|
2016-10-24 08:12:09 -04:00
|
|
|
"SyncStream requirements not met");
|
|
|
|
reset();
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
do_accept(req, &default_decorate_res, ec);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class NextLayer>
|
2017-07-14 13:00:09 -07:00
|
|
|
template<class Body, class Allocator,
|
|
|
|
class ResponseDecorator>
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
void
|
|
|
|
stream<NextLayer>::
|
2017-07-14 13:00:09 -07:00
|
|
|
accept_ex(http::request<Body,
|
2017-06-19 13:01:59 -07:00
|
|
|
http::basic_fields<Allocator>> const& req,
|
|
|
|
ResponseDecorator const& decorator, error_code& ec)
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_sync_stream<next_layer_type>::value,
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
"SyncStream requirements not met");
|
|
|
|
static_assert(detail::is_ResponseDecorator<
|
|
|
|
ResponseDecorator>::value,
|
|
|
|
"ResponseDecorator requirements not met");
|
|
|
|
reset();
|
|
|
|
do_accept(req, decorator, ec);
|
2017-04-25 10:12:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
template<class NextLayer>
|
2017-07-14 13:00:09 -07:00
|
|
|
template<class Body, class Allocator,
|
|
|
|
class ConstBufferSequence>
|
2017-04-25 10:12:43 -07:00
|
|
|
void
|
|
|
|
stream<NextLayer>::
|
2017-07-14 13:00:09 -07:00
|
|
|
accept(http::request<Body,
|
2017-06-19 13:01:59 -07:00
|
|
|
http::basic_fields<Allocator>> const& req,
|
|
|
|
ConstBufferSequence const& buffers)
|
2017-04-25 10:12:43 -07:00
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_sync_stream<next_layer_type>::value,
|
2017-04-25 10:12:43 -07:00
|
|
|
"SyncStream requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
static_assert(is_const_buffer_sequence<
|
2017-04-25 10:12:43 -07:00
|
|
|
ConstBufferSequence>::value,
|
|
|
|
"ConstBufferSequence requirements not met");
|
|
|
|
error_code ec;
|
|
|
|
accept(req, buffers, ec);
|
2016-10-24 08:12:09 -04:00
|
|
|
if(ec)
|
2017-05-22 15:30:12 -07:00
|
|
|
BOOST_THROW_EXCEPTION(system_error{ec});
|
2017-04-25 10:12:43 -07:00
|
|
|
}
|
|
|
|
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
template<class NextLayer>
|
2017-07-14 13:00:09 -07:00
|
|
|
template<class Body, class Allocator,
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
class ConstBufferSequence, class ResponseDecorator>
|
|
|
|
void
|
|
|
|
stream<NextLayer>::
|
2017-07-14 13:00:09 -07:00
|
|
|
accept_ex(http::request<Body,
|
2017-06-19 13:01:59 -07:00
|
|
|
http::basic_fields<Allocator>> const& req,
|
|
|
|
ConstBufferSequence const& buffers,
|
|
|
|
ResponseDecorator const& decorator)
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_sync_stream<next_layer_type>::value,
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
"SyncStream requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
static_assert(is_const_buffer_sequence<
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
ConstBufferSequence>::value,
|
|
|
|
"ConstBufferSequence requirements not met");
|
|
|
|
static_assert(detail::is_ResponseDecorator<
|
|
|
|
ResponseDecorator>::value,
|
|
|
|
"ResponseDecorator requirements not met");
|
|
|
|
error_code ec;
|
|
|
|
accept_ex(req, buffers, decorator, ec);
|
|
|
|
if(ec)
|
2017-05-22 15:30:12 -07:00
|
|
|
BOOST_THROW_EXCEPTION(system_error{ec});
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
}
|
|
|
|
|
2017-04-25 10:12:43 -07:00
|
|
|
template<class NextLayer>
|
2017-07-14 13:00:09 -07:00
|
|
|
template<class Body, class Allocator,
|
|
|
|
class ConstBufferSequence>
|
2017-04-25 10:12:43 -07:00
|
|
|
void
|
|
|
|
stream<NextLayer>::
|
2017-07-14 13:00:09 -07:00
|
|
|
accept(http::request<Body,
|
|
|
|
http::basic_fields<Allocator>> const& req,
|
2017-06-19 13:01:59 -07:00
|
|
|
ConstBufferSequence const& buffers, error_code& ec)
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_sync_stream<next_layer_type>::value,
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
"SyncStream requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
static_assert(is_const_buffer_sequence<
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
ConstBufferSequence>::value,
|
|
|
|
"ConstBufferSequence requirements not met");
|
|
|
|
reset();
|
|
|
|
using boost::asio::buffer_copy;
|
|
|
|
using boost::asio::buffer_size;
|
2017-07-27 15:40:10 -07:00
|
|
|
rd_.buf.commit(buffer_copy(
|
|
|
|
rd_.buf.prepare(
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
buffer_size(buffers)), buffers));
|
|
|
|
do_accept(req, &default_decorate_res, ec);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class NextLayer>
|
2017-07-14 13:00:09 -07:00
|
|
|
template<class Body, class Allocator,
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
class ConstBufferSequence, class ResponseDecorator>
|
|
|
|
void
|
|
|
|
stream<NextLayer>::
|
2017-07-14 13:00:09 -07:00
|
|
|
accept_ex(http::request<Body,
|
2017-06-19 13:01:59 -07:00
|
|
|
http::basic_fields<Allocator>> const& req,
|
|
|
|
ConstBufferSequence const& buffers,
|
|
|
|
ResponseDecorator const& decorator,
|
|
|
|
error_code& ec)
|
2017-04-25 10:12:43 -07:00
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_sync_stream<next_layer_type>::value,
|
2017-04-25 10:12:43 -07:00
|
|
|
"SyncStream requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
static_assert(is_const_buffer_sequence<
|
2017-04-25 10:12:43 -07:00
|
|
|
ConstBufferSequence>::value,
|
|
|
|
"ConstBufferSequence requirements not met");
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
static_assert(detail::is_ResponseDecorator<
|
|
|
|
ResponseDecorator>::value,
|
|
|
|
"ResponseDecorator requirements not met");
|
2017-04-25 10:12:43 -07:00
|
|
|
reset();
|
|
|
|
using boost::asio::buffer_copy;
|
|
|
|
using boost::asio::buffer_size;
|
2017-07-27 15:40:10 -07:00
|
|
|
rd_.buf.commit(buffer_copy(
|
|
|
|
rd_.buf.prepare(
|
2017-04-25 10:12:43 -07:00
|
|
|
buffer_size(buffers)), buffers));
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
do_accept(req, decorator, ec);
|
2017-04-25 10:12:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
template<class NextLayer>
|
2017-07-27 14:14:47 -07:00
|
|
|
template<
|
|
|
|
class AcceptHandler>
|
|
|
|
async_return_type<AcceptHandler, void(error_code)>
|
2017-04-25 10:12:43 -07:00
|
|
|
stream<NextLayer>::
|
2017-07-27 14:14:47 -07:00
|
|
|
async_accept(
|
|
|
|
AcceptHandler&& handler)
|
2017-04-25 10:12:43 -07:00
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_async_stream<next_layer_type>::value,
|
2017-04-25 10:12:43 -07:00
|
|
|
"AsyncStream requirements requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
async_completion<AcceptHandler,
|
|
|
|
void(error_code)> init{handler};
|
2017-04-25 10:12:43 -07:00
|
|
|
reset();
|
2017-07-27 14:14:47 -07:00
|
|
|
accept_op<
|
|
|
|
decltype(&default_decorate_res),
|
2017-05-12 17:13:03 -07:00
|
|
|
handler_type<AcceptHandler, void(error_code)>>{
|
2017-07-27 14:14:47 -07:00
|
|
|
init.completion_handler,
|
|
|
|
*this,
|
|
|
|
&default_decorate_res}({});
|
2017-05-06 12:36:40 -07:00
|
|
|
return init.result.get();
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
template<class NextLayer>
|
2017-07-27 14:14:47 -07:00
|
|
|
template<
|
|
|
|
class ResponseDecorator,
|
|
|
|
class AcceptHandler>
|
|
|
|
async_return_type<AcceptHandler, void(error_code)>
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
stream<NextLayer>::
|
2017-07-27 14:14:47 -07:00
|
|
|
async_accept_ex(
|
|
|
|
ResponseDecorator const& decorator,
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
AcceptHandler&& handler)
|
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_async_stream<next_layer_type>::value,
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
"AsyncStream requirements requirements not met");
|
|
|
|
static_assert(detail::is_ResponseDecorator<
|
|
|
|
ResponseDecorator>::value,
|
|
|
|
"ResponseDecorator requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
async_completion<AcceptHandler,
|
|
|
|
void(error_code)> init{handler};
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
reset();
|
2017-07-27 14:14:47 -07:00
|
|
|
accept_op<
|
|
|
|
ResponseDecorator,
|
|
|
|
handler_type<AcceptHandler, void(error_code)>>{
|
|
|
|
init.completion_handler,
|
|
|
|
*this,
|
|
|
|
decorator}({});
|
2017-05-06 12:36:40 -07:00
|
|
|
return init.result.get();
|
2017-04-25 10:12:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
template<class NextLayer>
|
2017-07-27 14:14:47 -07:00
|
|
|
template<
|
|
|
|
class ConstBufferSequence,
|
|
|
|
class AcceptHandler>
|
2017-05-08 12:41:45 -07:00
|
|
|
typename std::enable_if<
|
|
|
|
! http::detail::is_header<ConstBufferSequence>::value,
|
|
|
|
async_return_type<AcceptHandler, void(error_code)>>::type
|
2017-04-25 10:12:43 -07:00
|
|
|
stream<NextLayer>::
|
2017-07-27 14:14:47 -07:00
|
|
|
async_accept(
|
|
|
|
ConstBufferSequence const& buffers,
|
2017-04-25 10:12:43 -07:00
|
|
|
AcceptHandler&& handler)
|
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_async_stream<next_layer_type>::value,
|
2017-04-25 10:12:43 -07:00
|
|
|
"AsyncStream requirements requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
static_assert(is_const_buffer_sequence<
|
2017-04-25 10:12:43 -07:00
|
|
|
ConstBufferSequence>::value,
|
|
|
|
"ConstBufferSequence requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
async_completion<AcceptHandler,
|
|
|
|
void(error_code)> init{handler};
|
2017-04-25 10:12:43 -07:00
|
|
|
reset();
|
2017-07-27 14:14:47 -07:00
|
|
|
accept_op<
|
|
|
|
decltype(&default_decorate_res),
|
2017-05-12 17:13:03 -07:00
|
|
|
handler_type<AcceptHandler, void(error_code)>>{
|
2017-07-27 14:14:47 -07:00
|
|
|
init.completion_handler,
|
|
|
|
*this,
|
|
|
|
&default_decorate_res}(buffers);
|
2017-05-06 12:36:40 -07:00
|
|
|
return init.result.get();
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
template<class NextLayer>
|
2017-07-27 14:14:47 -07:00
|
|
|
template<
|
|
|
|
class ConstBufferSequence,
|
|
|
|
class ResponseDecorator,
|
|
|
|
class AcceptHandler>
|
2017-05-08 12:41:45 -07:00
|
|
|
typename std::enable_if<
|
|
|
|
! http::detail::is_header<ConstBufferSequence>::value,
|
|
|
|
async_return_type<AcceptHandler, void(error_code)>>::type
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
stream<NextLayer>::
|
2017-07-27 14:14:47 -07:00
|
|
|
async_accept_ex(
|
|
|
|
ConstBufferSequence const& buffers,
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
ResponseDecorator const& decorator,
|
2017-07-27 14:14:47 -07:00
|
|
|
AcceptHandler&& handler)
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_async_stream<next_layer_type>::value,
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
"AsyncStream requirements requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
static_assert(is_const_buffer_sequence<
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
ConstBufferSequence>::value,
|
|
|
|
"ConstBufferSequence requirements not met");
|
|
|
|
static_assert(detail::is_ResponseDecorator<
|
|
|
|
ResponseDecorator>::value,
|
|
|
|
"ResponseDecorator requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
async_completion<AcceptHandler,
|
|
|
|
void(error_code)> init{handler};
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
reset();
|
2017-07-27 14:14:47 -07:00
|
|
|
accept_op<
|
|
|
|
ResponseDecorator,
|
|
|
|
handler_type<AcceptHandler, void(error_code)>>{
|
|
|
|
init.completion_handler,
|
|
|
|
*this,
|
|
|
|
decorator}(buffers);
|
2017-05-06 12:36:40 -07:00
|
|
|
return init.result.get();
|
2017-04-25 10:12:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
template<class NextLayer>
|
2017-07-27 14:14:47 -07:00
|
|
|
template<
|
|
|
|
class Body, class Allocator,
|
2017-07-14 13:00:09 -07:00
|
|
|
class AcceptHandler>
|
2017-07-27 14:14:47 -07:00
|
|
|
async_return_type<AcceptHandler, void(error_code)>
|
2017-04-25 10:12:43 -07:00
|
|
|
stream<NextLayer>::
|
2017-07-27 14:14:47 -07:00
|
|
|
async_accept(
|
|
|
|
http::request<Body, http::basic_fields<Allocator>> const& req,
|
|
|
|
AcceptHandler&& handler)
|
2017-04-25 10:12:43 -07:00
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_async_stream<next_layer_type>::value,
|
2017-04-25 10:12:43 -07:00
|
|
|
"AsyncStream requirements requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
async_completion<AcceptHandler,
|
|
|
|
void(error_code)> init{handler};
|
2017-04-25 10:12:43 -07:00
|
|
|
reset();
|
2017-05-14 09:25:43 -07:00
|
|
|
using boost::asio::asio_handler_is_continuation;
|
2017-07-27 14:14:47 -07:00
|
|
|
response_op<
|
|
|
|
handler_type<AcceptHandler, void(error_code)>>{
|
|
|
|
init.completion_handler,
|
|
|
|
*this,
|
|
|
|
req,
|
|
|
|
&default_decorate_res}({});
|
2017-05-06 12:36:40 -07:00
|
|
|
return init.result.get();
|
2017-04-25 10:12:43 -07:00
|
|
|
}
|
|
|
|
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
template<class NextLayer>
|
2017-07-27 14:14:47 -07:00
|
|
|
template<
|
|
|
|
class Body, class Allocator,
|
|
|
|
class ResponseDecorator,
|
|
|
|
class AcceptHandler>
|
|
|
|
async_return_type<AcceptHandler, void(error_code)>
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
stream<NextLayer>::
|
2017-07-27 14:14:47 -07:00
|
|
|
async_accept_ex(
|
|
|
|
http::request<Body, http::basic_fields<Allocator>> const& req,
|
|
|
|
ResponseDecorator const& decorator,
|
|
|
|
AcceptHandler&& handler)
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_async_stream<next_layer_type>::value,
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
"AsyncStream requirements requirements not met");
|
|
|
|
static_assert(detail::is_ResponseDecorator<
|
|
|
|
ResponseDecorator>::value,
|
|
|
|
"ResponseDecorator requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
async_completion<AcceptHandler,
|
|
|
|
void(error_code)> init{handler};
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
reset();
|
2017-05-14 09:25:43 -07:00
|
|
|
using boost::asio::asio_handler_is_continuation;
|
2017-07-27 14:14:47 -07:00
|
|
|
response_op<
|
|
|
|
handler_type<AcceptHandler, void(error_code)>>{
|
|
|
|
init.completion_handler,
|
|
|
|
*this,
|
|
|
|
req,
|
|
|
|
decorator}({});
|
2017-05-06 12:36:40 -07:00
|
|
|
return init.result.get();
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
}
|
|
|
|
|
2017-04-25 10:12:43 -07:00
|
|
|
template<class NextLayer>
|
2017-07-27 14:14:47 -07:00
|
|
|
template<
|
|
|
|
class Body, class Allocator,
|
|
|
|
class ConstBufferSequence,
|
|
|
|
class AcceptHandler>
|
|
|
|
async_return_type<AcceptHandler, void(error_code)>
|
2017-04-25 10:12:43 -07:00
|
|
|
stream<NextLayer>::
|
2017-07-27 14:14:47 -07:00
|
|
|
async_accept(
|
|
|
|
http::request<Body, http::basic_fields<Allocator>> const& req,
|
|
|
|
ConstBufferSequence const& buffers,
|
|
|
|
AcceptHandler&& handler)
|
2017-04-25 10:12:43 -07:00
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_async_stream<next_layer_type>::value,
|
2017-04-25 10:12:43 -07:00
|
|
|
"AsyncStream requirements requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
static_assert(is_const_buffer_sequence<
|
2017-04-25 10:12:43 -07:00
|
|
|
ConstBufferSequence>::value,
|
|
|
|
"ConstBufferSequence requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
async_completion<AcceptHandler,
|
|
|
|
void(error_code)> init{handler};
|
2017-04-25 10:12:43 -07:00
|
|
|
reset();
|
2017-05-14 09:25:43 -07:00
|
|
|
using boost::asio::asio_handler_is_continuation;
|
2017-07-27 14:14:47 -07:00
|
|
|
response_op<
|
|
|
|
handler_type<AcceptHandler, void(error_code)>>{
|
|
|
|
init.completion_handler,
|
|
|
|
*this,
|
|
|
|
req,
|
|
|
|
&default_decorate_res}(buffers);
|
2017-05-06 12:36:40 -07:00
|
|
|
return init.result.get();
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
template<class NextLayer>
|
2017-07-27 14:14:47 -07:00
|
|
|
template<
|
|
|
|
class Body, class Allocator,
|
|
|
|
class ConstBufferSequence,
|
|
|
|
class ResponseDecorator,
|
|
|
|
class AcceptHandler>
|
2017-05-12 17:13:03 -07:00
|
|
|
async_return_type<
|
|
|
|
AcceptHandler, void(error_code)>
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
stream<NextLayer>::
|
2017-07-14 13:00:09 -07:00
|
|
|
async_accept_ex(http::request<Body,
|
2017-06-19 13:01:59 -07:00
|
|
|
http::basic_fields<Allocator>> const& req,
|
|
|
|
ConstBufferSequence const& buffers,
|
|
|
|
ResponseDecorator const& decorator,
|
|
|
|
AcceptHandler&& handler)
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
{
|
2017-05-10 12:03:00 -07:00
|
|
|
static_assert(is_async_stream<next_layer_type>::value,
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
"AsyncStream requirements requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
static_assert(is_const_buffer_sequence<
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
ConstBufferSequence>::value,
|
|
|
|
"ConstBufferSequence requirements not met");
|
|
|
|
static_assert(detail::is_ResponseDecorator<
|
|
|
|
ResponseDecorator>::value,
|
|
|
|
"ResponseDecorator requirements not met");
|
2017-05-06 12:36:40 -07:00
|
|
|
async_completion<AcceptHandler,
|
|
|
|
void(error_code)> init{handler};
|
Refactor websocket decorators (API Change):
fix #80, #212, fix #303, fix #314, fix #317
websocket::stream now provides the following families of
functions for performing handshakes:
When operating in the server role:
* stream::accept
* stream::accept_ex
* stream::async_accept
* stream::async_accept_ex
When operating in the client role:
* stream::handshake
* stream::handshake_ex
* stream::async_handshake
* stream::async_handshake_ex
Member functions ending with "_ex" allow an additional
RequestDecorator parameter (for the accept family of
functions) or ResponseDecorator parameter (for the
handshake family of functions).
The decorator is called to optionally modify the contents
of the HTTP request or HTTP response object generated by
the implementation, before the message is sent. This
permits callers to set the User-Agent or Server fields,
add or modify HTTP fields related to subprotocols, or
perform any required transformation of the HTTP message
for application-specific needs.
The handshake() family of functions now have an additional
set of overloads accepting a parameter of type response_type&,
allowing the caller to receive the HTTP Response to the
Upgrade handshake. This permits inspection of the response
to handle things like subprotocols, authentication, or
other application-specific needs.
The new implementation does not require any state to be
stored in the stream object. Therefore, websocket::stream
objects are now smaller in size.
The overload of set_option for setting a decorator on the
stream is removed. The only way to set decorators now is
with a suitable overload of accept or handshake.
2017-04-25 09:35:22 -07:00
|
|
|
reset();
|
2017-05-14 09:25:43 -07:00
|
|
|
using boost::asio::asio_handler_is_continuation;
|
2017-07-27 14:14:47 -07:00
|
|
|
response_op<
|
|
|
|
handler_type<AcceptHandler, void(error_code)>>{
|
|
|
|
init.completion_handler,
|
|
|
|
*this,
|
|
|
|
req,
|
|
|
|
decorator}(buffers);
|
2017-05-06 12:36:40 -07:00
|
|
|
return init.result.get();
|
2016-10-24 08:12:09 -04:00
|
|
|
}
|
|
|
|
|
2017-07-27 14:14:47 -07:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
template<class NextLayer>
|
|
|
|
template<class Decorator>
|
|
|
|
void
|
|
|
|
stream<NextLayer>::
|
|
|
|
do_accept(
|
|
|
|
Decorator const& decorator,
|
|
|
|
error_code& ec)
|
|
|
|
{
|
|
|
|
http::request_parser<http::empty_body> p;
|
2017-08-02 16:45:54 -07:00
|
|
|
http::read(next_layer(), rd_.buf, p, ec);
|
|
|
|
if(ec == http::error::end_of_stream)
|
|
|
|
ec = error::closed;
|
2017-07-27 14:14:47 -07:00
|
|
|
if(ec)
|
|
|
|
return;
|
|
|
|
do_accept(p.get(), decorator, ec);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class NextLayer>
|
|
|
|
template<class Body, class Allocator,
|
|
|
|
class Decorator>
|
|
|
|
void
|
|
|
|
stream<NextLayer>::
|
|
|
|
do_accept(
|
|
|
|
http::request<Body,http::basic_fields<Allocator>> const& req,
|
|
|
|
Decorator const& decorator,
|
|
|
|
error_code& ec)
|
|
|
|
{
|
|
|
|
auto const res = build_response(req, decorator);
|
|
|
|
http::write(stream_, res, ec);
|
|
|
|
if(ec)
|
|
|
|
return;
|
|
|
|
if(res.result() != http::status::switching_protocols)
|
|
|
|
{
|
|
|
|
ec = error::handshake_failed;
|
|
|
|
// VFALCO TODO Respect keep alive setting, perform
|
|
|
|
// teardown if Connection: close.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
pmd_read(pmd_config_, req);
|
|
|
|
open(role_type::server);
|
|
|
|
}
|
|
|
|
|
2016-10-24 08:12:09 -04:00
|
|
|
} // websocket
|
|
|
|
} // beast
|
2017-07-20 13:40:34 -07:00
|
|
|
} // boost
|
2016-10-24 08:12:09 -04:00
|
|
|
|
|
|
|
#endif
|