forked from boostorg/beast
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<
|
||||
class SyncStream,
|
||||
class DynamicBuffer,
|
||||
class Body, class Fields>
|
||||
class Body, class Allocator>
|
||||
void
|
||||
send_expect_100_continue(
|
||||
SyncStream& stream,
|
||||
DynamicBuffer& buffer,
|
||||
request<Body, Fields>& req,
|
||||
request<Body, basic_fields<Allocator>>& req,
|
||||
error_code& ec)
|
||||
{
|
||||
static_assert(is_sync_stream<SyncStream>::value,
|
||||
|
||||
@@ -273,12 +273,12 @@ public:
|
||||
|
||||
@param req The upgrade request.
|
||||
*/
|
||||
template<class Body, class Fields>
|
||||
template<class Body>
|
||||
void
|
||||
on_upgrade(
|
||||
socket_type&& sock,
|
||||
endpoint_type ep,
|
||||
beast::http::request<Body, Fields>&& req)
|
||||
beast::http::request<Body>&& req)
|
||||
{
|
||||
// Create the connection and call the version of
|
||||
// run that takes the request since we have it already
|
||||
@@ -304,12 +304,12 @@ public:
|
||||
|
||||
@param req The upgrade request.
|
||||
*/
|
||||
template<class Body, class Fields>
|
||||
template<class Body>
|
||||
void
|
||||
on_upgrade(
|
||||
ssl_stream<socket_type>&& stream,
|
||||
endpoint_type ep,
|
||||
beast::http::request<Body, Fields>&& req)
|
||||
beast::http::request<Body>&& req)
|
||||
{
|
||||
std::make_shared<async_wss_con>(
|
||||
std::move(stream),
|
||||
|
||||
@@ -26,9 +26,10 @@ namespace rfc7231 {
|
||||
|
||||
@see https://tools.ietf.org/html/rfc7231#section-5.1.1
|
||||
*/
|
||||
template<class Body, class Fields>
|
||||
template<class Body, class Allocator>
|
||||
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(
|
||||
req[beast::http::field::expect], "100-continue");
|
||||
|
||||
@@ -98,9 +98,9 @@ public:
|
||||
|
||||
@code
|
||||
|
||||
template<class Body, class Fields>
|
||||
template<class Body>
|
||||
void
|
||||
send(response<Body, Fields>&&);
|
||||
send(response<Body>&&);
|
||||
|
||||
@endcode
|
||||
|
||||
@@ -112,13 +112,13 @@ public:
|
||||
*/
|
||||
template<
|
||||
class Stream,
|
||||
class Body, class Fields,
|
||||
class Body,
|
||||
class Send>
|
||||
bool
|
||||
respond(
|
||||
Stream&& stream,
|
||||
endpoint_type const& ep,
|
||||
beast::http::request<Body, Fields>&& req,
|
||||
beast::http::request<Body>&& req,
|
||||
Send const& send) const
|
||||
{
|
||||
return try_respond(
|
||||
@@ -135,13 +135,13 @@ private:
|
||||
*/
|
||||
template<
|
||||
class Stream,
|
||||
class Body, class Fields,
|
||||
class Body,
|
||||
class Send>
|
||||
bool
|
||||
try_respond(
|
||||
Stream&&,
|
||||
endpoint_type const&,
|
||||
beast::http::request<Body, Fields>&&,
|
||||
beast::http::request<Body>&&,
|
||||
Send const&,
|
||||
C<sizeof...(Services)> const&) const
|
||||
{
|
||||
@@ -155,14 +155,14 @@ private:
|
||||
//
|
||||
template<
|
||||
class Stream,
|
||||
class Body, class Fields,
|
||||
class Body,
|
||||
class Send,
|
||||
std::size_t I>
|
||||
bool
|
||||
try_respond(
|
||||
Stream&& stream,
|
||||
endpoint_type const& ep,
|
||||
beast::http::request<Body, Fields>&& req,
|
||||
beast::http::request<Body>&& req,
|
||||
Send const& send,
|
||||
C<I> const&) const
|
||||
{
|
||||
|
||||
@@ -90,9 +90,9 @@ public:
|
||||
// This overload handles the case where we
|
||||
// already have the WebSocket Upgrade request.
|
||||
//
|
||||
template<class Body, class Fields>
|
||||
template<class Body>
|
||||
void
|
||||
run(beast::http::request<Body, Fields> const& req)
|
||||
run(beast::http::request<Body> const& req)
|
||||
{
|
||||
// Call the overload of accept() which takes
|
||||
// the request by parameter, instead of reading
|
||||
@@ -352,12 +352,12 @@ public:
|
||||
|
||||
@param req The upgrade request.
|
||||
*/
|
||||
template<class Body, class Fields>
|
||||
template<class Body>
|
||||
void
|
||||
on_upgrade(
|
||||
socket_type&& sock,
|
||||
endpoint_type ep,
|
||||
beast::http::request<Body, Fields>&& req)
|
||||
beast::http::request<Body>&& req)
|
||||
{
|
||||
std::make_shared<async_ws_con>(
|
||||
std::move(sock),
|
||||
|
||||
@@ -93,9 +93,9 @@ public:
|
||||
|
||||
// Run the connection from an already-received Upgrade request.
|
||||
//
|
||||
template<class Body, class Fields>
|
||||
template<class Body>
|
||||
void
|
||||
run(beast::http::request<Body, Fields>&& req)
|
||||
run(beast::http::request<Body>&& 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.
|
||||
//
|
||||
std::thread{
|
||||
lambda<Body, Fields>{
|
||||
lambda<Body>{
|
||||
impl().shared_from_this(),
|
||||
std::move(req)
|
||||
}}.detach();
|
||||
@@ -168,11 +168,11 @@ private:
|
||||
// we write out the lambda ourselves. This is similar to what
|
||||
// the compiler would generate anyway.
|
||||
//
|
||||
template<class Body, class Fields>
|
||||
template<class Body>
|
||||
class lambda
|
||||
{
|
||||
std::shared_ptr<sync_ws_con_base> self_;
|
||||
beast::http::request<Body, Fields> req_;
|
||||
beast::http::request<Body> req_;
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
@@ -181,7 +181,7 @@ private:
|
||||
//
|
||||
lambda(
|
||||
std::shared_ptr<sync_ws_con_base> self,
|
||||
beast::http::request<Body, Fields>&& req)
|
||||
beast::http::request<Body>&& req)
|
||||
: self_(std::move(self))
|
||||
, req_(std::move(req))
|
||||
{
|
||||
@@ -407,12 +407,12 @@ public:
|
||||
|
||||
@param req The upgrade request.
|
||||
*/
|
||||
template<class Body, class Fields>
|
||||
template<class Body>
|
||||
void
|
||||
on_upgrade(
|
||||
socket_type&& sock,
|
||||
endpoint_type ep,
|
||||
beast::http::request<Body, Fields>&& req)
|
||||
beast::http::request<Body>&& req)
|
||||
{
|
||||
// Create the connection object and run it,
|
||||
// transferring ownership of the ugprade request.
|
||||
|
||||
@@ -67,13 +67,13 @@ public:
|
||||
*/
|
||||
template<
|
||||
class Stream,
|
||||
class Body, class Fields,
|
||||
class Body,
|
||||
class Send>
|
||||
bool
|
||||
respond(
|
||||
Stream&& stream,
|
||||
endpoint_type const& ep,
|
||||
beast::http::request<Body, Fields>&& req,
|
||||
beast::http::request<Body>&& req,
|
||||
Send const&) const
|
||||
{
|
||||
// If its not an upgrade request, return `false`
|
||||
|
||||
@@ -291,12 +291,12 @@ public:
|
||||
|
||||
@param req The upgrade request.
|
||||
*/
|
||||
template<class Body, class Fields>
|
||||
template<class Body>
|
||||
void
|
||||
on_upgrade(
|
||||
ssl_stream<socket_type>&& stream,
|
||||
endpoint_type ep,
|
||||
beast::http::request<Body, Fields>&& req)
|
||||
beast::http::request<Body>&& req)
|
||||
{
|
||||
// Create the connection object and run it,
|
||||
// transferring ownership of the ugprade request.
|
||||
@@ -415,12 +415,12 @@ public:
|
||||
|
||||
@param req The upgrade request.
|
||||
*/
|
||||
template<class Body, class Fields>
|
||||
template<class Body>
|
||||
void
|
||||
on_upgrade(
|
||||
ssl_stream<socket_type>&& stream,
|
||||
endpoint_type ep,
|
||||
beast::http::request<Body, Fields>&& req)
|
||||
beast::http::request<Body>&& req)
|
||||
{
|
||||
std::make_shared<async_wss_con>(
|
||||
std::move(stream),
|
||||
|
||||
Reference in New Issue
Block a user