mirror of
https://github.com/boostorg/beast.git
synced 2025-07-31 13:27:33 +02:00
Narrow the use of Fields parameters:
Every interface or implementation which operates on a templated type Fields is evaluated to determine if basic_fields<Allocator> is more appropriate, and changed if so.
This commit is contained in:
@@ -47,12 +47,12 @@ namespace http {
|
|||||||
template<
|
template<
|
||||||
class SyncStream,
|
class SyncStream,
|
||||||
class DynamicBuffer,
|
class DynamicBuffer,
|
||||||
class Body, class Fields>
|
class Body, class Allocator>
|
||||||
void
|
void
|
||||||
send_expect_100_continue(
|
send_expect_100_continue(
|
||||||
SyncStream& stream,
|
SyncStream& stream,
|
||||||
DynamicBuffer& buffer,
|
DynamicBuffer& buffer,
|
||||||
request<Body, Fields>& req,
|
request<Body, basic_fields<Allocator>>& req,
|
||||||
error_code& ec)
|
error_code& ec)
|
||||||
{
|
{
|
||||||
static_assert(is_sync_stream<SyncStream>::value,
|
static_assert(is_sync_stream<SyncStream>::value,
|
||||||
|
@@ -273,12 +273,12 @@ public:
|
|||||||
|
|
||||||
@param req The upgrade request.
|
@param req The upgrade request.
|
||||||
*/
|
*/
|
||||||
template<class Body, class Fields>
|
template<class Body>
|
||||||
void
|
void
|
||||||
on_upgrade(
|
on_upgrade(
|
||||||
socket_type&& sock,
|
socket_type&& sock,
|
||||||
endpoint_type ep,
|
endpoint_type ep,
|
||||||
beast::http::request<Body, Fields>&& req)
|
beast::http::request<Body>&& req)
|
||||||
{
|
{
|
||||||
// Create the connection and call the version of
|
// Create the connection and call the version of
|
||||||
// run that takes the request since we have it already
|
// run that takes the request since we have it already
|
||||||
@@ -304,12 +304,12 @@ public:
|
|||||||
|
|
||||||
@param req The upgrade request.
|
@param req The upgrade request.
|
||||||
*/
|
*/
|
||||||
template<class Body, class Fields>
|
template<class Body>
|
||||||
void
|
void
|
||||||
on_upgrade(
|
on_upgrade(
|
||||||
ssl_stream<socket_type>&& stream,
|
ssl_stream<socket_type>&& stream,
|
||||||
endpoint_type ep,
|
endpoint_type ep,
|
||||||
beast::http::request<Body, Fields>&& req)
|
beast::http::request<Body>&& req)
|
||||||
{
|
{
|
||||||
std::make_shared<async_wss_con>(
|
std::make_shared<async_wss_con>(
|
||||||
std::move(stream),
|
std::move(stream),
|
||||||
|
@@ -26,9 +26,10 @@ namespace rfc7231 {
|
|||||||
|
|
||||||
@see https://tools.ietf.org/html/rfc7231#section-5.1.1
|
@see https://tools.ietf.org/html/rfc7231#section-5.1.1
|
||||||
*/
|
*/
|
||||||
template<class Body, class Fields>
|
template<class Body, class Allocator>
|
||||||
bool
|
bool
|
||||||
is_expect_100_continue(beast::http::request<Body, Fields> const& req)
|
is_expect_100_continue(beast::http::request<
|
||||||
|
Body, beast::http::basic_fields<Allocator>> const& req)
|
||||||
{
|
{
|
||||||
return beast::iequals(
|
return beast::iequals(
|
||||||
req[beast::http::field::expect], "100-continue");
|
req[beast::http::field::expect], "100-continue");
|
||||||
|
@@ -98,9 +98,9 @@ public:
|
|||||||
|
|
||||||
@code
|
@code
|
||||||
|
|
||||||
template<class Body, class Fields>
|
template<class Body>
|
||||||
void
|
void
|
||||||
send(response<Body, Fields>&&);
|
send(response<Body>&&);
|
||||||
|
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
@@ -112,13 +112,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
class Stream,
|
class Stream,
|
||||||
class Body, class Fields,
|
class Body,
|
||||||
class Send>
|
class Send>
|
||||||
bool
|
bool
|
||||||
respond(
|
respond(
|
||||||
Stream&& stream,
|
Stream&& stream,
|
||||||
endpoint_type const& ep,
|
endpoint_type const& ep,
|
||||||
beast::http::request<Body, Fields>&& req,
|
beast::http::request<Body>&& req,
|
||||||
Send const& send) const
|
Send const& send) const
|
||||||
{
|
{
|
||||||
return try_respond(
|
return try_respond(
|
||||||
@@ -135,13 +135,13 @@ private:
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
class Stream,
|
class Stream,
|
||||||
class Body, class Fields,
|
class Body,
|
||||||
class Send>
|
class Send>
|
||||||
bool
|
bool
|
||||||
try_respond(
|
try_respond(
|
||||||
Stream&&,
|
Stream&&,
|
||||||
endpoint_type const&,
|
endpoint_type const&,
|
||||||
beast::http::request<Body, Fields>&&,
|
beast::http::request<Body>&&,
|
||||||
Send const&,
|
Send const&,
|
||||||
C<sizeof...(Services)> const&) const
|
C<sizeof...(Services)> const&) const
|
||||||
{
|
{
|
||||||
@@ -155,14 +155,14 @@ private:
|
|||||||
//
|
//
|
||||||
template<
|
template<
|
||||||
class Stream,
|
class Stream,
|
||||||
class Body, class Fields,
|
class Body,
|
||||||
class Send,
|
class Send,
|
||||||
std::size_t I>
|
std::size_t I>
|
||||||
bool
|
bool
|
||||||
try_respond(
|
try_respond(
|
||||||
Stream&& stream,
|
Stream&& stream,
|
||||||
endpoint_type const& ep,
|
endpoint_type const& ep,
|
||||||
beast::http::request<Body, Fields>&& req,
|
beast::http::request<Body>&& req,
|
||||||
Send const& send,
|
Send const& send,
|
||||||
C<I> const&) const
|
C<I> const&) const
|
||||||
{
|
{
|
||||||
|
@@ -90,9 +90,9 @@ public:
|
|||||||
// This overload handles the case where we
|
// This overload handles the case where we
|
||||||
// already have the WebSocket Upgrade request.
|
// already have the WebSocket Upgrade request.
|
||||||
//
|
//
|
||||||
template<class Body, class Fields>
|
template<class Body>
|
||||||
void
|
void
|
||||||
run(beast::http::request<Body, Fields> const& req)
|
run(beast::http::request<Body> const& req)
|
||||||
{
|
{
|
||||||
// Call the overload of accept() which takes
|
// Call the overload of accept() which takes
|
||||||
// the request by parameter, instead of reading
|
// the request by parameter, instead of reading
|
||||||
@@ -352,12 +352,12 @@ public:
|
|||||||
|
|
||||||
@param req The upgrade request.
|
@param req The upgrade request.
|
||||||
*/
|
*/
|
||||||
template<class Body, class Fields>
|
template<class Body>
|
||||||
void
|
void
|
||||||
on_upgrade(
|
on_upgrade(
|
||||||
socket_type&& sock,
|
socket_type&& sock,
|
||||||
endpoint_type ep,
|
endpoint_type ep,
|
||||||
beast::http::request<Body, Fields>&& req)
|
beast::http::request<Body>&& req)
|
||||||
{
|
{
|
||||||
std::make_shared<async_ws_con>(
|
std::make_shared<async_ws_con>(
|
||||||
std::move(sock),
|
std::move(sock),
|
||||||
|
@@ -93,9 +93,9 @@ public:
|
|||||||
|
|
||||||
// Run the connection from an already-received Upgrade request.
|
// Run the connection from an already-received Upgrade request.
|
||||||
//
|
//
|
||||||
template<class Body, class Fields>
|
template<class Body>
|
||||||
void
|
void
|
||||||
run(beast::http::request<Body, Fields>&& req)
|
run(beast::http::request<Body>&& req)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(beast::websocket::is_upgrade(req));
|
BOOST_ASSERT(beast::websocket::is_upgrade(req));
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ public:
|
|||||||
// so we have to write it out by manually specifying the lambda.
|
// so we have to write it out by manually specifying the lambda.
|
||||||
//
|
//
|
||||||
std::thread{
|
std::thread{
|
||||||
lambda<Body, Fields>{
|
lambda<Body>{
|
||||||
impl().shared_from_this(),
|
impl().shared_from_this(),
|
||||||
std::move(req)
|
std::move(req)
|
||||||
}}.detach();
|
}}.detach();
|
||||||
@@ -168,11 +168,11 @@ private:
|
|||||||
// we write out the lambda ourselves. This is similar to what
|
// we write out the lambda ourselves. This is similar to what
|
||||||
// the compiler would generate anyway.
|
// the compiler would generate anyway.
|
||||||
//
|
//
|
||||||
template<class Body, class Fields>
|
template<class Body>
|
||||||
class lambda
|
class lambda
|
||||||
{
|
{
|
||||||
std::shared_ptr<sync_ws_con_base> self_;
|
std::shared_ptr<sync_ws_con_base> self_;
|
||||||
beast::http::request<Body, Fields> req_;
|
beast::http::request<Body> req_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
@@ -181,7 +181,7 @@ private:
|
|||||||
//
|
//
|
||||||
lambda(
|
lambda(
|
||||||
std::shared_ptr<sync_ws_con_base> self,
|
std::shared_ptr<sync_ws_con_base> self,
|
||||||
beast::http::request<Body, Fields>&& req)
|
beast::http::request<Body>&& req)
|
||||||
: self_(std::move(self))
|
: self_(std::move(self))
|
||||||
, req_(std::move(req))
|
, req_(std::move(req))
|
||||||
{
|
{
|
||||||
@@ -407,12 +407,12 @@ public:
|
|||||||
|
|
||||||
@param req The upgrade request.
|
@param req The upgrade request.
|
||||||
*/
|
*/
|
||||||
template<class Body, class Fields>
|
template<class Body>
|
||||||
void
|
void
|
||||||
on_upgrade(
|
on_upgrade(
|
||||||
socket_type&& sock,
|
socket_type&& sock,
|
||||||
endpoint_type ep,
|
endpoint_type ep,
|
||||||
beast::http::request<Body, Fields>&& req)
|
beast::http::request<Body>&& req)
|
||||||
{
|
{
|
||||||
// Create the connection object and run it,
|
// Create the connection object and run it,
|
||||||
// transferring ownership of the ugprade request.
|
// transferring ownership of the ugprade request.
|
||||||
|
@@ -67,13 +67,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
class Stream,
|
class Stream,
|
||||||
class Body, class Fields,
|
class Body,
|
||||||
class Send>
|
class Send>
|
||||||
bool
|
bool
|
||||||
respond(
|
respond(
|
||||||
Stream&& stream,
|
Stream&& stream,
|
||||||
endpoint_type const& ep,
|
endpoint_type const& ep,
|
||||||
beast::http::request<Body, Fields>&& req,
|
beast::http::request<Body>&& req,
|
||||||
Send const&) const
|
Send const&) const
|
||||||
{
|
{
|
||||||
// If its not an upgrade request, return `false`
|
// If its not an upgrade request, return `false`
|
||||||
|
@@ -291,12 +291,12 @@ public:
|
|||||||
|
|
||||||
@param req The upgrade request.
|
@param req The upgrade request.
|
||||||
*/
|
*/
|
||||||
template<class Body, class Fields>
|
template<class Body>
|
||||||
void
|
void
|
||||||
on_upgrade(
|
on_upgrade(
|
||||||
ssl_stream<socket_type>&& stream,
|
ssl_stream<socket_type>&& stream,
|
||||||
endpoint_type ep,
|
endpoint_type ep,
|
||||||
beast::http::request<Body, Fields>&& req)
|
beast::http::request<Body>&& req)
|
||||||
{
|
{
|
||||||
// Create the connection object and run it,
|
// Create the connection object and run it,
|
||||||
// transferring ownership of the ugprade request.
|
// transferring ownership of the ugprade request.
|
||||||
@@ -415,12 +415,12 @@ public:
|
|||||||
|
|
||||||
@param req The upgrade request.
|
@param req The upgrade request.
|
||||||
*/
|
*/
|
||||||
template<class Body, class Fields>
|
template<class Body>
|
||||||
void
|
void
|
||||||
on_upgrade(
|
on_upgrade(
|
||||||
ssl_stream<socket_type>&& stream,
|
ssl_stream<socket_type>&& stream,
|
||||||
endpoint_type ep,
|
endpoint_type ep,
|
||||||
beast::http::request<Body, Fields>&& req)
|
beast::http::request<Body>&& req)
|
||||||
{
|
{
|
||||||
std::make_shared<async_wss_con>(
|
std::make_shared<async_wss_con>(
|
||||||
std::move(stream),
|
std::move(stream),
|
||||||
|
@@ -66,9 +66,10 @@ parse_bits(string_view s)
|
|||||||
|
|
||||||
// Parse permessage-deflate request fields
|
// Parse permessage-deflate request fields
|
||||||
//
|
//
|
||||||
template<class Fields>
|
template<class Allocator>
|
||||||
void
|
void
|
||||||
pmd_read(pmd_offer& offer, Fields const& fields)
|
pmd_read(pmd_offer& offer,
|
||||||
|
http::basic_fields<Allocator> const& fields)
|
||||||
{
|
{
|
||||||
offer.accept = false;
|
offer.accept = false;
|
||||||
offer.server_max_window_bits= 0;
|
offer.server_max_window_bits= 0;
|
||||||
@@ -194,9 +195,10 @@ pmd_read(pmd_offer& offer, Fields const& fields)
|
|||||||
|
|
||||||
// Set permessage-deflate fields for a client offer
|
// Set permessage-deflate fields for a client offer
|
||||||
//
|
//
|
||||||
template<class Fields>
|
template<class Allocator>
|
||||||
void
|
void
|
||||||
pmd_write(Fields& fields, pmd_offer const& offer)
|
pmd_write(http::basic_fields<Allocator>& fields,
|
||||||
|
pmd_offer const& offer)
|
||||||
{
|
{
|
||||||
static_string<512> s;
|
static_string<512> s;
|
||||||
s = "permessage-deflate";
|
s = "permessage-deflate";
|
||||||
@@ -239,10 +241,10 @@ pmd_write(Fields& fields, pmd_offer const& offer)
|
|||||||
|
|
||||||
// Negotiate a permessage-deflate client offer
|
// Negotiate a permessage-deflate client offer
|
||||||
//
|
//
|
||||||
template<class Fields>
|
template<class Allocator>
|
||||||
void
|
void
|
||||||
pmd_negotiate(
|
pmd_negotiate(
|
||||||
Fields& fields,
|
http::basic_fields<Allocator>& fields,
|
||||||
pmd_offer& config,
|
pmd_offer& config,
|
||||||
pmd_offer const& offer,
|
pmd_offer const& offer,
|
||||||
permessage_deflate const& o)
|
permessage_deflate const& o)
|
||||||
|
@@ -42,9 +42,9 @@ class stream<NextLayer>::response_op
|
|||||||
response_type res;
|
response_type res;
|
||||||
int state = 0;
|
int state = 0;
|
||||||
|
|
||||||
template<class Fields, class Decorator>
|
template<class Allocator, class Decorator>
|
||||||
data(Handler&, stream<NextLayer>& ws_,
|
data(Handler&, stream<NextLayer>& ws_, http::header<
|
||||||
http::header<true, Fields> const& req,
|
true, http::basic_fields<Allocator>> const& req,
|
||||||
Decorator const& decorator,
|
Decorator const& decorator,
|
||||||
bool cont_)
|
bool cont_)
|
||||||
: cont(cont_)
|
: cont(cont_)
|
||||||
@@ -53,10 +53,10 @@ class stream<NextLayer>::response_op
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Fields,
|
template<class Allocator,
|
||||||
class Buffers, class Decorator>
|
class Buffers, class Decorator>
|
||||||
data(Handler&, stream<NextLayer>& ws_,
|
data(Handler&, stream<NextLayer>& ws_, http::header<
|
||||||
http::header<true, Fields> const& req,
|
true, http::basic_fields<Allocator>> const& req,
|
||||||
Buffers const& buffers,
|
Buffers const& buffers,
|
||||||
Decorator const& decorator,
|
Decorator const& decorator,
|
||||||
bool cont_)
|
bool cont_)
|
||||||
@@ -443,10 +443,11 @@ accept_ex(ConstBufferSequence const& buffers,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class NextLayer>
|
template<class NextLayer>
|
||||||
template<class Fields>
|
template<class Allocator>
|
||||||
void
|
void
|
||||||
stream<NextLayer>::
|
stream<NextLayer>::
|
||||||
accept(http::header<true, Fields> const& req)
|
accept(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req)
|
||||||
{
|
{
|
||||||
static_assert(is_sync_stream<next_layer_type>::value,
|
static_assert(is_sync_stream<next_layer_type>::value,
|
||||||
"SyncStream requirements not met");
|
"SyncStream requirements not met");
|
||||||
@@ -457,10 +458,11 @@ accept(http::header<true, Fields> const& req)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class NextLayer>
|
template<class NextLayer>
|
||||||
template<class Fields, class ResponseDecorator>
|
template<class Allocator, class ResponseDecorator>
|
||||||
void
|
void
|
||||||
stream<NextLayer>::
|
stream<NextLayer>::
|
||||||
accept_ex(http::header<true, Fields> const& req,
|
accept_ex(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
ResponseDecorator const& decorator)
|
ResponseDecorator const& decorator)
|
||||||
{
|
{
|
||||||
static_assert(is_sync_stream<next_layer_type>::value,
|
static_assert(is_sync_stream<next_layer_type>::value,
|
||||||
@@ -475,10 +477,11 @@ accept_ex(http::header<true, Fields> const& req,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class NextLayer>
|
template<class NextLayer>
|
||||||
template<class Fields>
|
template<class Allocator>
|
||||||
void
|
void
|
||||||
stream<NextLayer>::
|
stream<NextLayer>::
|
||||||
accept(http::header<true, Fields> const& req,
|
accept(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
error_code& ec)
|
error_code& ec)
|
||||||
{
|
{
|
||||||
static_assert(is_sync_stream<next_layer_type>::value,
|
static_assert(is_sync_stream<next_layer_type>::value,
|
||||||
@@ -488,10 +491,11 @@ accept(http::header<true, Fields> const& req,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class NextLayer>
|
template<class NextLayer>
|
||||||
template<class Fields, class ResponseDecorator>
|
template<class Allocator, class ResponseDecorator>
|
||||||
void
|
void
|
||||||
stream<NextLayer>::
|
stream<NextLayer>::
|
||||||
accept_ex(http::header<true, Fields> const& req,
|
accept_ex(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
ResponseDecorator const& decorator, error_code& ec)
|
ResponseDecorator const& decorator, error_code& ec)
|
||||||
{
|
{
|
||||||
static_assert(is_sync_stream<next_layer_type>::value,
|
static_assert(is_sync_stream<next_layer_type>::value,
|
||||||
@@ -504,10 +508,11 @@ accept_ex(http::header<true, Fields> const& req,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class NextLayer>
|
template<class NextLayer>
|
||||||
template<class Fields, class ConstBufferSequence>
|
template<class Allocator, class ConstBufferSequence>
|
||||||
void
|
void
|
||||||
stream<NextLayer>::
|
stream<NextLayer>::
|
||||||
accept(http::header<true, Fields> const& req,
|
accept(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
ConstBufferSequence const& buffers)
|
ConstBufferSequence const& buffers)
|
||||||
{
|
{
|
||||||
static_assert(is_sync_stream<next_layer_type>::value,
|
static_assert(is_sync_stream<next_layer_type>::value,
|
||||||
@@ -522,11 +527,12 @@ accept(http::header<true, Fields> const& req,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class NextLayer>
|
template<class NextLayer>
|
||||||
template<class Fields,
|
template<class Allocator,
|
||||||
class ConstBufferSequence, class ResponseDecorator>
|
class ConstBufferSequence, class ResponseDecorator>
|
||||||
void
|
void
|
||||||
stream<NextLayer>::
|
stream<NextLayer>::
|
||||||
accept_ex(http::header<true, Fields> const& req,
|
accept_ex(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
ConstBufferSequence const& buffers,
|
ConstBufferSequence const& buffers,
|
||||||
ResponseDecorator const& decorator)
|
ResponseDecorator const& decorator)
|
||||||
{
|
{
|
||||||
@@ -545,10 +551,11 @@ accept_ex(http::header<true, Fields> const& req,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class NextLayer>
|
template<class NextLayer>
|
||||||
template<class Fields, class ConstBufferSequence>
|
template<class Allocator, class ConstBufferSequence>
|
||||||
void
|
void
|
||||||
stream<NextLayer>::
|
stream<NextLayer>::
|
||||||
accept(http::header<true, Fields> const& req,
|
accept(http::header<true,
|
||||||
|
Allocator> const& req,
|
||||||
ConstBufferSequence const& buffers, error_code& ec)
|
ConstBufferSequence const& buffers, error_code& ec)
|
||||||
{
|
{
|
||||||
static_assert(is_sync_stream<next_layer_type>::value,
|
static_assert(is_sync_stream<next_layer_type>::value,
|
||||||
@@ -566,11 +573,12 @@ accept(http::header<true, Fields> const& req,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class NextLayer>
|
template<class NextLayer>
|
||||||
template<class Fields,
|
template<class Allocator,
|
||||||
class ConstBufferSequence, class ResponseDecorator>
|
class ConstBufferSequence, class ResponseDecorator>
|
||||||
void
|
void
|
||||||
stream<NextLayer>::
|
stream<NextLayer>::
|
||||||
accept_ex(http::header<true, Fields> const& req,
|
accept_ex(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
ConstBufferSequence const& buffers,
|
ConstBufferSequence const& buffers,
|
||||||
ResponseDecorator const& decorator,
|
ResponseDecorator const& decorator,
|
||||||
error_code& ec)
|
error_code& ec)
|
||||||
@@ -688,11 +696,12 @@ async_accept_ex(ConstBufferSequence const& buffers,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class NextLayer>
|
template<class NextLayer>
|
||||||
template<class Fields, class AcceptHandler>
|
template<class Allocator, class AcceptHandler>
|
||||||
async_return_type<
|
async_return_type<
|
||||||
AcceptHandler, void(error_code)>
|
AcceptHandler, void(error_code)>
|
||||||
stream<NextLayer>::
|
stream<NextLayer>::
|
||||||
async_accept(http::header<true, Fields> const& req,
|
async_accept(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
AcceptHandler&& handler)
|
AcceptHandler&& handler)
|
||||||
{
|
{
|
||||||
static_assert(is_async_stream<next_layer_type>::value,
|
static_assert(is_async_stream<next_layer_type>::value,
|
||||||
@@ -710,12 +719,13 @@ async_accept(http::header<true, Fields> const& req,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class NextLayer>
|
template<class NextLayer>
|
||||||
template<class Fields,
|
template<class Allocator,
|
||||||
class ResponseDecorator, class AcceptHandler>
|
class ResponseDecorator, class AcceptHandler>
|
||||||
async_return_type<
|
async_return_type<
|
||||||
AcceptHandler, void(error_code)>
|
AcceptHandler, void(error_code)>
|
||||||
stream<NextLayer>::
|
stream<NextLayer>::
|
||||||
async_accept_ex(http::header<true, Fields> const& req,
|
async_accept_ex(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
ResponseDecorator const& decorator, AcceptHandler&& handler)
|
ResponseDecorator const& decorator, AcceptHandler&& handler)
|
||||||
{
|
{
|
||||||
static_assert(is_async_stream<next_layer_type>::value,
|
static_assert(is_async_stream<next_layer_type>::value,
|
||||||
@@ -736,12 +746,13 @@ async_accept_ex(http::header<true, Fields> const& req,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class NextLayer>
|
template<class NextLayer>
|
||||||
template<class Fields,
|
template<class Allocator,
|
||||||
class ConstBufferSequence, class AcceptHandler>
|
class ConstBufferSequence, class AcceptHandler>
|
||||||
async_return_type<
|
async_return_type<
|
||||||
AcceptHandler, void(error_code)>
|
AcceptHandler, void(error_code)>
|
||||||
stream<NextLayer>::
|
stream<NextLayer>::
|
||||||
async_accept(http::header<true, Fields> const& req,
|
async_accept(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
ConstBufferSequence const& buffers,
|
ConstBufferSequence const& buffers,
|
||||||
AcceptHandler&& handler)
|
AcceptHandler&& handler)
|
||||||
{
|
{
|
||||||
@@ -763,12 +774,13 @@ async_accept(http::header<true, Fields> const& req,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class NextLayer>
|
template<class NextLayer>
|
||||||
template<class Fields, class ConstBufferSequence,
|
template<class Allocator, class ConstBufferSequence,
|
||||||
class ResponseDecorator, class AcceptHandler>
|
class ResponseDecorator, class AcceptHandler>
|
||||||
async_return_type<
|
async_return_type<
|
||||||
AcceptHandler, void(error_code)>
|
AcceptHandler, void(error_code)>
|
||||||
stream<NextLayer>::
|
stream<NextLayer>::
|
||||||
async_accept_ex(http::header<true, Fields> const& req,
|
async_accept_ex(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
ConstBufferSequence const& buffers,
|
ConstBufferSequence const& buffers,
|
||||||
ResponseDecorator const& decorator,
|
ResponseDecorator const& decorator,
|
||||||
AcceptHandler&& handler)
|
AcceptHandler&& handler)
|
||||||
|
@@ -8,14 +8,16 @@
|
|||||||
#ifndef BEAST_WEBSOCKET_IMPL_RFC6455_IPP
|
#ifndef BEAST_WEBSOCKET_IMPL_RFC6455_IPP
|
||||||
#define BEAST_WEBSOCKET_IMPL_RFC6455_IPP
|
#define BEAST_WEBSOCKET_IMPL_RFC6455_IPP
|
||||||
|
|
||||||
|
#include <beast/http/fields.hpp>
|
||||||
#include <beast/http/rfc7230.hpp>
|
#include <beast/http/rfc7230.hpp>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
namespace websocket {
|
namespace websocket {
|
||||||
|
|
||||||
template<class Fields>
|
template<class Allocator>
|
||||||
bool
|
bool
|
||||||
is_upgrade(http::header<true, Fields> const& req)
|
is_upgrade(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req)
|
||||||
{
|
{
|
||||||
if(req.version < 11)
|
if(req.version < 11)
|
||||||
return false;
|
return false;
|
||||||
|
@@ -101,10 +101,11 @@ do_accept(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class NextLayer>
|
template<class NextLayer>
|
||||||
template<class Fields, class Decorator>
|
template<class Allocator, class Decorator>
|
||||||
void
|
void
|
||||||
stream<NextLayer>::
|
stream<NextLayer>::
|
||||||
do_accept(http::header<true, Fields> const& req,
|
do_accept(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
Decorator const& decorator, error_code& ec)
|
Decorator const& decorator, error_code& ec)
|
||||||
{
|
{
|
||||||
auto const res = build_response(req, decorator);
|
auto const res = build_response(req, decorator);
|
||||||
@@ -192,10 +193,11 @@ build_request(detail::sec_ws_key_type& key,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class NextLayer>
|
template<class NextLayer>
|
||||||
template<class Fields, class Decorator>
|
template<class Allocator, class Decorator>
|
||||||
response_type
|
response_type
|
||||||
stream<NextLayer>::
|
stream<NextLayer>::
|
||||||
build_response(http::header<true, Fields> const& req,
|
build_response(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
Decorator const& decorator)
|
Decorator const& decorator)
|
||||||
{
|
{
|
||||||
auto const decorate =
|
auto const decorate =
|
||||||
|
@@ -50,9 +50,10 @@ namespace websocket {
|
|||||||
|
|
||||||
@return `true` if the request is a WebSocket Upgrade.
|
@return `true` if the request is a WebSocket Upgrade.
|
||||||
*/
|
*/
|
||||||
template<class Fields>
|
template<class Allocator>
|
||||||
bool
|
bool
|
||||||
is_upgrade(beast::http::header<true, Fields> const& req);
|
is_upgrade(beast::http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req);
|
||||||
|
|
||||||
/** Close status codes.
|
/** Close status codes.
|
||||||
|
|
||||||
|
@@ -836,9 +836,9 @@ public:
|
|||||||
|
|
||||||
@throws system_error Thrown on failure.
|
@throws system_error Thrown on failure.
|
||||||
*/
|
*/
|
||||||
template<class Fields>
|
template<class Allocator>
|
||||||
void
|
void
|
||||||
accept(http::header<true, Fields> const& req);
|
accept(http::header<true, http::basic_fields<Allocator>> const& req);
|
||||||
|
|
||||||
/** Respond to a WebSocket HTTP Upgrade request
|
/** Respond to a WebSocket HTTP Upgrade request
|
||||||
|
|
||||||
@@ -877,9 +877,10 @@ public:
|
|||||||
|
|
||||||
@throws system_error Thrown on failure.
|
@throws system_error Thrown on failure.
|
||||||
*/
|
*/
|
||||||
template<class Fields, class ResponseDecorator>
|
template<class Allocator, class ResponseDecorator>
|
||||||
void
|
void
|
||||||
accept_ex(http::header<true, Fields> const& req,
|
accept_ex(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
ResponseDecorator const& decorator);
|
ResponseDecorator const& decorator);
|
||||||
|
|
||||||
/** Respond to a WebSocket HTTP Upgrade request
|
/** Respond to a WebSocket HTTP Upgrade request
|
||||||
@@ -910,9 +911,9 @@ public:
|
|||||||
|
|
||||||
@param ec Set to indicate what error occurred, if any.
|
@param ec Set to indicate what error occurred, if any.
|
||||||
*/
|
*/
|
||||||
template<class Fields>
|
template<class Allocator>
|
||||||
void
|
void
|
||||||
accept(http::header<true, Fields> const& req,
|
accept(http::header<true, http::basic_fields<Allocator>> const& req,
|
||||||
error_code& ec);
|
error_code& ec);
|
||||||
|
|
||||||
/** Respond to a WebSocket HTTP Upgrade request
|
/** Respond to a WebSocket HTTP Upgrade request
|
||||||
@@ -952,9 +953,10 @@ public:
|
|||||||
|
|
||||||
@param ec Set to indicate what error occurred, if any.
|
@param ec Set to indicate what error occurred, if any.
|
||||||
*/
|
*/
|
||||||
template<class Fields, class ResponseDecorator>
|
template<class Allocator, class ResponseDecorator>
|
||||||
void
|
void
|
||||||
accept_ex(http::header<true, Fields> const& req,
|
accept_ex(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
ResponseDecorator const& decorator,
|
ResponseDecorator const& decorator,
|
||||||
error_code& ec);
|
error_code& ec);
|
||||||
|
|
||||||
@@ -991,9 +993,9 @@ public:
|
|||||||
|
|
||||||
@throws system_error Thrown on failure.
|
@throws system_error Thrown on failure.
|
||||||
*/
|
*/
|
||||||
template<class Fields, class ConstBufferSequence>
|
template<class Allocator, class ConstBufferSequence>
|
||||||
void
|
void
|
||||||
accept(http::header<true, Fields> const& req,
|
accept(http::header<true, http::basic_fields<Allocator>> const& req,
|
||||||
ConstBufferSequence const& buffers);
|
ConstBufferSequence const& buffers);
|
||||||
|
|
||||||
/** Respond to a WebSocket HTTP Upgrade request
|
/** Respond to a WebSocket HTTP Upgrade request
|
||||||
@@ -1038,10 +1040,11 @@ public:
|
|||||||
|
|
||||||
@throws system_error Thrown on failure.
|
@throws system_error Thrown on failure.
|
||||||
*/
|
*/
|
||||||
template<class Fields, class ConstBufferSequence,
|
template<class Allocator, class ConstBufferSequence,
|
||||||
class ResponseDecorator>
|
class ResponseDecorator>
|
||||||
void
|
void
|
||||||
accept_ex(http::header<true, Fields> const& req,
|
accept_ex(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
ConstBufferSequence const& buffers,
|
ConstBufferSequence const& buffers,
|
||||||
ResponseDecorator const& decorator);
|
ResponseDecorator const& decorator);
|
||||||
|
|
||||||
@@ -1078,9 +1081,9 @@ public:
|
|||||||
|
|
||||||
@param ec Set to indicate what error occurred, if any.
|
@param ec Set to indicate what error occurred, if any.
|
||||||
*/
|
*/
|
||||||
template<class Fields, class ConstBufferSequence>
|
template<class Allocator, class ConstBufferSequence>
|
||||||
void
|
void
|
||||||
accept(http::header<true, Fields> const& req,
|
accept(http::header<true, Allocator> const& req,
|
||||||
ConstBufferSequence const& buffers, error_code& ec);
|
ConstBufferSequence const& buffers, error_code& ec);
|
||||||
|
|
||||||
/** Respond to a WebSocket HTTP Upgrade request
|
/** Respond to a WebSocket HTTP Upgrade request
|
||||||
@@ -1125,10 +1128,11 @@ public:
|
|||||||
|
|
||||||
@param ec Set to indicate what error occurred, if any.
|
@param ec Set to indicate what error occurred, if any.
|
||||||
*/
|
*/
|
||||||
template<class Fields, class ConstBufferSequence,
|
template<class Allocator, class ConstBufferSequence,
|
||||||
class ResponseDecorator>
|
class ResponseDecorator>
|
||||||
void
|
void
|
||||||
accept_ex(http::header<true, Fields> const& req,
|
accept_ex(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
ConstBufferSequence const& buffers,
|
ConstBufferSequence const& buffers,
|
||||||
ResponseDecorator const& decorator,
|
ResponseDecorator const& decorator,
|
||||||
error_code& ec);
|
error_code& ec);
|
||||||
@@ -1413,14 +1417,15 @@ public:
|
|||||||
this function. Invocation of the handler will be performed in a
|
this function. Invocation of the handler will be performed in a
|
||||||
manner equivalent to using `boost::asio::io_service::post`.
|
manner equivalent to using `boost::asio::io_service::post`.
|
||||||
*/
|
*/
|
||||||
template<class Fields, class AcceptHandler>
|
template<class Allocator, class AcceptHandler>
|
||||||
#if BEAST_DOXYGEN
|
#if BEAST_DOXYGEN
|
||||||
void_or_deduced
|
void_or_deduced
|
||||||
#else
|
#else
|
||||||
async_return_type<
|
async_return_type<
|
||||||
AcceptHandler, void(error_code)>
|
AcceptHandler, void(error_code)>
|
||||||
#endif
|
#endif
|
||||||
async_accept(http::header<true, Fields> const& req,
|
async_accept(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
AcceptHandler&& handler);
|
AcceptHandler&& handler);
|
||||||
|
|
||||||
/** Start responding to a WebSocket HTTP Upgrade request.
|
/** Start responding to a WebSocket HTTP Upgrade request.
|
||||||
@@ -1477,7 +1482,7 @@ public:
|
|||||||
this function. Invocation of the handler will be performed in a
|
this function. Invocation of the handler will be performed in a
|
||||||
manner equivalent to using `boost::asio::io_service::post`.
|
manner equivalent to using `boost::asio::io_service::post`.
|
||||||
*/
|
*/
|
||||||
template<class Fields,
|
template<class Allocator,
|
||||||
class ResponseDecorator, class AcceptHandler>
|
class ResponseDecorator, class AcceptHandler>
|
||||||
#if BEAST_DOXYGEN
|
#if BEAST_DOXYGEN
|
||||||
void_or_deduced
|
void_or_deduced
|
||||||
@@ -1485,7 +1490,8 @@ public:
|
|||||||
async_return_type<
|
async_return_type<
|
||||||
AcceptHandler, void(error_code)>
|
AcceptHandler, void(error_code)>
|
||||||
#endif
|
#endif
|
||||||
async_accept_ex(http::header<true, Fields> const& req,
|
async_accept_ex(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
ResponseDecorator const& decorator,
|
ResponseDecorator const& decorator,
|
||||||
AcceptHandler&& handler);
|
AcceptHandler&& handler);
|
||||||
|
|
||||||
@@ -1541,7 +1547,7 @@ public:
|
|||||||
this function. Invocation of the handler will be performed in a
|
this function. Invocation of the handler will be performed in a
|
||||||
manner equivalent to using `boost::asio::io_service::post`.
|
manner equivalent to using `boost::asio::io_service::post`.
|
||||||
*/
|
*/
|
||||||
template<class Fields,
|
template<class Allocator,
|
||||||
class ConstBufferSequence, class AcceptHandler>
|
class ConstBufferSequence, class AcceptHandler>
|
||||||
#if BEAST_DOXYGEN
|
#if BEAST_DOXYGEN
|
||||||
void_or_deduced
|
void_or_deduced
|
||||||
@@ -1549,7 +1555,8 @@ public:
|
|||||||
async_return_type<
|
async_return_type<
|
||||||
AcceptHandler, void(error_code)>
|
AcceptHandler, void(error_code)>
|
||||||
#endif
|
#endif
|
||||||
async_accept(http::header<true, Fields> const& req,
|
async_accept(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
ConstBufferSequence const& buffers,
|
ConstBufferSequence const& buffers,
|
||||||
AcceptHandler&& handler);
|
AcceptHandler&& handler);
|
||||||
|
|
||||||
@@ -1614,7 +1621,7 @@ public:
|
|||||||
this function. Invocation of the handler will be performed in a
|
this function. Invocation of the handler will be performed in a
|
||||||
manner equivalent to using `boost::asio::io_service::post`.
|
manner equivalent to using `boost::asio::io_service::post`.
|
||||||
*/
|
*/
|
||||||
template<class Fields, class ConstBufferSequence,
|
template<class Allocator, class ConstBufferSequence,
|
||||||
class ResponseDecorator, class AcceptHandler>
|
class ResponseDecorator, class AcceptHandler>
|
||||||
#if BEAST_DOXYGEN
|
#if BEAST_DOXYGEN
|
||||||
void_or_deduced
|
void_or_deduced
|
||||||
@@ -1622,7 +1629,8 @@ public:
|
|||||||
async_return_type<
|
async_return_type<
|
||||||
AcceptHandler, void(error_code)>
|
AcceptHandler, void(error_code)>
|
||||||
#endif
|
#endif
|
||||||
async_accept_ex(http::header<true, Fields> const& req,
|
async_accept_ex(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
ConstBufferSequence const& buffers,
|
ConstBufferSequence const& buffers,
|
||||||
ResponseDecorator const& decorator,
|
ResponseDecorator const& decorator,
|
||||||
AcceptHandler&& handler);
|
AcceptHandler&& handler);
|
||||||
@@ -3109,9 +3117,10 @@ private:
|
|||||||
do_accept(Decorator const& decorator,
|
do_accept(Decorator const& decorator,
|
||||||
error_code& ec);
|
error_code& ec);
|
||||||
|
|
||||||
template<class Fields, class Decorator>
|
template<class Allocator, class Decorator>
|
||||||
void
|
void
|
||||||
do_accept(http::header<true, Fields> const& req,
|
do_accept(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
Decorator const& decorator, error_code& ec);
|
Decorator const& decorator, error_code& ec);
|
||||||
|
|
||||||
template<class RequestDecorator>
|
template<class RequestDecorator>
|
||||||
@@ -3129,9 +3138,10 @@ private:
|
|||||||
string_view target,
|
string_view target,
|
||||||
Decorator const& decorator);
|
Decorator const& decorator);
|
||||||
|
|
||||||
template<class Fields, class Decorator>
|
template<class Allocator, class Decorator>
|
||||||
response_type
|
response_type
|
||||||
build_response(http::header<true, Fields> const& req,
|
build_response(http::header<true,
|
||||||
|
http::basic_fields<Allocator>> const& req,
|
||||||
Decorator const& decorator);
|
Decorator const& decorator);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Reference in New Issue
Block a user