Skip to content

Commit

Permalink
Update parser documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ashtum committed Jan 29, 2025
1 parent 7f348db commit 66da355
Show file tree
Hide file tree
Showing 5 changed files with 420 additions and 216 deletions.
55 changes: 36 additions & 19 deletions doc/modules/ROOT/pages/design_requirements/parser.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -57,38 +57,55 @@ demonstrate the flow of the parse operation in each example:
[source,cpp]
----
void
read_some(stream& s, parser& pr)
read_some(stream& s, parser& pr, error_code& ec)
{
system::error_code ec;
if(pr.need_data())
pr.parse(ec);
if(ec != condition::need_more_input)
return;
auto n = s.read_some(pr.prepare(), ec);
pr.commit(n);
if(ec == asio::error::eof)
{
auto n = s.read_some(pr.prepare(), ec);
pr.commit(n);
if(ec == asio::error::eof)
{
pr.commit_eof();
ec = {};
}
if(ec.failed())
throw system::system_error{ec};
pr.commit_eof();
ec = {};
}
else if(ec.failed())
{
return;
}
pr.parse(ec);
if(ec.failed() && ec != condition::need_more_input)
throw system::system_error{ec};
}
void
read_header(stream& s, parser& pr)
{
while(!pr.got_header())
read_some(s, pr);
do
{
error_code ec;
read_some(s, pr, ec);
if(ec == condition::need_more_input)
continue;
if(ec.failed())
throw system::system_error(ec);
}
while(! pr.got_header());
}
void
read(stream& s, parser& pr)
{
while(!pr.is_complete())
read_some(s, pr);
{
do
{
error_code ec;
read_some(s, pr, ec);
if(ec == condition::need_more_input)
continue;
if(ec.failed())
throw system::system_error(ec);
}
while(! pr.is_complete());
}
----

Expand Down
4 changes: 3 additions & 1 deletion include/boost/http_proto/header_limits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ struct header_limits
@li <a href="https://datatracker.ietf.org/doc/html/rfc9112#section-2.1"
>2.1. Message Format (rfc9112)</a>
@li <a href="https://datatracker.ietf.org/doc/html/rfc9112#section-5"
>5. Field Syntax (rfc9112)</a>
>5. Field Syntax (rfc9112)</a>@see
@li <a href="https://stackoverflow.com/questions/686217/maximum-on-http-header-values"
>Maximum on HTTP header values (Stackoverflow)</a>
*/
std::size_t max_size = 8 * 1024;

Expand Down
Loading

0 comments on commit 66da355

Please sign in to comment.