diff --git a/CHANGELOG.md b/CHANGELOG.md index 330e5aa2..674a8511 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,12 +19,15 @@ API Changes: * Add message::keep_alive() * Add message::chunked() and message::content_length() +* Remove string_view_body Actions Required: * Change user defined implementations of Fields and FieldsReader to meet the new requirements. +* Use span_body instead of string_view_body + -------------------------------------------------------------------------------- Version 77: diff --git a/doc/5_02_message.qbk b/doc/5_02_message.qbk index 3e6d1666..f9f4a3de 100644 --- a/doc/5_02_message.qbk +++ b/doc/5_02_message.qbk @@ -170,14 +170,6 @@ meet the requirements, or use the ones that come with the library: grows geometrically. Messages with this body type may be serialized and parsed. This is the type of body used in the examples. ]] -[[ - [link beast.ref.beast__http__string_view_body `string_view_body`] -][ - A body whose `value_type` is [link beast.ref.beast__string_view `string_view`]. - Messages with this body type may be serialized only, and the caller - is responsible for managing the lifetime of the buffer pointed to - by the string view. -]] [[ [link beast.ref.beast__http__vector_body `vector_body`] ][ diff --git a/doc/concept/Body.qbk b/doc/concept/Body.qbk index 85cf5736..5421286a 100644 --- a/doc/concept/Body.qbk +++ b/doc/concept/Body.qbk @@ -101,6 +101,5 @@ In this table: * [link beast.ref.beast__http__dynamic_body `dynamic_body`] * [link beast.ref.beast__http__empty_body `empty_body`] * [link beast.ref.beast__http__string_body `string_body`] -* [link beast.ref.beast__http__string_view_body `string_view_body`] [endsect] diff --git a/doc/quickref.xml b/doc/quickref.xml index 0f3559a5..3a0f5961 100644 --- a/doc/quickref.xml +++ b/doc/quickref.xml @@ -53,7 +53,6 @@ serializer span_body string_body - string_view_body vector_body diff --git a/include/beast/http.hpp b/include/beast/http.hpp index b59dde4b..4f13500e 100644 --- a/include/beast/http.hpp +++ b/include/beast/http.hpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/include/beast/http/fields.hpp b/include/beast/http/fields.hpp index 0b8eddb1..005c4ab2 100644 --- a/include/beast/http/fields.hpp +++ b/include/beast/http/fields.hpp @@ -136,7 +136,11 @@ public: }; /// The algorithm used to serialize the header +#if BEAST_DOXYGEN + using reader = implementation_defined; +#else class reader; +#endif private: using list_t = typename boost::intrusive::make_list< diff --git a/include/beast/http/string_view_body.hpp b/include/beast/http/string_view_body.hpp deleted file mode 100644 index 0219372e..00000000 --- a/include/beast/http/string_view_body.hpp +++ /dev/null @@ -1,81 +0,0 @@ -// -// Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com) -// -// 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) -// - -#ifndef BEAST_HTTP_STRING_VIEW_BODY -#define BEAST_HTTP_STRING_VIEW_BODY - -#include -#include -#include -#include -#include -#include - -namespace beast { -namespace http { - -/** A readable HTTP message body represented by a @ref string_view. - - The application must ensure that the memory pointed to - by the string view remains valid for the lifetime of - any attempted operations. - - Meets the requirements of @b Body. -*/ -struct string_view_body -{ - /// The type of the body member when used in a message. - using value_type = string_view; - - /// Returns the content length of this body in a message. - static - std::uint64_t - size(value_type const& v) - { - return v.size(); - } - -#if BEAST_DOXYGEN - /// The algorithm to obtain buffers representing the body - using reader = implementation_defined; -#else - class reader - { - string_view body_; - - public: - using const_buffers_type = - boost::asio::const_buffers_1; - - template - explicit - reader(message const& m) - : body_(m.body) - { - } - - void - init(error_code& ec) - { - ec.assign(0, ec.category()); - } - - boost::optional> - get(error_code& ec) - { - ec.assign(0, ec.category()); - return {{{body_.data(), body_.size()}, false}}; - } - }; -#endif -}; - -} // http -} // beast - -#endif diff --git a/test/http/CMakeLists.txt b/test/http/CMakeLists.txt index 52e4767c..a609f6b1 100644 --- a/test/http/CMakeLists.txt +++ b/test/http/CMakeLists.txt @@ -31,7 +31,6 @@ add_executable (http-tests span_body.cpp status.cpp string_body.cpp - string_view_body.cpp type_traits.cpp vector_body.cpp verb.cpp diff --git a/test/http/Jamfile b/test/http/Jamfile index 85b25fda..aca16300 100644 --- a/test/http/Jamfile +++ b/test/http/Jamfile @@ -24,7 +24,6 @@ unit-test http-tests : span_body.cpp status.cpp string_body.cpp - string_view_body.cpp type_traits.cpp vector_body.cpp verb.cpp diff --git a/test/http/string_view_body.cpp b/test/http/string_view_body.cpp deleted file mode 100644 index e6a00a7f..00000000 --- a/test/http/string_view_body.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// -// Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com) -// -// 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) -// - -// Test that header file is self-contained. -#include - -#include -#include -#include -#include -#include -#include - -namespace beast { -namespace http { - -class string_view_body_test - : public beast::unit_test::suite -{ -public: - void - run() override - { - static_assert(is_body_reader::value, ""); - static_assert(! is_body_writer::value, ""); - request req; - req.version = 11; - req.method(verb::post); - req.target("/"); - req.body = "Hello, world!"; - req.prepare_payload(); - static_buffer_n<512> b; - ostream(b) << req; - string_view const s{ - boost::asio::buffer_cast(*b.data().begin()), - boost::asio::buffer_size(*b.data().begin())}; - BEAST_EXPECT(s == - "POST / HTTP/1.1\r\n" - "Content-Length: 13\r\n" - "\r\n" - "Hello, world!"); - } -}; - -BEAST_DEFINE_TESTSUITE(string_view_body,http,beast); - -} // http -} // beast -