diff --git a/CHANGELOG.md b/CHANGELOG.md index 63134933..059d3677 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ API Changes: * Remove header_parser * Add verb to on_request for parsers * Refactor prepare +* Protect basic_fields special members -------------------------------------------------------------------------------- diff --git a/include/beast/http/fields.hpp b/include/beast/http/fields.hpp index 6c0b339d..dbba0b34 100644 --- a/include/beast/http/fields.hpp +++ b/include/beast/http/fields.hpp @@ -71,15 +71,11 @@ public: off_t len; }; -public: - /// The type of allocator used. - using allocator_type = Allocator; - - /// A constant iterator to the field sequence. - class const_iterator; - - /// A constant iterator to the field sequence. - using iterator = const_iterator; +protected: + // + // These are for `header` + // + friend class fields_test; /// Destructor ~basic_fields(); @@ -152,6 +148,16 @@ public: #endif basic_fields& operator=(basic_fields const&); +public: + /// The type of allocator used. + using allocator_type = Allocator; + + /// A constant iterator to the field sequence. + class const_iterator; + + /// A constant iterator to the field sequence. + using iterator = const_iterator; + /// Return a copy of the allocator associated with the container. allocator_type get_allocator() const @@ -304,7 +310,10 @@ public: swap(basic_fields& lhs, basic_fields& rhs); protected: - // for header + // + // for `header + // + string_view method_impl() const; string_view target_impl() const; string_view reason_impl() const; diff --git a/test/http/message.cpp b/test/http/message.cpp index 17bb1273..1f766ab9 100644 --- a/test/http/message.cpp +++ b/test/http/message.cpp @@ -114,14 +114,14 @@ public: } { - fields h; + header h; h.insert("User-Agent", "test"); message m{Arg1{}, h}; BEAST_EXPECT(h["User-Agent"] == "test"); BEAST_EXPECT(m["User-Agent"] == "test"); } { - fields h; + header h; h.insert("User-Agent", "test"); message m{Arg1{}, std::move(h)}; BEAST_EXPECT(! h.exists("User-Agent"));