diff --git a/CHANGELOG.md b/CHANGELOG.md index ef8056ea..e5877b9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,14 @@ Version 64: * Doc tidying * Add link_directories to cmake +API Changes: + +* Remove make_serializer + +Actions Required: + +* Replace calls to make_serializer with variable declarations + -------------------------------------------------------------------------------- Version 63: diff --git a/doc/5_04_serializer_streams.qbk b/doc/5_04_serializer_streams.qbk index 90c9297b..52664d2e 100644 --- a/doc/5_04_serializer_streams.qbk +++ b/doc/5_04_serializer_streams.qbk @@ -29,12 +29,6 @@ This code creates an HTTP response and the corresponding serializer: [http_snippet_10] -The function -[link beast.ref.beast__http__make_serializer `make_serializer`] -is provided to simplify creation of variables: - -[http_snippet_11] - The stream operations which work on serializers are: [table Serializer Stream Operations diff --git a/doc/quickref.xml b/doc/quickref.xml index eb08b6e7..5a8dbd0d 100644 --- a/doc/quickref.xml +++ b/doc/quickref.xml @@ -66,7 +66,6 @@ async_write_header async_write_some int_to_status - make_serializer obsolete_reason operator<< read diff --git a/example/doc/http_examples.hpp b/example/doc/http_examples.hpp index 5716fbb1..c52b8570 100644 --- a/example/doc/http_examples.hpp +++ b/example/doc/http_examples.hpp @@ -65,7 +65,7 @@ send_expect_100_continue( req.set(field::expect, "100-continue"); // Create the serializer - auto sr = make_serializer(req); + serializer> sr{req}; // Send just the header write_header(stream, sr, ec); @@ -214,7 +214,7 @@ send_cgi_response( // to acquire buffers from the body (which would return // the error http::need_buffer because we set `data` // to `nullptr` above). - auto sr = make_serializer(res); + serializer sr{res}; // Send the header immediately. write_header(output, sr, ec); diff --git a/include/beast/http/impl/write.ipp b/include/beast/http/impl/write.ipp index 34f0217b..3f781856 100644 --- a/include/beast/http/impl/write.ipp +++ b/include/beast/http/impl/write.ipp @@ -756,7 +756,7 @@ write(SyncWriteStream& stream, "Body requirements not met"); static_assert(is_body_reader::value, "BodyReader requirements not met"); - auto sr = make_serializer(msg); + serializer sr{msg}; write(stream, sr, ec); } diff --git a/include/beast/http/serializer.hpp b/include/beast/http/serializer.hpp index bc2db093..6e48d8bd 100644 --- a/include/beast/http/serializer.hpp +++ b/include/beast/http/serializer.hpp @@ -53,10 +53,8 @@ struct no_chunk_decorator /** Provides buffer oriented HTTP message serialization functionality. An object of this type is used to serialize a complete - HTTP message into a seriest of octets. To use this class, + HTTP message into a sequence of octets. To use this class, construct an instance with the message to be serialized. - To make it easier to declare the type, the helper function - @ref make_serializer is provided. The implementation will automatically perform chunk encoding if the contents of the message indicate that chunk encoding @@ -114,11 +112,11 @@ struct no_chunk_decorator @tparam Fields The type of fields in the message. @tparam ChunkDecorator The type of chunk decorator to use. - - @see @ref make_serializer */ template< - bool isRequest, class Body, class Fields, + bool isRequest, + class Body, + class Fields = fields, class ChunkDecorator = no_chunk_decorator> class serializer { @@ -322,27 +320,6 @@ public: consume(std::size_t n); }; -/** Return a stateful object to serialize an HTTP message. - - This convenience function makes it easier to declare - the variable for a given message. - - @see @ref serializer -*/ -template< - bool isRequest, class Body, class Fields, - class ChunkDecorator = no_chunk_decorator> -inline -serializer::type> -make_serializer(message const& m, - ChunkDecorator const& decorator = ChunkDecorator{}) -{ - return serializer::type>{ - m, decorator}; -} - } // http } // beast diff --git a/test/http/doc_snippets.cpp b/test/http/doc_snippets.cpp index 3abf435d..f2ac74be 100644 --- a/test/http/doc_snippets.cpp +++ b/test/http/doc_snippets.cpp @@ -128,15 +128,6 @@ void fxx() { //] } -{ - response res; -//[http_snippet_11 - - auto sr = make_serializer(res); - -//] -} - } // fxx() //[http_snippet_12 diff --git a/test/http/write.cpp b/test/http/write.cpp index 0bccb8dd..5fe31a95 100644 --- a/test/http/write.cpp +++ b/test/http/write.cpp @@ -678,7 +678,7 @@ public: isRequest, Body, Fields> const& m, error_code& ec, Decorator const& decorator = Decorator{}) { - auto sr = make_serializer(m, decorator); + serializer sr{m}; for(;;) { stream.nwrite = 0; @@ -700,7 +700,7 @@ public: error_code& ec, yield_context yield, Decorator const& decorator = Decorator{}) { - auto sr = make_serializer(m); + serializer sr{m}; for(;;) { stream.nwrite = 0;