mirror of
https://github.com/boostorg/beast.git
synced 2025-08-03 14:54:32 +02:00
@@ -3,6 +3,7 @@ Version 123:
|
||||
* Use unit-test subtree
|
||||
* Fix spurious race in websocket close test
|
||||
* Check compiler feature in Jamfile
|
||||
* Clear previous message fields in parser
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
@@ -373,17 +373,19 @@ public:
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
private:
|
||||
// VFALCO But this leaves behind the method, target, and reason!
|
||||
/** Remove all fields from the container
|
||||
|
||||
All references, pointers, or iterators referring to contained
|
||||
elements are invalidated. All past-the-end iterators are also
|
||||
invalidated.
|
||||
|
||||
@par Postconditions:
|
||||
@code
|
||||
std::distance(this->begin(), this->end()) == 0
|
||||
@encode
|
||||
*/
|
||||
void
|
||||
clear();
|
||||
public:
|
||||
|
||||
/** Insert a field.
|
||||
|
||||
|
@@ -32,6 +32,7 @@ parser(Arg1&& arg1, ArgN&&... argn)
|
||||
std::forward<ArgN>(argn)...)
|
||||
, wr_(m_)
|
||||
{
|
||||
m_.clear();
|
||||
}
|
||||
|
||||
template<bool isRequest, class Body, class Allocator>
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include <boost/beast/http/read.hpp>
|
||||
#include <boost/beast/http/string_body.hpp>
|
||||
#include <boost/system/system_error.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
@@ -329,6 +330,19 @@ public:
|
||||
BEAST_EXPECT(used == 0);
|
||||
}
|
||||
|
||||
void
|
||||
testIssue818()
|
||||
{
|
||||
// Make sure that the parser clears pre-existing fields
|
||||
request<string_body> m;
|
||||
m.set(field::accept, "html/text");
|
||||
BEAST_EXPECT(std::distance(m.begin(), m.end()) == 1);
|
||||
request_parser<string_body> p{std::move(m)};
|
||||
BEAST_EXPECT(std::distance(m.begin(), m.end()) == 0);
|
||||
auto& m1 = p.get();
|
||||
BEAST_EXPECT(std::distance(m1.begin(), m1.end()) == 0);
|
||||
}
|
||||
|
||||
void
|
||||
run() override
|
||||
{
|
||||
@@ -336,6 +350,7 @@ public:
|
||||
testNeedMore<flat_buffer>();
|
||||
testNeedMore<multi_buffer>();
|
||||
testGotSome();
|
||||
testIssue818();
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user