File tree Expand file tree Collapse file tree 5 files changed +420
-216
lines changed
doc/modules/ROOT/pages/design_requirements Expand file tree Collapse file tree 5 files changed +420
-216
lines changed Original file line number Diff line number Diff line change @@ -57,38 +57,55 @@ demonstrate the flow of the parse operation in each example:
5757[source,cpp]
5858----
5959void
60- read_some(stream& s, parser& pr)
60+ read_some(stream& s, parser& pr, error_code& ec )
6161{
62- system::error_code ec;
63- if(pr.need_data())
62+ pr.parse(ec);
63+ if(ec != condition::need_more_input)
64+ return;
65+
66+ auto n = s.read_some(pr.prepare(), ec);
67+ pr.commit(n);
68+ if(ec == asio::error::eof)
6469 {
65- auto n = s.read_some(pr.prepare(), ec);
66- pr.commit(n);
67- if(ec == asio::error::eof)
68- {
69- pr.commit_eof();
70- ec = {};
71- }
72- if(ec.failed())
73- throw system::system_error{ec};
70+ pr.commit_eof();
71+ ec = {};
7472 }
73+ else if(ec.failed())
74+ {
75+ return;
76+ }
77+
7578 pr.parse(ec);
76- if(ec.failed() && ec != condition::need_more_input)
77- throw system::system_error{ec};
7879}
7980
8081void
8182read_header(stream& s, parser& pr)
8283{
83- while(!pr.got_header())
84- read_some(s, pr);
84+ do
85+ {
86+ error_code ec;
87+ read_some(s, pr, ec);
88+ if(ec == condition::need_more_input)
89+ continue;
90+ if(ec.failed())
91+ throw system::system_error(ec);
92+ }
93+ while(! pr.got_header());
8594}
8695
8796void
8897read(stream& s, parser& pr)
89- {
90- while(!pr.is_complete())
91- read_some(s, pr);
98+ {
99+ do
100+ {
101+ error_code ec;
102+ read_some(s, pr, ec);
103+ if(ec == condition::need_more_input)
104+ continue;
105+ if(ec.failed())
106+ throw system::system_error(ec);
107+ }
108+ while(! pr.is_complete());
92109}
93110----
94111
Original file line number Diff line number Diff line change @@ -43,7 +43,9 @@ struct header_limits
4343 @li <a href="https://datatracker.ietf.org/doc/html/rfc9112#section-2.1"
4444 >2.1. Message Format (rfc9112)</a>
4545 @li <a href="https://datatracker.ietf.org/doc/html/rfc9112#section-5"
46- >5. Field Syntax (rfc9112)</a>
46+ >5. Field Syntax (rfc9112)</a>@see
47+ @li <a href="https://stackoverflow.com/questions/686217/maximum-on-http-header-values"
48+ >Maximum on HTTP header values (Stackoverflow)</a>
4749 */
4850 std::size_t max_size = 8 * 1024 ;
4951
You can’t perform that action at this time.
0 commit comments