diff --git a/example/doc/http_examples.hpp b/example/doc/http_examples.hpp index af3335b3..6279fb73 100644 --- a/example/doc/http_examples.hpp +++ b/example/doc/http_examples.hpp @@ -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& req, + request>& req, error_code& ec) { static_assert(is_sync_stream::value, diff --git a/example/server-framework/multi_port.hpp b/example/server-framework/multi_port.hpp index 53f06f80..7e5dca60 100644 --- a/example/server-framework/multi_port.hpp +++ b/example/server-framework/multi_port.hpp @@ -273,12 +273,12 @@ public: @param req The upgrade request. */ - template + template void on_upgrade( socket_type&& sock, endpoint_type ep, - beast::http::request&& req) + beast::http::request&& 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 + template void on_upgrade( ssl_stream&& stream, endpoint_type ep, - beast::http::request&& req) + beast::http::request&& req) { std::make_shared( std::move(stream), diff --git a/example/server-framework/rfc7231.hpp b/example/server-framework/rfc7231.hpp index 6dcb3cbf..506f4476 100644 --- a/example/server-framework/rfc7231.hpp +++ b/example/server-framework/rfc7231.hpp @@ -26,9 +26,10 @@ namespace rfc7231 { @see https://tools.ietf.org/html/rfc7231#section-5.1.1 */ -template +template bool -is_expect_100_continue(beast::http::request const& req) +is_expect_100_continue(beast::http::request< + Body, beast::http::basic_fields> const& req) { return beast::iequals( req[beast::http::field::expect], "100-continue"); diff --git a/example/server-framework/service_list.hpp b/example/server-framework/service_list.hpp index bd82b5f7..71d73ae7 100644 --- a/example/server-framework/service_list.hpp +++ b/example/server-framework/service_list.hpp @@ -98,9 +98,9 @@ public: @code - template + template void - send(response&&); + send(response&&); @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&& req, + beast::http::request&& 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&&, + beast::http::request&&, Send const&, C 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&& req, + beast::http::request&& req, Send const& send, C const&) const { diff --git a/example/server-framework/ws_async_port.hpp b/example/server-framework/ws_async_port.hpp index da44defd..c799ab9f 100644 --- a/example/server-framework/ws_async_port.hpp +++ b/example/server-framework/ws_async_port.hpp @@ -90,9 +90,9 @@ public: // This overload handles the case where we // already have the WebSocket Upgrade request. // - template + template void - run(beast::http::request const& req) + run(beast::http::request 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 + template void on_upgrade( socket_type&& sock, endpoint_type ep, - beast::http::request&& req) + beast::http::request&& req) { std::make_shared( std::move(sock), diff --git a/example/server-framework/ws_sync_port.hpp b/example/server-framework/ws_sync_port.hpp index ebfc1291..4ebea95f 100644 --- a/example/server-framework/ws_sync_port.hpp +++ b/example/server-framework/ws_sync_port.hpp @@ -93,9 +93,9 @@ public: // Run the connection from an already-received Upgrade request. // - template + template void - run(beast::http::request&& req) + run(beast::http::request&& 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{ + lambda{ 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 + template class lambda { std::shared_ptr self_; - beast::http::request req_; + beast::http::request req_; public: // Constructor @@ -181,7 +181,7 @@ private: // lambda( std::shared_ptr self, - beast::http::request&& req) + beast::http::request&& req) : self_(std::move(self)) , req_(std::move(req)) { @@ -407,12 +407,12 @@ public: @param req The upgrade request. */ - template + template void on_upgrade( socket_type&& sock, endpoint_type ep, - beast::http::request&& req) + beast::http::request&& req) { // Create the connection object and run it, // transferring ownership of the ugprade request. diff --git a/example/server-framework/ws_upgrade_service.hpp b/example/server-framework/ws_upgrade_service.hpp index 282f2e00..d4d8f5d6 100644 --- a/example/server-framework/ws_upgrade_service.hpp +++ b/example/server-framework/ws_upgrade_service.hpp @@ -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&& req, + beast::http::request&& req, Send const&) const { // If its not an upgrade request, return `false` diff --git a/example/server-framework/wss_ports.hpp b/example/server-framework/wss_ports.hpp index eb86adfe..38cc2bab 100644 --- a/example/server-framework/wss_ports.hpp +++ b/example/server-framework/wss_ports.hpp @@ -291,12 +291,12 @@ public: @param req The upgrade request. */ - template + template void on_upgrade( ssl_stream&& stream, endpoint_type ep, - beast::http::request&& req) + beast::http::request&& 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 + template void on_upgrade( ssl_stream&& stream, endpoint_type ep, - beast::http::request&& req) + beast::http::request&& req) { std::make_shared( std::move(stream), diff --git a/include/beast/websocket/detail/pmd_extension.hpp b/include/beast/websocket/detail/pmd_extension.hpp index 33978257..ac1a5a91 100644 --- a/include/beast/websocket/detail/pmd_extension.hpp +++ b/include/beast/websocket/detail/pmd_extension.hpp @@ -66,9 +66,10 @@ parse_bits(string_view s) // Parse permessage-deflate request fields // -template +template void -pmd_read(pmd_offer& offer, Fields const& fields) +pmd_read(pmd_offer& offer, + http::basic_fields const& fields) { offer.accept = false; 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 // -template +template void -pmd_write(Fields& fields, pmd_offer const& offer) +pmd_write(http::basic_fields& fields, + pmd_offer const& offer) { static_string<512> s; s = "permessage-deflate"; @@ -239,10 +241,10 @@ pmd_write(Fields& fields, pmd_offer const& offer) // Negotiate a permessage-deflate client offer // -template +template void pmd_negotiate( - Fields& fields, + http::basic_fields& fields, pmd_offer& config, pmd_offer const& offer, permessage_deflate const& o) diff --git a/include/beast/websocket/impl/accept.ipp b/include/beast/websocket/impl/accept.ipp index 6110df11..a13baceb 100644 --- a/include/beast/websocket/impl/accept.ipp +++ b/include/beast/websocket/impl/accept.ipp @@ -42,9 +42,9 @@ class stream::response_op response_type res; int state = 0; - template - data(Handler&, stream& ws_, - http::header const& req, + template + data(Handler&, stream& ws_, http::header< + true, http::basic_fields> const& req, Decorator const& decorator, bool cont_) : cont(cont_) @@ -53,10 +53,10 @@ class stream::response_op { } - template - data(Handler&, stream& ws_, - http::header const& req, + data(Handler&, stream& ws_, http::header< + true, http::basic_fields> const& req, Buffers const& buffers, Decorator const& decorator, bool cont_) @@ -443,10 +443,11 @@ accept_ex(ConstBufferSequence const& buffers, } template -template +template void stream:: -accept(http::header const& req) +accept(http::header> const& req) { static_assert(is_sync_stream::value, "SyncStream requirements not met"); @@ -457,10 +458,11 @@ accept(http::header const& req) } template -template +template void stream:: -accept_ex(http::header const& req, +accept_ex(http::header> const& req, ResponseDecorator const& decorator) { static_assert(is_sync_stream::value, @@ -475,11 +477,12 @@ accept_ex(http::header const& req, } template -template +template void stream:: -accept(http::header const& req, - error_code& ec) +accept(http::header> const& req, + error_code& ec) { static_assert(is_sync_stream::value, "SyncStream requirements not met"); @@ -488,11 +491,12 @@ accept(http::header const& req, } template -template +template void stream:: -accept_ex(http::header const& req, - ResponseDecorator const& decorator, error_code& ec) +accept_ex(http::header> const& req, + ResponseDecorator const& decorator, error_code& ec) { static_assert(is_sync_stream::value, "SyncStream requirements not met"); @@ -504,11 +508,12 @@ accept_ex(http::header const& req, } template -template +template void stream:: -accept(http::header const& req, - ConstBufferSequence const& buffers) +accept(http::header> const& req, + ConstBufferSequence const& buffers) { static_assert(is_sync_stream::value, "SyncStream requirements not met"); @@ -522,13 +527,14 @@ accept(http::header const& req, } template -template void stream:: -accept_ex(http::header const& req, - ConstBufferSequence const& buffers, - ResponseDecorator const& decorator) +accept_ex(http::header> const& req, + ConstBufferSequence const& buffers, + ResponseDecorator const& decorator) { static_assert(is_sync_stream::value, "SyncStream requirements not met"); @@ -545,11 +551,12 @@ accept_ex(http::header const& req, } template -template +template void stream:: -accept(http::header const& req, - ConstBufferSequence const& buffers, error_code& ec) +accept(http::header const& req, + ConstBufferSequence const& buffers, error_code& ec) { static_assert(is_sync_stream::value, "SyncStream requirements not met"); @@ -566,14 +573,15 @@ accept(http::header const& req, } template -template void stream:: -accept_ex(http::header const& req, - ConstBufferSequence const& buffers, - ResponseDecorator const& decorator, - error_code& ec) +accept_ex(http::header> const& req, + ConstBufferSequence const& buffers, + ResponseDecorator const& decorator, + error_code& ec) { static_assert(is_sync_stream::value, "SyncStream requirements not met"); @@ -688,12 +696,13 @@ async_accept_ex(ConstBufferSequence const& buffers, } template -template +template async_return_type< AcceptHandler, void(error_code)> stream:: -async_accept(http::header const& req, - AcceptHandler&& handler) +async_accept(http::header> const& req, + AcceptHandler&& handler) { static_assert(is_async_stream::value, "AsyncStream requirements requirements not met"); @@ -710,13 +719,14 @@ async_accept(http::header const& req, } template -template async_return_type< AcceptHandler, void(error_code)> stream:: -async_accept_ex(http::header const& req, - ResponseDecorator const& decorator, AcceptHandler&& handler) +async_accept_ex(http::header> const& req, + ResponseDecorator const& decorator, AcceptHandler&& handler) { static_assert(is_async_stream::value, "AsyncStream requirements requirements not met"); @@ -736,14 +746,15 @@ async_accept_ex(http::header const& req, } template -template async_return_type< AcceptHandler, void(error_code)> stream:: -async_accept(http::header const& req, - ConstBufferSequence const& buffers, - AcceptHandler&& handler) +async_accept(http::header> const& req, + ConstBufferSequence const& buffers, + AcceptHandler&& handler) { static_assert(is_async_stream::value, "AsyncStream requirements requirements not met"); @@ -763,15 +774,16 @@ async_accept(http::header const& req, } template -template async_return_type< AcceptHandler, void(error_code)> stream:: -async_accept_ex(http::header const& req, - ConstBufferSequence const& buffers, - ResponseDecorator const& decorator, - AcceptHandler&& handler) +async_accept_ex(http::header> const& req, + ConstBufferSequence const& buffers, + ResponseDecorator const& decorator, + AcceptHandler&& handler) { static_assert(is_async_stream::value, "AsyncStream requirements requirements not met"); diff --git a/include/beast/websocket/impl/rfc6455.ipp b/include/beast/websocket/impl/rfc6455.ipp index 5452f68a..e06b152c 100644 --- a/include/beast/websocket/impl/rfc6455.ipp +++ b/include/beast/websocket/impl/rfc6455.ipp @@ -8,14 +8,16 @@ #ifndef BEAST_WEBSOCKET_IMPL_RFC6455_IPP #define BEAST_WEBSOCKET_IMPL_RFC6455_IPP +#include #include namespace beast { namespace websocket { -template +template bool -is_upgrade(http::header const& req) +is_upgrade(http::header> const& req) { if(req.version < 11) return false; diff --git a/include/beast/websocket/impl/stream.ipp b/include/beast/websocket/impl/stream.ipp index 1e185adf..a12bfbb7 100644 --- a/include/beast/websocket/impl/stream.ipp +++ b/include/beast/websocket/impl/stream.ipp @@ -101,11 +101,12 @@ do_accept( } template -template +template void stream:: -do_accept(http::header const& req, - Decorator const& decorator, error_code& ec) +do_accept(http::header> const& req, + Decorator const& decorator, error_code& ec) { auto const res = build_response(req, decorator); http::write(stream_, res, ec); @@ -192,11 +193,12 @@ build_request(detail::sec_ws_key_type& key, } template -template +template response_type stream:: -build_response(http::header const& req, - Decorator const& decorator) +build_response(http::header> const& req, + Decorator const& decorator) { auto const decorate = [&decorator](response_type& res) diff --git a/include/beast/websocket/rfc6455.hpp b/include/beast/websocket/rfc6455.hpp index c0d67b6d..bb819c87 100644 --- a/include/beast/websocket/rfc6455.hpp +++ b/include/beast/websocket/rfc6455.hpp @@ -50,9 +50,10 @@ namespace websocket { @return `true` if the request is a WebSocket Upgrade. */ -template +template bool -is_upgrade(beast::http::header const& req); +is_upgrade(beast::http::header> const& req); /** Close status codes. diff --git a/include/beast/websocket/stream.hpp b/include/beast/websocket/stream.hpp index befc7a8e..a3212491 100644 --- a/include/beast/websocket/stream.hpp +++ b/include/beast/websocket/stream.hpp @@ -836,9 +836,9 @@ public: @throws system_error Thrown on failure. */ - template + template void - accept(http::header const& req); + accept(http::header> const& req); /** Respond to a WebSocket HTTP Upgrade request @@ -877,10 +877,11 @@ public: @throws system_error Thrown on failure. */ - template + template void - accept_ex(http::header const& req, - ResponseDecorator const& decorator); + accept_ex(http::header> const& req, + ResponseDecorator const& decorator); /** Respond to a WebSocket HTTP Upgrade request @@ -910,9 +911,9 @@ public: @param ec Set to indicate what error occurred, if any. */ - template + template void - accept(http::header const& req, + accept(http::header> const& req, error_code& ec); /** Respond to a WebSocket HTTP Upgrade request @@ -952,11 +953,12 @@ public: @param ec Set to indicate what error occurred, if any. */ - template + template void - accept_ex(http::header const& req, - ResponseDecorator const& decorator, - error_code& ec); + accept_ex(http::header> const& req, + ResponseDecorator const& decorator, + error_code& ec); /** Respond to a WebSocket HTTP Upgrade request @@ -991,9 +993,9 @@ public: @throws system_error Thrown on failure. */ - template + template void - accept(http::header const& req, + accept(http::header> const& req, ConstBufferSequence const& buffers); /** Respond to a WebSocket HTTP Upgrade request @@ -1038,12 +1040,13 @@ public: @throws system_error Thrown on failure. */ - template void - accept_ex(http::header const& req, - ConstBufferSequence const& buffers, - ResponseDecorator const& decorator); + accept_ex(http::header> const& req, + ConstBufferSequence const& buffers, + ResponseDecorator const& decorator); /** Respond to a WebSocket HTTP Upgrade request @@ -1078,9 +1081,9 @@ public: @param ec Set to indicate what error occurred, if any. */ - template + template void - accept(http::header const& req, + accept(http::header const& req, ConstBufferSequence const& buffers, error_code& ec); /** Respond to a WebSocket HTTP Upgrade request @@ -1125,13 +1128,14 @@ public: @param ec Set to indicate what error occurred, if any. */ - template void - accept_ex(http::header const& req, - ConstBufferSequence const& buffers, - ResponseDecorator const& decorator, - error_code& ec); + accept_ex(http::header> const& req, + ConstBufferSequence const& buffers, + ResponseDecorator const& decorator, + error_code& ec); /** Start reading and responding to a WebSocket HTTP Upgrade request. @@ -1413,15 +1417,16 @@ public: this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post`. */ - template + template #if BEAST_DOXYGEN void_or_deduced #else async_return_type< AcceptHandler, void(error_code)> #endif - async_accept(http::header const& req, - AcceptHandler&& handler); + async_accept(http::header> const& req, + AcceptHandler&& handler); /** Start responding to a WebSocket HTTP Upgrade request. @@ -1477,7 +1482,7 @@ public: this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post`. */ - template #if BEAST_DOXYGEN void_or_deduced @@ -1485,9 +1490,10 @@ public: async_return_type< AcceptHandler, void(error_code)> #endif - async_accept_ex(http::header const& req, - ResponseDecorator const& decorator, - AcceptHandler&& handler); + async_accept_ex(http::header> const& req, + ResponseDecorator const& decorator, + AcceptHandler&& handler); /** Start responding to a WebSocket HTTP Upgrade request. @@ -1541,7 +1547,7 @@ public: this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post`. */ - template #if BEAST_DOXYGEN void_or_deduced @@ -1549,9 +1555,10 @@ public: async_return_type< AcceptHandler, void(error_code)> #endif - async_accept(http::header const& req, - ConstBufferSequence const& buffers, - AcceptHandler&& handler); + async_accept(http::header> const& req, + ConstBufferSequence const& buffers, + AcceptHandler&& handler); /** Start responding to a WebSocket HTTP Upgrade request. @@ -1614,7 +1621,7 @@ public: this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post`. */ - template #if BEAST_DOXYGEN void_or_deduced @@ -1622,10 +1629,11 @@ public: async_return_type< AcceptHandler, void(error_code)> #endif - async_accept_ex(http::header const& req, - ConstBufferSequence const& buffers, - ResponseDecorator const& decorator, - AcceptHandler&& handler); + async_accept_ex(http::header> const& req, + ConstBufferSequence const& buffers, + ResponseDecorator const& decorator, + AcceptHandler&& handler); /** Send an HTTP WebSocket Upgrade request and receive the response. @@ -3109,10 +3117,11 @@ private: do_accept(Decorator const& decorator, error_code& ec); - template + template void - do_accept(http::header const& req, - Decorator const& decorator, error_code& ec); + do_accept(http::header> const& req, + Decorator const& decorator, error_code& ec); template void @@ -3129,10 +3138,11 @@ private: string_view target, Decorator const& decorator); - template + template response_type - build_response(http::header const& req, - Decorator const& decorator); + build_response(http::header> const& req, + Decorator const& decorator); void do_response(http::header const& resp,