From 6e47e9a0ac5bcf7bfd233f9eff9c98c8335374bb Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Thu, 4 May 2017 16:00:20 -0700 Subject: [PATCH] Rename to flat_buffer, basic_flat_buffer (API Change): These classes are renamed: * flat_streambuf to flat_buffer * basic_flat_streambuf to basic_flat_buffer --- CHANGELOG.md | 1 + doc/examples.qbk | 3 +- doc/quickref.xml | 4 +- examples/http_example.cpp | 2 +- include/beast/core.hpp | 2 +- .../{flat_streambuf.hpp => flat_buffer.hpp} | 46 +++--- .../{flat_streambuf.ipp => flat_buffer.ipp} | 70 ++++---- include/beast/http/basic_parser.hpp | 4 +- test/Jamfile | 2 +- test/core/CMakeLists.txt | 2 +- .../{flat_streambuf.cpp => flat_buffer.cpp} | 154 +++++++++--------- test/http/design.cpp | 30 ++-- test/http/header_parser.cpp | 6 +- test/http/message_parser.cpp | 6 +- 14 files changed, 167 insertions(+), 165 deletions(-) rename include/beast/core/{flat_streambuf.hpp => flat_buffer.hpp} (88%) rename include/beast/core/impl/{flat_streambuf.ipp => flat_buffer.ipp} (82%) rename test/core/{flat_streambuf.cpp => flat_buffer.cpp} (63%) diff --git a/CHANGELOG.md b/CHANGELOG.md index f66aa954..a9b05060 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ API Changes: * New ostream() returns dynamic buffer output stream * New buffers() replaces to_string() * Rename to multi_buffer, basic_multi_buffer +* Rename to flat_buffer, basic_flat_buffer -------------------------------------------------------------------------------- diff --git a/doc/examples.qbk b/doc/examples.qbk index b7d51d0a..aecd3083 100644 --- a/doc/examples.qbk +++ b/doc/examples.qbk @@ -17,6 +17,7 @@ in the examples directory. Use HTTP to request the root page from a website and print the response: ``` +#include #include #include #include @@ -45,7 +46,7 @@ int main() beast::http::write(sock, req); // Receive and print HTTP response using beast - beast::multi_buffer b; + beast::flat_buffer b; beast::http::response res; beast::http::read(sock, b, res); std::cout << res; diff --git a/doc/quickref.xml b/doc/quickref.xml index 8df34ed0..2c4581f8 100644 --- a/doc/quickref.xml +++ b/doc/quickref.xml @@ -152,7 +152,7 @@ Classes async_completion - basic_flat_streambuf + basic_flat_buffer basic_multi_buffer buffers_adapter consuming_buffers @@ -161,7 +161,7 @@ error_category error_code error_condition - flat_streambuf + flat_buffer handler_alloc handler_ptr multi_buffer diff --git a/examples/http_example.cpp b/examples/http_example.cpp index 6ef4e924..29cdedcd 100644 --- a/examples/http_example.cpp +++ b/examples/http_example.cpp @@ -34,7 +34,7 @@ int main() beast::http::write(sock, req); // Receive and print HTTP response using beast - beast::multi_buffer b; + beast::flat_buffer b; beast::http::response res; beast::http::read(sock, b, res); std::cout << res; diff --git a/include/beast/core.hpp b/include/beast/core.hpp index 7f7f369f..078ac76a 100644 --- a/include/beast/core.hpp +++ b/include/beast/core.hpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/beast/core/flat_streambuf.hpp b/include/beast/core/flat_buffer.hpp similarity index 88% rename from include/beast/core/flat_streambuf.hpp rename to include/beast/core/flat_buffer.hpp index bf6ed9a8..ce006f69 100644 --- a/include/beast/core/flat_streambuf.hpp +++ b/include/beast/core/flat_buffer.hpp @@ -5,8 +5,8 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BEAST_FLAT_STREAMBUF_HPP -#define BEAST_FLAT_STREAMBUF_HPP +#ifndef BEAST_FLAT_BUFFER_HPP +#define BEAST_FLAT_BUFFER_HPP #include #include @@ -34,7 +34,7 @@ namespace beast { is stored in a single contiguous buffer. */ template -class basic_flat_streambuf +class basic_flat_buffer #if ! BEAST_DOXYGEN : private detail::empty_base_optimization< typename std::allocator_traits:: @@ -58,7 +58,7 @@ private: }; template - friend class basic_flat_streambuf; + friend class basic_flat_buffer; using alloc_traits = std::allocator_traits; @@ -86,11 +86,11 @@ public: using mutable_buffers_type = boost::asio::mutable_buffers_1; /// Copy assignment (disallowed). - basic_flat_streambuf& - operator=(basic_flat_streambuf const&) = delete; + basic_flat_buffer& + operator=(basic_flat_buffer const&) = delete; /// Destructor. - ~basic_flat_streambuf(); + ~basic_flat_buffer(); /** Move constructor. @@ -101,7 +101,7 @@ public: have a capacity of zero, an empty input sequence, and an empty output sequence. */ - basic_flat_streambuf(basic_flat_streambuf&&); + basic_flat_buffer(basic_flat_buffer&&); /** Move constructor. @@ -115,7 +115,7 @@ public: @param alloc The allocator to associate with the stream buffer. */ - basic_flat_streambuf(basic_flat_streambuf&&, + basic_flat_buffer(basic_flat_buffer&&, Allocator const& alloc); /** Copy constructor. @@ -123,7 +123,7 @@ public: The new object will have a copy of the input sequence and an empty output sequence. */ - basic_flat_streambuf(basic_flat_streambuf const&); + basic_flat_buffer(basic_flat_buffer const&); /** Copy constructor. @@ -133,7 +133,7 @@ public: @param alloc The allocator to associate with the stream buffer. */ - basic_flat_streambuf(basic_flat_streambuf const&, + basic_flat_buffer(basic_flat_buffer const&, Allocator const& alloc); /** Copy constructor. @@ -142,8 +142,8 @@ public: and an empty output sequence. */ template - basic_flat_streambuf( - basic_flat_streambuf const&); + basic_flat_buffer( + basic_flat_buffer const&); /** Copy constructor. @@ -154,8 +154,8 @@ public: stream buffer. */ template - basic_flat_streambuf( - basic_flat_streambuf const&, + basic_flat_buffer( + basic_flat_buffer const&, Allocator const& alloc); /** Construct a flat stream buffer. @@ -169,7 +169,7 @@ public: possible value of `std::size_t` is used. */ explicit - basic_flat_streambuf(std::size_t limit = ( + basic_flat_buffer(std::size_t limit = ( std::numeric_limits::max)()); /** Construct a flat stream buffer. @@ -185,7 +185,7 @@ public: that can be allocated. If unspecified, the largest possible value of `std::size_t` is used. */ - basic_flat_streambuf(Allocator const& alloc, + basic_flat_buffer(Allocator const& alloc, std::size_t limit = ( std::numeric_limits::max)()); @@ -287,24 +287,24 @@ public: template friend std::size_t - read_size_helper(basic_flat_streambuf< + read_size_helper(basic_flat_buffer< OtherAlloc> const&, std::size_t); private: void - move_from(basic_flat_streambuf& other); + move_from(basic_flat_buffer& other); template void - copy_from(basic_flat_streambuf< + copy_from(basic_flat_buffer< OtherAlloc> const& other); }; -using flat_streambuf = - basic_flat_streambuf>; +using flat_buffer = + basic_flat_buffer>; } // beast -#include +#include #endif diff --git a/include/beast/core/impl/flat_streambuf.ipp b/include/beast/core/impl/flat_buffer.ipp similarity index 82% rename from include/beast/core/impl/flat_streambuf.ipp rename to include/beast/core/impl/flat_buffer.ipp index 377ba211..9787fb7c 100644 --- a/include/beast/core/impl/flat_streambuf.ipp +++ b/include/beast/core/impl/flat_buffer.ipp @@ -5,8 +5,8 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BEAST_IMPL_FLAT_STREAMBUF_HPP -#define BEAST_IMPL_FLAT_STREAMBUF_HPP +#ifndef BEAST_IMPL_FLAT_BUFFER_HPP +#define BEAST_IMPL_FLAT_BUFFER_HPP #include #include @@ -37,8 +37,8 @@ next_pow2(std::size_t x) template void -basic_flat_streambuf:: -move_from(basic_flat_streambuf& other) +basic_flat_buffer:: +move_from(basic_flat_buffer& other) { p_ = other.p_; in_ = other.in_; @@ -56,8 +56,8 @@ move_from(basic_flat_streambuf& other) template template void -basic_flat_streambuf:: -copy_from(basic_flat_streambuf< +basic_flat_buffer:: +copy_from(basic_flat_buffer< OtherAlloc> const& other) { max_ = other.max_; @@ -81,8 +81,8 @@ copy_from(basic_flat_streambuf< } template -basic_flat_streambuf:: -~basic_flat_streambuf() +basic_flat_buffer:: +~basic_flat_buffer() { if(p_) alloc_traits::deallocate( @@ -90,8 +90,8 @@ basic_flat_streambuf:: } template -basic_flat_streambuf:: -basic_flat_streambuf(basic_flat_streambuf&& other) +basic_flat_buffer:: +basic_flat_buffer(basic_flat_buffer&& other) : detail::empty_base_optimization< allocator_type>(std::move(other.member())) { @@ -99,8 +99,8 @@ basic_flat_streambuf(basic_flat_streambuf&& other) } template -basic_flat_streambuf:: -basic_flat_streambuf(basic_flat_streambuf&& other, +basic_flat_buffer:: +basic_flat_buffer(basic_flat_buffer&& other, Allocator const& alloc) : detail::empty_base_optimization< allocator_type>(alloc) @@ -114,9 +114,9 @@ basic_flat_streambuf(basic_flat_streambuf&& other, } template -basic_flat_streambuf:: -basic_flat_streambuf( - basic_flat_streambuf const& other) +basic_flat_buffer:: +basic_flat_buffer( + basic_flat_buffer const& other) : detail::empty_base_optimization( alloc_traits::select_on_container_copy_construction( other.member())) @@ -125,9 +125,9 @@ basic_flat_streambuf( } template -basic_flat_streambuf:: -basic_flat_streambuf( - basic_flat_streambuf const& other, +basic_flat_buffer:: +basic_flat_buffer( + basic_flat_buffer const& other, Allocator const& alloc) : detail::empty_base_optimization< allocator_type>(alloc) @@ -137,18 +137,18 @@ basic_flat_streambuf( template template -basic_flat_streambuf:: -basic_flat_streambuf( - basic_flat_streambuf const& other) +basic_flat_buffer:: +basic_flat_buffer( + basic_flat_buffer const& other) { copy_from(other); } template template -basic_flat_streambuf:: -basic_flat_streambuf( - basic_flat_streambuf const& other, +basic_flat_buffer:: +basic_flat_buffer( + basic_flat_buffer const& other, Allocator const& alloc) : detail::empty_base_optimization< allocator_type>(alloc) @@ -157,8 +157,8 @@ basic_flat_streambuf( } template -basic_flat_streambuf:: -basic_flat_streambuf(std::size_t limit) +basic_flat_buffer:: +basic_flat_buffer(std::size_t limit) : p_(nullptr) , in_(nullptr) , out_(nullptr) @@ -170,8 +170,8 @@ basic_flat_streambuf(std::size_t limit) } template -basic_flat_streambuf:: -basic_flat_streambuf(Allocator const& alloc, +basic_flat_buffer:: +basic_flat_buffer(Allocator const& alloc, std::size_t limit) : detail::empty_base_optimization< allocator_type>(alloc) @@ -187,7 +187,7 @@ basic_flat_streambuf(Allocator const& alloc, template auto -basic_flat_streambuf:: +basic_flat_buffer:: prepare(std::size_t n) -> mutable_buffers_type { @@ -212,7 +212,7 @@ prepare(std::size_t n) -> // enforce maximum capacity if(n > max_ - len) throw std::length_error{ - "flat_streambuf overflow"}; + "basic_flat_buffer overflow"}; // allocate a new buffer auto const new_size = (std::min)(max_, std::max( @@ -237,7 +237,7 @@ prepare(std::size_t n) -> template void -basic_flat_streambuf:: +basic_flat_buffer:: consume(std::size_t n) { if(n >= dist(in_, out_)) @@ -251,14 +251,14 @@ consume(std::size_t n) template void -basic_flat_streambuf:: +basic_flat_buffer:: reserve(std::size_t n) { if(n <= capacity()) return; if(n > max_) throw std::length_error{ - "flat_streambuf overflow"}; + "basic_flat_buffer overflow"}; auto const new_size = (std::min)(max_, std::max( detail::next_pow2(n), min_size)); @@ -282,7 +282,7 @@ reserve(std::size_t n) template void -basic_flat_streambuf:: +basic_flat_buffer:: shrink_to_fit() { auto const len = size(); @@ -312,7 +312,7 @@ shrink_to_fit() template std::size_t -read_size_helper(basic_flat_streambuf< +read_size_helper(basic_flat_buffer< Allocator> const& fb, std::size_t max_size) { BOOST_ASSERT(max_size >= 1); diff --git a/include/beast/http/basic_parser.hpp b/include/beast/http/basic_parser.hpp index e1b67ea6..4df1663b 100644 --- a/include/beast/http/basic_parser.hpp +++ b/include/beast/http/basic_parser.hpp @@ -190,10 +190,10 @@ enum class parse_state The parser is optimized for the case where the input buffer sequence consists of a single contiguous buffer. The - @ref beast::flat_streambuf class is provided, which guarantees + @ref beast::flat_buffer class is provided, which guarantees that the input sequence of the stream buffer will be represented by exactly one contiguous buffer. To ensure the optimum performance - of the parser, use @ref beast::flat_streambuf with HTTP algorithms + of the parser, use @ref beast::flat_buffer with HTTP algorithms such as @ref beast::http::read, @ref beast::http::read_some, @ref beast::http::async_read, and @ref beast::http::async_read_some. Alternatively, the caller may use custom techniques to ensure that diff --git a/test/Jamfile b/test/Jamfile index 360de803..2ab69509 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -25,7 +25,7 @@ unit-test core-tests : core/consuming_buffers.cpp core/dynabuf_readstream.cpp core/error.cpp - core/flat_streambuf.cpp + core/flat_buffer.cpp core/handler_alloc.cpp core/handler_concepts.cpp core/handler_ptr.cpp diff --git a/test/core/CMakeLists.txt b/test/core/CMakeLists.txt index 988f7203..67e6c403 100644 --- a/test/core/CMakeLists.txt +++ b/test/core/CMakeLists.txt @@ -18,7 +18,7 @@ add_executable (core-tests consuming_buffers.cpp dynabuf_readstream.cpp error.cpp - flat_streambuf.cpp + flat_buffer.cpp handler_alloc.cpp handler_concepts.cpp handler_ptr.cpp diff --git a/test/core/flat_streambuf.cpp b/test/core/flat_buffer.cpp similarity index 63% rename from test/core/flat_streambuf.cpp rename to test/core/flat_buffer.cpp index fec9c452..8b8d749b 100644 --- a/test/core/flat_streambuf.cpp +++ b/test/core/flat_buffer.cpp @@ -6,7 +6,7 @@ // // Test that header file is self-contained. -#include +#include #include "buffer_test.hpp" #include @@ -17,10 +17,10 @@ namespace beast { -static_assert(is_DynamicBuffer::value, +static_assert(is_DynamicBuffer::value, "DynamicBuffer requirements not met"); -class flat_streambuf_test : public beast::unit_test::suite +class flat_buffer_test : public beast::unit_test::suite { public: template @@ -35,8 +35,8 @@ public: template static bool - eq(basic_flat_streambuf const& sb1, - basic_flat_streambuf const& sb2) + eq(basic_flat_buffer const& sb1, + basic_flat_buffer const& sb2) { return to_string(sb1.data()) == to_string(sb2.data()); } @@ -50,13 +50,13 @@ public: Equal, Assign, Move, Swap, Select>; { using boost::asio::buffer_size; - basic_flat_streambuf b1{10}; + basic_flat_buffer b1{10}; BEAST_EXPECT(b1.size() == 0); BEAST_EXPECT(b1.capacity() == 0); BEAST_EXPECT(b1.max_size() == 10); b1.prepare(1); b1.commit(1); - basic_flat_streambuf b2{std::move(b1)}; + basic_flat_buffer b2{std::move(b1)}; BEAST_EXPECT(b1.capacity() == 0); BEAST_EXPECT(b1.max_size() == 10); BEAST_EXPECT(b2.size() == 1); @@ -65,29 +65,29 @@ public: BEAST_EXPECT(buffer_size(b1.prepare(1)) == 1); } { - basic_flat_streambuf b1{10}; - basic_flat_streambuf b2{std::move(b1), allocator{}}; + basic_flat_buffer b1{10}; + basic_flat_buffer b2{std::move(b1), allocator{}}; } { - basic_flat_streambuf b1{10}; - basic_flat_streambuf b2{b1}; + basic_flat_buffer b1{10}; + basic_flat_buffer b2{b1}; } { - basic_flat_streambuf b1{10}; - basic_flat_streambuf b2{b1, allocator{}}; + basic_flat_buffer b1{10}; + basic_flat_buffer b2{b1, allocator{}}; } { - flat_streambuf b1{10}; + flat_buffer b1{10}; b1.prepare(1); b1.commit(1); - basic_flat_streambuf b2{b1}; + basic_flat_buffer b2{b1}; BEAST_EXPECT(b2.size() == 1); } { - basic_flat_streambuf b1{10}; + basic_flat_buffer b1{10}; } { - basic_flat_streambuf b1{allocator{}, 10}; + basic_flat_buffer b1{allocator{}, 10}; } } @@ -136,14 +136,14 @@ public: // { - flat_streambuf b{10}; + flat_buffer b{10}; b.prepare(1); b.commit(1); b.reserve(2); BEAST_EXPECT(b.size() == 1); } { - flat_streambuf b{10}; + flat_buffer b{10}; try { b.reserve(11); @@ -162,35 +162,35 @@ public: using boost::asio::buffer; using boost::asio::buffer_copy; { - flat_streambuf fb{10}; - BEAST_EXPECT(fb.max_size() == 10); + flat_buffer b{10}; + BEAST_EXPECT(b.max_size() == 10); } { - flat_streambuf fb{1024}; - BEAST_EXPECT(fb.max_size() == 1024); + flat_buffer b{1024}; + BEAST_EXPECT(b.max_size() == 1024); } std::string const s = "Hello, world!"; for(std::size_t i = 1; i < s.size() - 1; ++i) { - flat_streambuf fb{1024}; - fb.commit(buffer_copy( - fb.prepare(i), buffer(s))); - fb.commit(buffer_copy( - fb.prepare(s.size() - i), + flat_buffer b{1024}; + b.commit(buffer_copy( + b.prepare(i), buffer(s))); + b.commit(buffer_copy( + b.prepare(s.size() - i), buffer(s.data() + i, s.size() - i))); - BEAST_EXPECT(to_string(fb.data()) == s); + BEAST_EXPECT(to_string(b.data()) == s); { - flat_streambuf fb2{fb}; - BEAST_EXPECT(eq(fb2, fb)); - flat_streambuf fb3{std::move(fb2)}; - BEAST_EXPECT(eq(fb3, fb)); - BEAST_EXPECT(! eq(fb2, fb3)); - BEAST_EXPECT(fb2.size() == 0); + flat_buffer b2{b}; + BEAST_EXPECT(eq(b2, b)); + flat_buffer b3{std::move(b2)}; + BEAST_EXPECT(eq(b3, b)); + BEAST_EXPECT(! eq(b2, b3)); + BEAST_EXPECT(b2.size() == 0); } using alloc_type = std::allocator; using type = - basic_flat_streambuf; + basic_flat_buffer; alloc_type alloc; { type fba{alloc, 1}; @@ -201,18 +201,18 @@ public: BEAST_EXPECT(fba.max_size() == 1024); } { - type fb2{fb}; - BEAST_EXPECT(eq(fb2, fb)); + type fb2{b}; + BEAST_EXPECT(eq(fb2, b)); type fb3{std::move(fb2)}; - BEAST_EXPECT(eq(fb3, fb)); + BEAST_EXPECT(eq(fb3, b)); BEAST_EXPECT(! eq(fb2, fb3)); BEAST_EXPECT(fb2.size() == 0); } { - type fb2{fb, alloc}; - BEAST_EXPECT(eq(fb2, fb)); + type fb2{b, alloc}; + BEAST_EXPECT(eq(fb2, b)); type fb3{std::move(fb2), alloc}; - BEAST_EXPECT(eq(fb3, fb)); + BEAST_EXPECT(eq(fb3, b)); BEAST_EXPECT(! eq(fb2, fb3)); BEAST_EXPECT(fb2.size() == 0); } @@ -224,57 +224,57 @@ public: { using boost::asio::buffer_size; - flat_streambuf fb{100}; - BEAST_EXPECT(fb.size() == 0); - BEAST_EXPECT(fb.capacity() == 0); + flat_buffer b{100}; + BEAST_EXPECT(b.size() == 0); + BEAST_EXPECT(b.capacity() == 0); - BEAST_EXPECT(buffer_size(fb.prepare(100)) == 100); - BEAST_EXPECT(fb.size() == 0); - BEAST_EXPECT(fb.capacity() > 0); + BEAST_EXPECT(buffer_size(b.prepare(100)) == 100); + BEAST_EXPECT(b.size() == 0); + BEAST_EXPECT(b.capacity() > 0); - fb.commit(20); - BEAST_EXPECT(fb.size() == 20); - BEAST_EXPECT(fb.capacity() == 100); + b.commit(20); + BEAST_EXPECT(b.size() == 20); + BEAST_EXPECT(b.capacity() == 100); - fb.consume(5); - BEAST_EXPECT(fb.size() == 15); - BEAST_EXPECT(fb.capacity() == 100); + b.consume(5); + BEAST_EXPECT(b.size() == 15); + BEAST_EXPECT(b.capacity() == 100); - fb.prepare(80); - fb.commit(80); - BEAST_EXPECT(fb.size() == 95); - BEAST_EXPECT(fb.capacity() == 100); + b.prepare(80); + b.commit(80); + BEAST_EXPECT(b.size() == 95); + BEAST_EXPECT(b.capacity() == 100); - fb.shrink_to_fit(); - BEAST_EXPECT(fb.size() == 95); - BEAST_EXPECT(fb.capacity() == 95); + b.shrink_to_fit(); + BEAST_EXPECT(b.size() == 95); + BEAST_EXPECT(b.capacity() == 95); } void testPrepare() { - flat_streambuf fb{100}; - fb.prepare(20); - BEAST_EXPECT(fb.capacity() == 100); - fb.commit(10); - BEAST_EXPECT(fb.capacity() == 100); - fb.consume(4); - BEAST_EXPECT(fb.capacity() == 100); - fb.prepare(14); - BEAST_EXPECT(fb.size() == 6); - BEAST_EXPECT(fb.capacity() == 100); - fb.consume(10); - BEAST_EXPECT(fb.size() == 0); - BEAST_EXPECT(fb.capacity() == 100); + flat_buffer b{100}; + b.prepare(20); + BEAST_EXPECT(b.capacity() == 100); + b.commit(10); + BEAST_EXPECT(b.capacity() == 100); + b.consume(4); + BEAST_EXPECT(b.capacity() == 100); + b.prepare(14); + BEAST_EXPECT(b.size() == 6); + BEAST_EXPECT(b.capacity() == 100); + b.consume(10); + BEAST_EXPECT(b.size() == 0); + BEAST_EXPECT(b.capacity() == 100); } void testMax() { - flat_streambuf fb{1}; + flat_buffer b{1}; try { - fb.prepare(2); + b.prepare(2); fail("", __FILE__, __LINE__); } catch(std::length_error const&) @@ -296,6 +296,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(flat_streambuf,core,beast); +BEAST_DEFINE_TESTSUITE(flat_buffer,core,beast); } // beast diff --git a/test/http/design.cpp b/test/http/design.cpp index 2afafcd7..e21bd984 100644 --- a/test/http/design.cpp +++ b/test/http/design.cpp @@ -5,7 +5,7 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#include +#include #include #include #include @@ -104,7 +104,7 @@ public: "*" }; message m; - flat_streambuf b{1024}; + flat_buffer b{1024}; read(is, b, m); BEAST_EXPECT(m.body == "*"); } @@ -117,7 +117,7 @@ public: "*" }; message m; - flat_streambuf b{20}; + flat_buffer b{20}; read(is, b, m); BEAST_EXPECT(m.body == "*"); } @@ -133,7 +133,7 @@ public: "0\r\n\r\n" }; message m; - flat_streambuf b{100}; + flat_buffer b{100}; read(is, b, m); BEAST_EXPECT(m.body == "*"); } @@ -201,7 +201,7 @@ public: "*" }; message m; - flat_streambuf b{1024}; + flat_buffer b{1024}; read(is, b, m); BEAST_EXPECT(m.body == "*"); } @@ -214,7 +214,7 @@ public: "*" }; message m; - flat_streambuf b{20}; + flat_buffer b{20}; read(is, b, m); BEAST_EXPECT(m.body == "*"); } @@ -231,7 +231,7 @@ public: "0\r\n\r\n" }; message m; - flat_streambuf b{1024}; + flat_buffer b{1024}; read(is, b, m); BEAST_EXPECT(m.body == "*"); } @@ -253,7 +253,7 @@ public: "*****" }; header_parser p; - flat_streambuf b{38}; + flat_buffer b{38}; auto const bytes_used = read_some(is, b, p); b.consume(bytes_used); @@ -272,7 +272,7 @@ public: "*****" }; header_parser p; - flat_streambuf b{20}; + flat_buffer b{20}; auto const bytes_used = read_some(is, b, p); b.consume(bytes_used); @@ -303,7 +303,7 @@ public: }; header_parser p; - flat_streambuf b{128}; + flat_buffer b{128}; auto const bytes_used = read_some(is, b, p); b.consume(bytes_used); @@ -335,7 +335,7 @@ public: DynamicBuffer& b, SyncReadStream& in) { - flat_streambuf buffer{4096}; // 4K limit + flat_buffer buffer{4096}; // 4K limit header_parser parser; error_code ec; do @@ -397,7 +397,7 @@ public: 3 // max_read }; test::string_ostream os{ios_}; - flat_streambuf b{16}; + flat_buffer b{16}; relay(os, b, is); } @@ -410,7 +410,7 @@ public: 3 // max_read }; test::string_ostream os{ios_}; - flat_streambuf b{16}; + flat_buffer b{16}; relay(os, b, is); } @@ -427,7 +427,7 @@ public: 2 // max_read }; test::string_ostream os{ios_}; - flat_streambuf b{16}; + flat_buffer b{16}; relay(os, b, is); } } @@ -444,7 +444,7 @@ public: void doFixedRead(SyncReadStream& stream, BodyCallback const& cb) { - flat_streambuf buffer{4096}; // 4K limit + flat_buffer buffer{4096}; // 4K limit header_parser parser; std::size_t bytes_used; bytes_used = read_some(stream, buffer, parser); diff --git a/test/http/header_parser.cpp b/test/http/header_parser.cpp index 473355c3..b54579f4 100644 --- a/test/http/header_parser.cpp +++ b/test/http/header_parser.cpp @@ -8,7 +8,7 @@ // Test that header file is self-contained. #include -#include +#include #include #include #include @@ -31,7 +31,7 @@ public: "User-Agent: test\r\n" "\r\n" }; - flat_streambuf db{1024}; + flat_buffer db{1024}; header_parser p; read_some(is, db, p); BEAST_EXPECT(p.is_complete()); @@ -44,7 +44,7 @@ public: "\r\n" "*" }; - flat_streambuf db{1024}; + flat_buffer db{1024}; header_parser p; read_some(is, db, p); BEAST_EXPECT(! p.is_complete()); diff --git a/test/http/message_parser.cpp b/test/http/message_parser.cpp index b06d7ea9..71e6aa57 100644 --- a/test/http/message_parser.cpp +++ b/test/http/message_parser.cpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include @@ -39,7 +39,7 @@ public: #if 0 multi_buffer dynabuf; #else - flat_streambuf dynabuf{1024}; + flat_buffer dynabuf{1024}; #endif message m; read(ss, dynabuf, m, ec); @@ -124,7 +124,7 @@ public: "Content-Length: 1\r\n" "\r\n" "*"}; - flat_streambuf b{1024}; + flat_buffer b{1024}; message_parser p; read(is, b, p, ec); auto const& m = p.get();