MCPcopy Create free account
hub / github.com/boostorg/beast / doMatrix

Method doMatrix

test/beast/http/parser.cpp:72–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70
71 template<bool isRequest, class F>
72 void
73 doMatrix(string_view s0, F const& f)
74 {
75 // parse a single buffer
76 {
77 auto s = s0;
78 error_code ec;
79 parser_type<isRequest> p;
80 put(net::buffer(s.data(), s.size()), p, ec);
81 if(! BEAST_EXPECTS(! ec, ec.message()))
82 return;
83 f(p);
84 }
85 // parse two buffers
86 for(auto n = s0.size() - 1; n >= 1; --n)
87 {
88 auto s = s0;
89 error_code ec;
90 parser_type<isRequest> p;
91 p.eager(true);
92 auto used =
93 p.put(net::buffer(s.data(), n), ec);
94 s.remove_prefix(used);
95 if(ec == error::need_more)
96 ec = {};
97 if(! BEAST_EXPECTS(! ec, ec.message()))
98 continue;
99 BEAST_EXPECT(! p.is_done());
100 used = p.put(
101 net::buffer(s.data(), s.size()), ec);
102 s.remove_prefix(used);
103 if(! BEAST_EXPECTS(! ec, ec.message()))
104 continue;
105 BEAST_EXPECT(s.empty());
106 if(p.need_eof())
107 {
108 p.put_eof(ec);
109 if(! BEAST_EXPECTS(! ec, ec.message()))
110 continue;
111 }
112 if(BEAST_EXPECT(p.is_done()))
113 f(p);
114 }
115 }
116
117 void
118 testParse()

Callers

nothing calls this directly

Calls 8

messageMethod · 0.80
eagerMethod · 0.80
need_eofMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45
putMethod · 0.45
is_doneMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected